diff --git a/source/core/namedef_custom.h b/source/core/namedef_custom.h index 0822fcd01..277ccb049 100644 --- a/source/core/namedef_custom.h +++ b/source/core/namedef_custom.h @@ -69,3 +69,6 @@ xx(brokenstate) xx(breaksound) xx(fullbright) xx(spawnsound) +xx(gutsoffset) +xx(falladjustz) +xx(aimoffset) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 586c2116e..f651e08d1 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -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; } } diff --git a/source/games/duke/src/flags_d.cpp b/source/games/duke/src/flags_d.cpp index 4b4a35aef..7f8cdaf18 100644 --- a/source/games/duke/src/flags_d.cpp +++ b/source/games/duke/src/flags_d.cpp @@ -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; diff --git a/source/games/duke/src/flags_r.cpp b/source/games/duke/src/flags_r.cpp index df7be5195..b992be115 100644 --- a/source/games/duke/src/flags_r.cpp +++ b/source/games/duke/src/flags_r.cpp @@ -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; diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 855f72e4e..f3c44e57c 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -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) { diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index bfb81fde6..72778742d 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -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 diff --git a/source/games/duke/src/vmexports.cpp b/source/games/duke/src/vmexports.cpp index a33cffb57..505094fb4 100644 --- a/source/games/duke/src/vmexports.cpp +++ b/source/games/duke/src/vmexports.cpp @@ -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; diff --git a/wadsrc/static/zscript/games/duke/actors/commander.zs b/wadsrc/static/zscript/games/duke/actors/commander.zs index 6efeaf2c6..754944f87 100644 --- a/wadsrc/static/zscript/games/duke/actors/commander.zs +++ b/wadsrc/static/zscript/games/duke/actors/commander.zs @@ -7,6 +7,8 @@ class DukeCommander : DukeActor +KILLCOUNT; +NOWATERDIP; +FLOATING; + gutsoffset -24; + falladjustz 0; } override void PlayFTASound() diff --git a/wadsrc/static/zscript/games/duke/actors/emptybike.zs b/wadsrc/static/zscript/games/duke/actors/emptybike.zs index f05723e16..250c3a49c 100644 --- a/wadsrc/static/zscript/games/duke/actors/emptybike.zs +++ b/wadsrc/static/zscript/games/duke/actors/emptybike.zs @@ -54,6 +54,7 @@ class RedneckEmptyBoat : DukeActor { pic "EMPTYBOAT"; +ALWAYSROTATE2; + falladjustz 6; } override void Initialize() diff --git a/wadsrc/static/zscript/games/duke/actors/jibs.zs b/wadsrc/static/zscript/games/duke/actors/jibs.zs index 130e35617..c456dbb50 100644 --- a/wadsrc/static/zscript/games/duke/actors/jibs.zs +++ b/wadsrc/static/zscript/games/duke/actors/jibs.zs @@ -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; diff --git a/wadsrc/static/zscript/games/duke/actors/mech.zs b/wadsrc/static/zscript/games/duke/actors/mech.zs index 8926434e8..cbd00dbba 100644 --- a/wadsrc/static/zscript/games/duke/actors/mech.zs +++ b/wadsrc/static/zscript/games/duke/actors/mech.zs @@ -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() diff --git a/wadsrc/static/zscript/games/duke/actors/octabrain.zs b/wadsrc/static/zscript/games/duke/actors/octabrain.zs index f8eb250b1..d307ef6d4 100644 --- a/wadsrc/static/zscript/games/duke/actors/octabrain.zs +++ b/wadsrc/static/zscript/games/duke/actors/octabrain.zs @@ -6,6 +6,7 @@ class DukeOctabrain : DukeActor +INTERNAL_BADGUY; +KILLCOUNT; +NOWATERDIP; + falladjustz 0; } override void PlayFTASound() diff --git a/wadsrc/static/zscript/games/duke/actors/projectiles.zs b/wadsrc/static/zscript/games/duke/actors/projectiles.zs index 8cf290ba1..56a3d0b3a 100644 --- a/wadsrc/static/zscript/games/duke/actors/projectiles.zs +++ b/wadsrc/static/zscript/games/duke/actors/projectiles.zs @@ -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; diff --git a/wadsrc/static/zscript/games/duke/actors/redneckenemies.zs b/wadsrc/static/zscript/games/duke/actors/redneckenemies.zs index 3a778c60b..86606c0d3 100644 --- a/wadsrc/static/zscript/games/duke/actors/redneckenemies.zs +++ b/wadsrc/static/zscript/games/duke/actors/redneckenemies.zs @@ -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() { diff --git a/wadsrc/static/zscript/games/duke/dukeactor.zs b/wadsrc/static/zscript/games/duke/dukeactor.zs index 5bccae2cd..ab64764dc 100644 --- a/wadsrc/static/zscript/games/duke/dukeactor.zs +++ b/wadsrc/static/zscript/games/duke/dukeactor.zs @@ -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 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 spawnclass);