- implemented pass-by-reference arguments - so far only for memory based variables.
- changed Dehacked weapon function lookup to check the symbol table instead of directly referencing the VM functions. Once scriptified these pointers will no longer be available. - removed all special ATAGs from the VM. While well intentioned any pointer tagged with them is basically unusable because it'd trigger asserts all over the place. - scriptified A_Punch for testing pass-by-reference parameters and stack variables.
This commit is contained in:
parent
7ff5069617
commit
3ce699bf9b
20 changed files with 205 additions and 126 deletions
|
|
@ -17,10 +17,13 @@
|
|||
#include "g_level.h"
|
||||
#include "d_net.h"
|
||||
#include "serializer.h"
|
||||
#include "thingdef.h"
|
||||
|
||||
#define BONUSADD 6
|
||||
|
||||
IMPLEMENT_CLASS(AWeapon, false, true, false, false)
|
||||
extern FFlagDef WeaponFlagDefs[];
|
||||
|
||||
IMPLEMENT_CLASS(AWeapon, false, true, true, false)
|
||||
|
||||
IMPLEMENT_POINTERS_START(AWeapon)
|
||||
IMPLEMENT_POINTER(Ammo1)
|
||||
|
|
@ -28,6 +31,26 @@ IMPLEMENT_POINTERS_START(AWeapon)
|
|||
IMPLEMENT_POINTER(SisterWeapon)
|
||||
IMPLEMENT_POINTERS_END
|
||||
|
||||
void AWeapon::InitNativeFields()
|
||||
{
|
||||
auto meta = RUNTIME_CLASS(AWeapon);
|
||||
|
||||
meta->AddNativeField("bAltFire", TypeBool, myoffsetof(AWeapon, bAltFire));
|
||||
|
||||
|
||||
// synthesize a symbol for each flag from the flag name tables to avoid redundant declaration of them.
|
||||
for (size_t i = 0; WeaponFlagDefs[i].flagbit != 0xffffffff; i++)
|
||||
{
|
||||
if (WeaponFlagDefs[i].structoffset > 0)
|
||||
{
|
||||
meta->AddNativeField(FStringf("b%s", WeaponFlagDefs[i].name), (WeaponFlagDefs[i].fieldsize == 4 ? TypeSInt32 : TypeSInt16), WeaponFlagDefs[i].structoffset, WeaponFlagDefs[i].varflags, WeaponFlagDefs[i].flagbit);
|
||||
}
|
||||
}
|
||||
// This flag is not accessible through actor definitions.
|
||||
meta->AddNativeField("bDehAmmo", TypeSInt32, myoffsetof(AWeapon, WeaponFlags), VARF_ReadOnly, WIF_DEHAMMO);
|
||||
|
||||
}
|
||||
|
||||
FString WeaponSection;
|
||||
TArray<FString> KeyConfWeapons;
|
||||
FWeaponSlots *PlayingKeyConf;
|
||||
|
|
@ -651,6 +674,15 @@ bool AWeapon::DepleteAmmo (bool altFire, bool checkEnough, int ammouse)
|
|||
return true;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AWeapon, DepleteAmmo)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(AWeapon);
|
||||
PARAM_BOOL(altfire);
|
||||
PARAM_BOOL_DEF(checkenough);
|
||||
PARAM_INT_DEF(ammouse);
|
||||
ACTION_RETURN_BOOL(self->DepleteAmmo(altfire, checkenough, ammouse));
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue