- completed the list of AActor exported member variables, with the exception of a few things that cannot be done yet.

Note that AActor::Inventory needed to be renamed because defining this symbol within AActor would hide the global type of the same name!
This commit is contained in:
Christoph Oelckers 2016-11-04 08:57:10 +01:00
parent 9563045305
commit d433fb76c9

View file

@ -157,6 +157,7 @@ extern FFlagDef ActorFlagDefs[];
void AActor::InitNativeFields()
{
PType *TypeActor = NewPointer(RUNTIME_CLASS(AActor));
PType *TypeActorClass = NewClassPointer(RUNTIME_CLASS(AActor));
PType *TypeInventory = NewPointer(RUNTIME_CLASS(AInventory));
PStruct *sstruct = NewStruct("Sector", nullptr);
auto TypeSector = NewPointer(sstruct);
@ -164,74 +165,158 @@ void AActor::InitNativeFields()
auto meta = RUNTIME_CLASS(AActor);
// Define the member variables we feel like exposing to the user
meta->AddNativeField(NAME_Alpha, TypeFloat64, myoffsetof(AActor, Alpha));
meta->AddNativeField(NAME_Angle, TypeFloat64, myoffsetof(AActor, Angles.Yaw));
meta->AddNativeField(NAME_Args, array5, myoffsetof(AActor, args));
meta->AddNativeField(NAME_CeilingZ, TypeFloat64, myoffsetof(AActor, ceilingz), VARF_ReadOnly);
meta->AddNativeField(NAME_FloorZ, TypeFloat64, myoffsetof(AActor, floorz), VARF_ReadOnly);
meta->AddNativeField(NAME_Health, TypeSInt32, myoffsetof(AActor, health), VARF_ReadOnly);
meta->AddNativeField(NAME_Mass, TypeSInt32, myoffsetof(AActor, Mass));
meta->AddNativeField(NAME_Pitch, TypeFloat64, myoffsetof(AActor, Angles.Pitch));
meta->AddNativeField(NAME_Roll, TypeFloat64, myoffsetof(AActor, Angles.Roll));
meta->AddNativeField(NAME_Special, TypeSInt32, myoffsetof(AActor, special));
meta->AddNativeField(NAME_TID, TypeSInt32, myoffsetof(AActor, tid), VARF_ReadOnly);
meta->AddNativeField(NAME_TIDtoHate, TypeSInt32, myoffsetof(AActor, TIDtoHate), VARF_ReadOnly);
meta->AddNativeField(NAME_WaterLevel, TypeSInt32, myoffsetof(AActor, waterlevel), VARF_ReadOnly);
meta->AddNativeField("Pos", TypeVector3, myoffsetof(AActor, __Pos), VARF_ReadOnly);
meta->AddNativeField(NAME_X, TypeFloat64, myoffsetof(AActor, __Pos.X), VARF_ReadOnly | VARF_Deprecated); // must remain read-only!
meta->AddNativeField(NAME_Y, TypeFloat64, myoffsetof(AActor, __Pos.Y), VARF_ReadOnly | VARF_Deprecated); // must remain read-only!
meta->AddNativeField(NAME_Z, TypeFloat64, myoffsetof(AActor, __Pos.Z), VARF_ReadOnly | VARF_Deprecated); // must remain read-only!
meta->AddNativeField("Prev", TypeVector3, myoffsetof(AActor, Prev));
meta->AddNativeField("spriteAngle", TypeFloat64, myoffsetof(AActor, SpriteAngle));
meta->AddNativeField("spriteRotation", TypeFloat64, myoffsetof(AActor, SpriteRotation));
meta->AddNativeField(NAME_VisibleStartAngle, TypeFloat64, myoffsetof(AActor, VisibleStartAngle));
meta->AddNativeField(NAME_VisibleStartPitch, TypeFloat64, myoffsetof(AActor, VisibleStartPitch));
meta->AddNativeField(NAME_VisibleEndAngle, TypeFloat64, myoffsetof(AActor, VisibleEndAngle));
meta->AddNativeField(NAME_VisibleEndPitch, TypeFloat64, myoffsetof(AActor, VisibleEndPitch));
meta->AddNativeField(NAME_Angle, TypeFloat64, myoffsetof(AActor, Angles.Yaw));
meta->AddNativeField(NAME_Pitch, TypeFloat64, myoffsetof(AActor, Angles.Pitch));
meta->AddNativeField(NAME_Roll, TypeFloat64, myoffsetof(AActor, Angles.Roll));
meta->AddNativeField("Vel", TypeVector3, myoffsetof(AActor, Vel));
meta->AddNativeField(NAME_VelX, TypeFloat64, myoffsetof(AActor, Vel.X), VARF_ReadOnly | VARF_Deprecated);
meta->AddNativeField(NAME_VelY, TypeFloat64, myoffsetof(AActor, Vel.Y), VARF_ReadOnly | VARF_Deprecated);
meta->AddNativeField(NAME_VelZ, TypeFloat64, myoffsetof(AActor, Vel.Z), VARF_ReadOnly | VARF_Deprecated);
meta->AddNativeField(NAME_MomX, TypeFloat64, myoffsetof(AActor, Vel.X), VARF_ReadOnly | VARF_Deprecated);
meta->AddNativeField(NAME_MomY, TypeFloat64, myoffsetof(AActor, Vel.Y), VARF_ReadOnly | VARF_Deprecated);
meta->AddNativeField(NAME_MomZ, TypeFloat64, myoffsetof(AActor, Vel.Z), VARF_ReadOnly | VARF_Deprecated);
meta->AddNativeField(NAME_ScaleX, TypeFloat64, myoffsetof(AActor, Scale.X), VARF_Deprecated);
meta->AddNativeField(NAME_ScaleY, TypeFloat64, myoffsetof(AActor, Scale.Y), VARF_Deprecated);
meta->AddNativeField(NAME_Score, TypeSInt32, myoffsetof(AActor, Score));
meta->AddNativeField(NAME_Accuracy, TypeSInt32, myoffsetof(AActor, accuracy));
meta->AddNativeField(NAME_Stamina, TypeSInt32, myoffsetof(AActor, stamina));
meta->AddNativeField(NAME_Height, TypeFloat64, myoffsetof(AActor, Height));
meta->AddNativeField(NAME_Radius, TypeFloat64, myoffsetof(AActor, radius), VARF_ReadOnly);
meta->AddNativeField(NAME_ReactionTime, TypeSInt32, myoffsetof(AActor, reactiontime));
meta->AddNativeField(NAME_MeleeRange, TypeFloat64, myoffsetof(AActor, meleerange));
meta->AddNativeField(NAME_Speed, TypeFloat64, myoffsetof(AActor, Speed));
meta->AddNativeField("FloatSpeed", TypeFloat64, myoffsetof(AActor, FloatSpeed));
meta->AddNativeField("PainThreshold", TypeSInt32, myoffsetof(AActor, PainThreshold));
meta->AddNativeField("spriteAngle", TypeFloat64, myoffsetof(AActor, SpriteAngle));
meta->AddNativeField("spriteRotation", TypeFloat64, myoffsetof(AActor, SpriteRotation));
meta->AddNativeField(NAME_Threshold, TypeSInt32, myoffsetof(AActor, threshold));
meta->AddNativeField(NAME_DefThreshold, TypeSInt32, myoffsetof(AActor, DefThreshold), VARF_ReadOnly);
meta->AddNativeField(NAME_Damage, TypeSInt32, myoffsetof(AActor, DamageVal), VARF_ReadOnly);
meta->AddNativeField("visdir", TypeSInt32, myoffsetof(AActor, visdir));
meta->AddNativeField("Gravity", TypeFloat64, myoffsetof(AActor, Gravity));
meta->AddNativeField("FloorClip", TypeFloat64, myoffsetof(AActor, Floorclip));
meta->AddNativeField("DamageType", TypeName, myoffsetof(AActor, DamageType));
meta->AddNativeField("FloatBobPhase", TypeUInt8, myoffsetof(AActor, FloatBobPhase));
meta->AddNativeField("tics", TypeSInt32, myoffsetof(AActor, tics));
meta->AddNativeField("RipperLevel", TypeSInt32, myoffsetof(AActor, RipperLevel));
meta->AddNativeField("RipLevelMin", TypeSInt32, myoffsetof(AActor, RipLevelMin));
meta->AddNativeField("RipLevelMax", TypeSInt32, myoffsetof(AActor, RipLevelMax));
meta->AddNativeField("special2", TypeSInt32, myoffsetof(AActor, special2));
meta->AddNativeField(NAME_VisibleStartAngle, TypeFloat64, myoffsetof(AActor, VisibleStartAngle));
meta->AddNativeField(NAME_VisibleStartPitch, TypeFloat64, myoffsetof(AActor, VisibleStartPitch));
meta->AddNativeField(NAME_VisibleEndAngle, TypeFloat64, myoffsetof(AActor, VisibleEndAngle));
meta->AddNativeField(NAME_VisibleEndPitch, TypeFloat64, myoffsetof(AActor, VisibleEndPitch));
meta->AddNativeField("AttackSound", TypeSound, myoffsetof(AActor, AttackSound));
meta->AddNativeField("DeathSound", TypeSound, myoffsetof(AActor, DeathSound));
meta->AddNativeField("SeeSound", TypeSound, myoffsetof(AActor, SeeSound));
meta->AddNativeField("Pos", TypeVector3, myoffsetof(AActor, __Pos), VARF_ReadOnly);
meta->AddNativeField("Vel", TypeVector3, myoffsetof(AActor, Vel));
meta->AddNativeField("sprite", TypeSInt32, myoffsetof(AActor, sprite)); // this is an index, not a name!
meta->AddNativeField("frame", TypeUInt8, myoffsetof(AActor, frame));
meta->AddNativeField("Scale", TypeVector2, myoffsetof(AActor, Scale));
meta->AddNativeField(NAME_ScaleX, TypeFloat64, myoffsetof(AActor, Scale.X), VARF_Deprecated);
meta->AddNativeField(NAME_ScaleY, TypeFloat64, myoffsetof(AActor, Scale.Y), VARF_Deprecated);
//FRenderStyle RenderStyle; // how do we expose this?
meta->AddNativeField("picnum", TypeSInt32, myoffsetof(AActor, picnum)); // Do we need a variable type 'texture' to do this?
meta->AddNativeField(NAME_Alpha, TypeFloat64, myoffsetof(AActor, Alpha));
meta->AddNativeField("fillcolor", TypeColor, myoffsetof(AActor, fillcolor));
meta->AddNativeField("Sector", TypeSector, myoffsetof(AActor, Sector));
//meta->AddNativeField("Subsector", TypeSubsector, myoffsetof(AActor, subsector));
meta->AddNativeField(NAME_CeilingZ, TypeFloat64, myoffsetof(AActor, ceilingz), VARF_ReadOnly);
meta->AddNativeField(NAME_FloorZ, TypeFloat64, myoffsetof(AActor, floorz), VARF_ReadOnly);
meta->AddNativeField("DropoffZ", TypeFloat64, myoffsetof(AActor, dropoffz), VARF_ReadOnly);
meta->AddNativeField("floorsector", TypeSector, myoffsetof(AActor, floorsector));
meta->AddNativeField("floorpic", TypeSInt32, myoffsetof(AActor, floorpic)); // Do we need a variable type 'texture' to do this?
meta->AddNativeField("floorterrain", TypeSInt32, myoffsetof(AActor, floorterrain));
meta->AddNativeField("ceilingsector", TypeSector, myoffsetof(AActor, ceilingsector));
meta->AddNativeField("ceilingpic", TypeSInt32, myoffsetof(AActor, ceilingpic)); // Do we need a variable type 'texture' to do this?
meta->AddNativeField(NAME_Height, TypeFloat64, myoffsetof(AActor, Height));
meta->AddNativeField(NAME_Radius, TypeFloat64, myoffsetof(AActor, radius), VARF_ReadOnly);
meta->AddNativeField("projectilepassheight",TypeFloat64, myoffsetof(AActor, projectilepassheight));
meta->AddNativeField("tics", TypeSInt32, myoffsetof(AActor, tics));
meta->AddNativeField("CurState", TypeState, myoffsetof(AActor, state), VARF_ReadOnly); // has to be renamed on the script side because it clashes with the same named type.
meta->AddNativeField("SeeState", TypeState, myoffsetof(AActor, SeeState), VARF_ReadOnly);
meta->AddNativeField(NAME_Damage, TypeSInt32, myoffsetof(AActor, DamageVal), VARF_ReadOnly);
meta->AddNativeField("projectilekickback", TypeSInt32, myoffsetof(AActor, projectileKickback));
//DWORD VisibleToTeam;
meta->AddNativeField("special1", TypeSInt32, myoffsetof(AActor, special1));
meta->AddNativeField("special2", TypeSInt32, myoffsetof(AActor, special2));
meta->AddNativeField("specialf1", TypeFloat64, myoffsetof(AActor, specialf1));
meta->AddNativeField("specialf2", TypeFloat64, myoffsetof(AActor, specialf2));
meta->AddNativeField("weaponspecial", TypeSInt32, myoffsetof(AActor, weaponspecial));
meta->AddNativeField(NAME_Health, TypeSInt32, myoffsetof(AActor, health), VARF_ReadOnly);
meta->AddNativeField("movedir", TypeUInt8, myoffsetof(AActor, movedir));
meta->AddNativeField("visdir", TypeSInt8, myoffsetof(AActor, visdir));
meta->AddNativeField("movecount", TypeSInt16, myoffsetof(AActor, movecount));
meta->AddNativeField("strafecount", TypeSInt16, myoffsetof(AActor, strafecount));
meta->AddNativeField(NAME_Target, TypeActor, myoffsetof(AActor, target));
meta->AddNativeField(NAME_Master, TypeActor, myoffsetof(AActor, master));
meta->AddNativeField(NAME_Tracer, TypeActor, myoffsetof(AActor, tracer));
meta->AddNativeField("LastHeard", TypeActor, myoffsetof(AActor, LastHeard));
meta->AddNativeField("LastEnemy", TypeActor, myoffsetof(AActor, lastenemy));
meta->AddNativeField("Sector", TypeSector, myoffsetof(AActor, Sector));
meta->AddNativeField("LastLookActor", TypeActor, myoffsetof(AActor, LastLookActor));
meta->AddNativeField(NAME_ReactionTime, TypeSInt32, myoffsetof(AActor, reactiontime));
meta->AddNativeField(NAME_Threshold, TypeSInt32, myoffsetof(AActor, threshold));
meta->AddNativeField(NAME_DefThreshold, TypeSInt32, myoffsetof(AActor, DefThreshold), VARF_ReadOnly);
meta->AddNativeField("SpawnPoint", TypeVector3, myoffsetof(AActor, SpawnPoint), VARF_ReadOnly);
meta->AddNativeField("SpawnAngle", TypeUInt16, myoffsetof(AActor, SpawnAngle), VARF_ReadOnly);
meta->AddNativeField("StartHealth", TypeSInt32, myoffsetof(AActor, StartHealth));
meta->AddNativeField("WeaveIndexXY", TypeUInt16, myoffsetof(AActor, WeaveIndexXY));
meta->AddNativeField("WeaveIndexZ", TypeUInt16, myoffsetof(AActor, WeaveIndexZ));
meta->AddNativeField("skillrespawncount", TypeSInt32, myoffsetof(AActor, skillrespawncount));
meta->AddNativeField(NAME_Args, array5, myoffsetof(AActor, args));
meta->AddNativeField(NAME_Mass, TypeSInt32, myoffsetof(AActor, Mass));
meta->AddNativeField(NAME_Special, TypeSInt32, myoffsetof(AActor, special));
meta->AddNativeField(NAME_TID, TypeSInt32, myoffsetof(AActor, tid), VARF_ReadOnly);
meta->AddNativeField(NAME_TIDtoHate, TypeSInt32, myoffsetof(AActor, TIDtoHate), VARF_ReadOnly);
meta->AddNativeField(NAME_WaterLevel, TypeSInt32, myoffsetof(AActor, waterlevel), VARF_ReadOnly);
meta->AddNativeField(NAME_Score, TypeSInt32, myoffsetof(AActor, Score));
meta->AddNativeField(NAME_Accuracy, TypeSInt32, myoffsetof(AActor, accuracy));
meta->AddNativeField(NAME_Stamina, TypeSInt32, myoffsetof(AActor, stamina));
meta->AddNativeField(NAME_MeleeRange, TypeFloat64, myoffsetof(AActor, meleerange));
meta->AddNativeField("PainThreshold", TypeSInt32, myoffsetof(AActor, PainThreshold));
meta->AddNativeField("Gravity", TypeFloat64, myoffsetof(AActor, Gravity));
meta->AddNativeField("FloorClip", TypeFloat64, myoffsetof(AActor, Floorclip));
meta->AddNativeField("DamageType", TypeName, myoffsetof(AActor, DamageType));
meta->AddNativeField("DamageTypeReceived", TypeName, myoffsetof(AActor, DamageTypeReceived));
meta->AddNativeField("FloatBobPhase", TypeUInt8, myoffsetof(AActor, FloatBobPhase));
meta->AddNativeField("RipperLevel", TypeSInt32, myoffsetof(AActor, RipperLevel));
meta->AddNativeField("RipLevelMin", TypeSInt32, myoffsetof(AActor, RipLevelMin));
meta->AddNativeField("RipLevelMax", TypeSInt32, myoffsetof(AActor, RipLevelMax));
meta->AddNativeField("Species", TypeName, myoffsetof(AActor, Species));
meta->AddNativeField("Alternative", TypeActor, myoffsetof(AActor, alternative));
meta->AddNativeField("goal", TypeActor, myoffsetof(AActor, goal));
meta->AddNativeField("MinMissileChance", TypeUInt8, myoffsetof(AActor, MinMissileChance));
meta->AddNativeField("LastLookPlayerNumber",TypeSInt8, myoffsetof(AActor, LastLookPlayerNumber));
meta->AddNativeField("SpawnFlags", TypeUInt32, myoffsetof(AActor, SpawnFlags));
meta->AddNativeField("meleethreshold", TypeFloat64, myoffsetof(AActor, meleethreshold));
meta->AddNativeField("maxtargetrange", TypeFloat64, myoffsetof(AActor, maxtargetrange));
meta->AddNativeField("bouncefactor", TypeFloat64, myoffsetof(AActor, bouncefactor));
meta->AddNativeField("wallbouncefactor", TypeFloat64, myoffsetof(AActor, wallbouncefactor));
meta->AddNativeField("bouncecount", TypeSInt32, myoffsetof(AActor, bouncecount));
meta->AddNativeField("friction", TypeFloat64, myoffsetof(AActor, Friction));
meta->AddNativeField("FastChaseStrafeCount",TypeSInt32, myoffsetof(AActor, FastChaseStrafeCount));
meta->AddNativeField("pushfactor", TypeFloat64, myoffsetof(AActor, pushfactor));
meta->AddNativeField("lastpush", TypeSInt32, myoffsetof(AActor, lastpush));
meta->AddNativeField("activationtype", TypeSInt32, myoffsetof(AActor, activationtype));
meta->AddNativeField("lastbump", TypeSInt32, myoffsetof(AActor, lastbump));
meta->AddNativeField("DesignatedTeam", TypeSInt32, myoffsetof(AActor, DesignatedTeam));
meta->AddNativeField("BlockingMobj", TypeActor, myoffsetof(AActor, BlockingMobj));
//line_t *BlockingLine; // Line that blocked the last move
meta->AddNativeField("PoisonDamage", TypeSInt32, myoffsetof(AActor, PoisonDamage));
meta->AddNativeField("PoisonDamageType", TypeName, myoffsetof(AActor, PoisonDamageType));
meta->AddNativeField("PoisonDuration", TypeSInt32, myoffsetof(AActor, PoisonDuration));
meta->AddNativeField("PoisonPeriod", TypeSInt32, myoffsetof(AActor, PoisonPeriod));
meta->AddNativeField("PoisonDamageReceived",TypeSInt32, myoffsetof(AActor, PoisonDamageReceived));
meta->AddNativeField("PoisonDamageTypeReceived", TypeName, myoffsetof(AActor, PoisonDamageTypeReceived));
meta->AddNativeField("PoisonDurationReceived", TypeSInt32, myoffsetof(AActor, PoisonDurationReceived));
meta->AddNativeField("PoisonPeriodReceived", TypeSInt32, myoffsetof(AActor, PoisonPeriodReceived));
meta->AddNativeField("Poisoner", TypeActor, myoffsetof(AActor, Poisoner));
meta->AddNativeField("Inv", TypeInventory, myoffsetof(AActor, Inventory)); // Needs to be renamed because it hides the actual type.
meta->AddNativeField("smokecounter", TypeUInt8, myoffsetof(AActor, smokecounter));
meta->AddNativeField("FriendPlayer", TypeUInt8, myoffsetof(AActor, FriendPlayer));
meta->AddNativeField("Translation", TypeUInt32, myoffsetof(AActor, Translation));
meta->AddNativeField("AttackSound", TypeSound, myoffsetof(AActor, AttackSound));
meta->AddNativeField("DeathSound", TypeSound, myoffsetof(AActor, DeathSound));
meta->AddNativeField("SeeSound", TypeSound, myoffsetof(AActor, SeeSound));
meta->AddNativeField("PainSound", TypeSound, myoffsetof(AActor, PainSound));
meta->AddNativeField("ActiveSound", TypeSound, myoffsetof(AActor, ActiveSound));
meta->AddNativeField("UseSound", TypeSound, myoffsetof(AActor, UseSound));
meta->AddNativeField("BounceSound", TypeSound, myoffsetof(AActor, BounceSound));
meta->AddNativeField("WallBounceSound", TypeSound, myoffsetof(AActor, WallBounceSound));
meta->AddNativeField("CrushPainSound", TypeSound, myoffsetof(AActor, CrushPainSound));
meta->AddNativeField("MaxDropoffHeight", TypeFloat64, myoffsetof(AActor, MaxDropOffHeight));
meta->AddNativeField("MaxStepHeight", TypeFloat64, myoffsetof(AActor, MaxStepHeight));
meta->AddNativeField("PainChance", TypeSInt16, myoffsetof(AActor, PainChance));
meta->AddNativeField("PainType", TypeName, myoffsetof(AActor, PainType));
meta->AddNativeField("DeathType", TypeName, myoffsetof(AActor, DeathType));
meta->AddNativeField("DamageFactor", TypeFloat64, myoffsetof(AActor, DamageFactor));
meta->AddNativeField("DamageMultiply", TypeFloat64, myoffsetof(AActor, DamageMultiply));
meta->AddNativeField("TelefogSpurceType", TypeActorClass, myoffsetof(AActor, TeleFogSourceType));
meta->AddNativeField("TelefogDestType", TypeActorClass, myoffsetof(AActor, TeleFogDestType));
meta->AddNativeField("SpawnState", TypeState, myoffsetof(AActor, SpawnState), VARF_ReadOnly);
meta->AddNativeField("SeeState", TypeState, myoffsetof(AActor, SeeState), VARF_ReadOnly);
meta->AddNativeField("MeleeState", TypeState, myoffsetof(AActor, MeleeState), VARF_ReadOnly);
meta->AddNativeField("MissileState", TypeState, myoffsetof(AActor, MissileState), VARF_ReadOnly);
//int ConversationRoot; // THe root of the current dialogue
//FStrifeDialogueNode *Conversation; // [RH] The dialogue to show when this actor is "used."
//FDecalBase *DecalGenerator;
// synthesize a symbol for each flag from the flag name tables to avoid redundant declaration of them.
for (size_t i = 0; ActorFlagDefs[i].flagbit != 0xffffffff; i++)