- moved the 3 actor properties out of the global data.

This commit is contained in:
Christoph Oelckers 2022-12-21 16:31:51 +01:00
parent cc8495c31e
commit 62ace9371f
15 changed files with 34 additions and 54 deletions

View file

@ -69,3 +69,6 @@ xx(brokenstate)
xx(breaksound)
xx(fullbright)
xx(spawnsound)
xx(gutsoffset)
xx(falladjustz)
xx(aimoffset)

View file

@ -794,7 +794,7 @@ void gutsdir(DDukeActor* actor, int gtype, int n, int p)
if (gutz > floorz - 8)
gutz = floorz - 8;
gutz += gs.actorinfo[actor->spr.picnum].gutsoffset;
gutz += actor->IntVar(NAME_gutsoffset);
for (int j = 0; j < n; j++)
{
@ -3402,7 +3402,7 @@ void fall_common(DDukeActor *actor, int playernum, int DRONE, int(*fallspecial)(
}
}
if (actor->sector()->lotag == 1)
actor->spr.pos.Z += gs.actorinfo[actor->spr.picnum].falladjustz;
actor->spr.pos.Z += actor->IntVar(NAME_falladjustz);
else actor->vel.Z = 0;
}
}

View file

@ -40,20 +40,6 @@ BEGIN_DUKE_NS
void initactorflags_d()
{
gs.actorinfo[DTILE_COMMANDER].gutsoffset = -24;
for (auto &fa : gs.actorinfo)
{
fa.falladjustz = 24;
}
gs.actorinfo[DTILE_OCTABRAIN].falladjustz = gs.actorinfo[DTILE_COMMANDER].falladjustz = gs.actorinfo[DTILE_DRONE].falladjustz = 0;
// The feature guarded by this flag does not exist in Duke, it always acts as if the flag was set.
gs.actorinfo[DTILE_ORGANTIC].aimoffset = 32;
gs.actorinfo[DTILE_ROTATEGUN].aimoffset = 32;
gs.weaponsandammosprites[0] = DTILE_RPGSPRITE;
gs.weaponsandammosprites[1] = DTILE_CHAINGUNSPRITE;
gs.weaponsandammosprites[2] = DTILE_DEVISTATORAMMO;

View file

@ -34,17 +34,6 @@ BEGIN_DUKE_NS
void initactorflags_r()
{
for (auto& fa : gs.actorinfo)
{
fa.falladjustz = 24;
}
if (isRRRA())
{
gs.actorinfo[RTILE_HULKBOAT].falladjustz = 12;
gs.actorinfo[RTILE_MINIONBOAT].falladjustz = 3;
gs.actorinfo[RTILE_CHEERBOAT].falladjustz = gs.actorinfo[RTILE_EMPTYBOAT].falladjustz = 6;
}
gs.actorinfo[RTILE_DRONE].falladjustz = 0;
gs.weaponsandammosprites[0] = RTILE_CROSSBOWSPRITE;
gs.weaponsandammosprites[1] = RTILE_RIFLEGUNSPRITE;
gs.weaponsandammosprites[2] = RTILE_DEVISTATORAMMO;

View file

@ -349,7 +349,7 @@ DDukeActor* aim(DDukeActor* actor, int abase)
}
else check = 1;
int cans = cansee(act->spr.pos.plusZ(-32 + gs.actorinfo[act->spr.picnum].aimoffset), act->sector(), actor->spr.pos.plusZ(-32), actor->sector());
int cans = cansee(act->spr.pos.plusZ(-32 + act->IntVar(NAME_aimoffset)), act->sector(), actor->spr.pos.plusZ(-32), actor->sector());
if (check && cans)
{

View file

@ -56,9 +56,6 @@ struct ActorInfo
{
uint32_t scriptaddress;
EDukeFlags1 enemyflags; // placeholder during parsing. Since CON gets parsed before the spawn type table we cannot copy these to their final location yet.
int aimoffset;
int falladjustz;
int gutsoffset;
};
class DDukeActor : public DCoreActor

View file

@ -398,18 +398,6 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, lotsofstuff, DukeActor_Lotsofstuff)
return 0;
}
double DukeActor_gutsoffset(DDukeActor* self)
{
return gs.actorinfo[self->spr.picnum].gutsoffset;
}
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, gutsoffset, DukeActor_gutsoffset)
{
PARAM_SELF_PROLOGUE(DDukeActor);
ACTION_RETURN_FLOAT(DukeActor_gutsoffset(self));
return 0;
}
int DukeActor_movesprite(DDukeActor* actor, double velx, double vely, double velz, int clipmask)
{
Collision coll;

View file

@ -7,6 +7,8 @@ class DukeCommander : DukeActor
+KILLCOUNT;
+NOWATERDIP;
+FLOATING;
gutsoffset -24;
falladjustz 0;
}
override void PlayFTASound()

