Skip to content

Commit

Permalink
fixed: AActor's members must all be native.
Browse files Browse the repository at this point in the history
The morph code added 4 scripted ones, but AActor's size must be known at compile time.
  • Loading branch information
coelckers committed Apr 25, 2024
1 parent 2b697d6 commit 7c9c7fa
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
7 changes: 6 additions & 1 deletion src/playsim/actor.h
Expand Up @@ -1362,18 +1362,23 @@ class AActor final : public DThinker
DVector3 Prev;
DRotator PrevAngles;
DAngle PrevFOV;
int PrevPortalGroup;
TArray<FDynamicLight *> AttachedLights;
TDeletingArray<FLightDefaults *> UserLights;
int PrevPortalGroup;

// When was this actor spawned?
int SpawnTime;
uint32_t SpawnOrder;

int UnmorphTime;
int MorphFlags;
int PremorphProperties;
PClassActor* MorphExitFlash;
// landing speed from a jump with normal gravity (squats the player's view)
// (note: this is put into AActor instead of the PlayerPawn because non-players also use the value)
double LandingSpeed;


// ThingIDs
void SetTID (int newTID);

Expand Down
8 changes: 7 additions & 1 deletion src/playsim/p_mobj.cpp
Expand Up @@ -393,7 +393,13 @@ void AActor::Serialize(FSerializer &arc)
A("userlights", UserLights)
A("WorldOffset", WorldOffset)
("modelData", modelData)
A("LandingSpeed", LandingSpeed);
A("LandingSpeed", LandingSpeed)

("unmorphtime", UnmorphTime)
("morphflags", MorphFlags)
("premorphproperties", PremorphProperties)
("morphexitflash", MorphExitFlash);


SerializeTerrain(arc, "floorterrain", floorterrain, &def->floorterrain);
SerializeArgs(arc, "args", args, def->args, special);
Expand Down
4 changes: 4 additions & 0 deletions src/scripting/vmthunks_actors.cpp
Expand Up @@ -2126,6 +2126,10 @@ DEFINE_FIELD(AActor, ShadowAimFactor)
DEFINE_FIELD(AActor, ShadowPenaltyFactor)
DEFINE_FIELD(AActor, AutomapOffsets)
DEFINE_FIELD(AActor, LandingSpeed)
DEFINE_FIELD(AActor, UnmorphTime)
DEFINE_FIELD(AActor, MorphFlags)
DEFINE_FIELD(AActor, PremorphProperties)
DEFINE_FIELD(AActor, MorphExitFlash)

DEFINE_FIELD_X(FCheckPosition, FCheckPosition, thing);
DEFINE_FIELD_X(FCheckPosition, FCheckPosition, pos);
Expand Down
8 changes: 4 additions & 4 deletions wadsrc/static/zscript/actors/morph.zs
Expand Up @@ -35,10 +35,10 @@ extend class Actor
MPROP_INVIS = 1 << 6,
}

int UnmorphTime;
EMorphFlags MorphFlags;
class<Actor> MorphExitFlash;
EPremorphProperty PremorphProperties;
native int UnmorphTime;
native int MorphFlags;
native class<Actor> MorphExitFlash;
native int PremorphProperties;

// Players still track these separately for legacy reasons.
void SetMorphStyle(EMorphFlags flags)
Expand Down

0 comments on commit 7c9c7fa

Please sign in to comment.