View file

@ -54,6 +54,7 @@ class RedneckEmptyBoat : DukeActor
{
pic "EMPTYBOAT";
+ALWAYSROTATE2;
falladjustz 6;
}
override void Initialize()

View file

@ -17,7 +17,7 @@ extend class DukeActor
if (gutz > floorz - 8)
gutz = floorz - 8;
gutz += self.gutsoffset();
gutz += self.gutsoffset;
if (self.badguy() && self.pal == 6)
pal = 6;

View file

@ -7,6 +7,7 @@ class DukeDrone : DukeActor
+KILLCOUNT;
+NOWATERDIP;
+FLOATING;
falladjustz 0;
}
override void PlayFTASound()
@ -22,6 +23,7 @@ class DukeTurret : DukeActor
pic "ORGANTIC";
+INTERNAL_BADGUY;
+KILLCOUNT;
aimoffset 32;
}
override void PlayFTASound()
@ -44,6 +46,7 @@ class DukeRotateGun : DukeActor
+KILLCOUNT;
+NODAMAGEPUSH;
+NORADIUSPUSH;
aimoffset 32;
}
override void Initialize()

View file

@ -6,6 +6,7 @@ class DukeOctabrain : DukeActor
+INTERNAL_BADGUY;
+KILLCOUNT;
+NOWATERDIP;
falladjustz 0;
}
override void PlayFTASound()

View file

@ -39,8 +39,9 @@ class DukeProjectile : DukeActor
}
Vector3 oldpos; // holds the position before the current move
double velx, vely; // holds the actual velocity for the current move. This can differ from the actor's internal values.
Sound SpawnSound;
meta Sound SpawnSound;
property SpawnSound: SpawnSound;
// this large batch of subsequently called virtuals is owed to the spaghetti-like implementation of the orignal moveprojectiles function.
@ -339,11 +340,7 @@ class DukeRPG : DukeProjectile
+DOUBLEDMGTHRUST;
+NOFLOORPAL;
+BREAKMIRRORS;
}
override void Initialize()
{
SpawnSound = "RPG_SHOOT";
DukeProjectile.SpawnSound "RPG_SHOOT";
}
override bool premoveeffect()
@ -828,12 +825,12 @@ class RedneckChickenArrow : RedneckDynamiteArrow
+FORCEAUTOAIM;
+NOFLOORPAL;
+ALWAYSROTATE2;
DukeProjectile.SpawnSound "CHICKENBOW_FIRE";
}
override void Initialize()
{
self.hitag = 0;
SpawnSound = "CHICKENBOW_FIRE";
self.lotsofstuff("RedneckFeather", random(1, 4));
}
@ -901,11 +898,11 @@ class RedneckBoatGrenade : RedneckDynamiteArrow // RRRA only
pic "BOATGRENADE";
-DOUBLEDMGTHRUST;
-ALWAYSROTATE2;
DukeProjectile.SpawnSound "MORTAR";
}
override void Initialize()
{
SpawnSound = "MORTAR";
self.extra = 10;
self.vel.Z = -10;

View file

@ -138,6 +138,7 @@ class RedneckMinionBoat : DukeActor
+KILLCOUNT;
+LOOKALLAROUND;
+DONTDIVE;
falladjustz 3;
}
override void Initialize()
{
@ -155,6 +156,7 @@ class RedneckHulkBoat : DukeActor
+KILLCOUNT;
+LOOKALLAROUND;
+DONTDIVE;
falladjustz 12;
}
override void Initialize()
{
@ -172,6 +174,7 @@ class RedneckCheerBoat : DukeActor
+KILLCOUNT;
+LOOKALLAROUND;
+DONTDIVE;
falladjustz 6;
}
override void Initialize()
{
@ -429,6 +432,7 @@ class RedneckMosquito : DukeActor
+KILLCOUNT;
+NOWATERDIP;
+FLOATING;
falladjustz 0;
}
override void Initialize()
{

View file

@ -88,6 +88,7 @@ class DukeActor : CoreActor native
default
{
lookallarounddefault;
falladjustz 24;
}
enum EStatnums
{
@ -141,6 +142,15 @@ class DukeActor : CoreActor native
antifaceplayerslow = 32768
};
meta int gutsoffset;
meta int falladjustz;
meta int aimoffset;
property prefix: none;
property gutsoffset: gutsoffset;
property falladjustz: falladjustz;
property aimoffset: aimoffset;
native void SetSpritesetImage(int index);
native int GetSpritesetSize();
@ -220,7 +230,6 @@ class DukeActor : CoreActor native
native int scripted();
native int isplayer();
native void lotsofstuff(class<DukeActor> type, int count);
native double gutsoffset();
native int movesprite(Vector3 move, int clipmask);
native int movesprite_ex(Vector3 move, int clipmask, CollisionData coll);
native void shoot(class<DukeActor> spawnclass);