diff --git a/source/core/namedef_custom.h b/source/core/namedef_custom.h index 5c8e6bc60..9f08698d4 100644 --- a/source/core/namedef_custom.h +++ b/source/core/namedef_custom.h @@ -22,4 +22,10 @@ xx(aimoffset) xx(strength) xx(autoaimangle) xx(shootzoffset) -xx(moveclipdist) \ No newline at end of file +xx(moveclipdist) +xx(jumptoplayer_factor) +xx(justjump1_factor) +xx(justjump2_factor) +xx(windang_factor) +xx(floating_floordist) +xx(floating_ceilingdist) diff --git a/source/core/thingdef_data.cpp b/source/core/thingdef_data.cpp index b4bc98753..acd4f952a 100644 --- a/source/core/thingdef_data.cpp +++ b/source/core/thingdef_data.cpp @@ -191,6 +191,8 @@ static FFlagDef DukeActorFlagDefs[] = DEFINE_FLAG(SFLAG3, QUICKALTERANG, DDukeActor, flags3), DEFINE_FLAG(SFLAG3, SPAWNWEAPONDEBRIS, DDukeActor, flags3), DEFINE_FLAG(SFLAG3, NOJIBS, DDukeActor, flags3), + DEFINE_FLAG(SFLAG3, NOVERTICALMOVE, DDukeActor, flags3), + DEFINE_FLAG(SFLAG3, MOVE_NOPLAYERINTERACT, DDukeActor, flags3), }; diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 6a8325b15..bf16230a8 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -944,51 +944,30 @@ void move_d(DDukeActor *actor, int playernum, int xvel) if (actor->vel.X != 0 || actor->vel.Z != 0) { - if (a && actor->spr.picnum != DTILE_ROTATEGUN) + if (a && !(actor->flags3 & SFLAG3_NOVERTICALMOVE)) { - if ((actor->spr.picnum == DTILE_DRONE || actor->spr.picnum == DTILE_COMMANDER) && actor->spr.extra > 0) + if ((actor->flags2 & SFLAG2_FLOATING) && actor->spr.extra > 0) { - if (actor->spr.picnum == DTILE_COMMANDER) + double fdist = actor->FloatVar(NAME_floating_floordist); + double cdist = actor->FloatVar(NAME_floating_ceilingdist); + double c, f; + calcSlope(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, &c, &f); + actor->floorz = f; + actor->ceilingz = c; + + if (actor->spr.pos.Z > f - fdist) { - double c, f; - calcSlope(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, &c, &f); - actor->floorz = f; - actor->ceilingz = c; - - if (actor->spr.pos.Z > f - 8) - { - actor->spr.pos.Z = f - 8; - actor->vel.Z = 0; - } - - if (actor->spr.pos.Z < c + 80) - { - actor->spr.pos.Z = c + 80; - actor->vel.Z = 0; - } + actor->spr.pos.Z = f - fdist; + actor->vel.Z = 0; } - else + + if (actor->spr.pos.Z < c + cdist) { - if (actor->vel.Z > 0) - { - double f = getflorzofslopeptr(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y); - actor->floorz = f; - if (actor->spr.pos.Z > f - 30) - actor->spr.pos.Z = f - 30; - } - else - { - double c = getceilzofslopeptr(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y); - actor->ceilingz = c; - if (actor->spr.pos.Z < c + 50) - { - actor->spr.pos.Z = c + 50; - actor->vel.Z = 0; - } - } + actor->spr.pos.Z = c + cdist; + actor->vel.Z = 0; } } - else if (actor->spr.picnum != DTILE_ORGANTIC) + else { if (actor->vel.Z > 0 && actor->floorz < actor->spr.pos.Z) actor->spr.pos.Z = actor->floorz; @@ -1007,7 +986,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel) daxvel = actor->vel.X; angdif = actor->spr.Angles.Yaw; - if (a && actor->spr.picnum != DTILE_ROTATEGUN) + if (a && !(actor->flags3 & SFLAG3_MOVE_NOPLAYERINTERACT)) { if (xvel < 960 && actor->spr.scale.X > 0.25 ) { diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 294311a8c..3e83b3e82 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -1035,66 +1035,35 @@ void move_r(DDukeActor *actor, int pnum, int xvel) actor->spr.Angles.Yaw += angdif; } - if (isRRRA()) + if (a & antifaceplayerslow) { - if (a & antifaceplayerslow) - { - if (ps[pnum].newOwner != nullptr) - goalang = ((ps[pnum].GetActor()->opos.XY() - actor->spr.pos.XY()).Angle() + DAngle180); - else goalang = ((ps[pnum].GetActor()->spr.pos.XY() - actor->spr.pos.XY()).Angle() + DAngle180); - angdif = DAngle22_5 * 0.25 * Sgn(deltaangle(actor->spr.Angles.Yaw, goalang).Degrees()); // this looks very wrong... - actor->spr.Angles.Yaw += angdif; - } - - if ((a & jumptoplayer) == jumptoplayer) - { - if (actor->spr.picnum == RTILE_CHEER) - { - if (actor->counter < 16) - actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * 1.6; - } - else - { - if (actor->counter < 16) - actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * 2; - } - } - if (a & justjump1) - { - if (actor->spr.picnum == RTILE_RABBIT) - { - if (actor->counter < 8) - actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * 2.133; - } - else if (actor->spr.picnum == RTILE_MAMA) - { - if (actor->counter < 8) - actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * 1.83; - } - } - if (a & justjump2) - { - if (actor->spr.picnum == RTILE_RABBIT) - { - if (actor->counter < 8) - actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * 2.667; - } - else if (actor->spr.picnum == RTILE_MAMA) - { - if (actor->counter < 8) - actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * 2.286; - } - } - if (a & windang) - { - if (actor->counter < 8) - actor->vel.Z -= BobVal(512 + (actor->counter << 4) * 2.667); - } + if (ps[pnum].newOwner != nullptr) + goalang = ((ps[pnum].GetActor()->opos.XY() - actor->spr.pos.XY()).Angle() + DAngle180); + else goalang = ((ps[pnum].GetActor()->spr.pos.XY() - actor->spr.pos.XY()).Angle() + DAngle180); + angdif = DAngle22_5 * 0.25 * Sgn(deltaangle(actor->spr.Angles.Yaw, goalang).Degrees()); // this looks very wrong... + actor->spr.Angles.Yaw += angdif; } - else if ((a & jumptoplayer) == jumptoplayer) + + if ((a & jumptoplayer) == jumptoplayer) { if (actor->counter < 16) - actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * 2; + actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * actor->FloatVar(NAME_jumptoplayer_factor); + } + if (a & justjump1) + { + if (actor->counter < 8) + actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * actor->FloatVar(NAME_justjump1_factor); + } + if (a & justjump2) + { + if (actor->counter < 8) + actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * actor->FloatVar(NAME_justjump2_factor); + } + if (a & windang) + { + if (actor->counter < 8) + actor->vel.Z -= BobVal(512 + (actor->counter << 4)) * actor->FloatVar(NAME_windang_factor); + actor->vel.Z -= BobVal(512 + (actor->counter << 4) * 2.667); } @@ -1152,36 +1121,39 @@ void move_r(DDukeActor *actor, int pnum, int xvel) { if (a) { - if (actor->spr.picnum == RTILE_DRONE && actor->spr.extra > 0) + if ((actor->flags2 & SFLAG2_FLOATING) && actor->spr.extra > 0) { - if (actor->vel.Z > 0) + double fdist = actor->FloatVar(NAME_floating_floordist); + double cdist = actor->FloatVar(NAME_floating_ceilingdist); + double c, f; + calcSlope(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, &c, &f); + actor->floorz = f; + actor->ceilingz = c; + + if (actor->spr.pos.Z > f - fdist) { - double dist = isRRRA() ? 28 : 30; - double f = getflorzofslopeptr(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y); - actor->floorz = f; - if (actor->spr.pos.Z > f - dist) - actor->spr.pos.Z = f - dist; + actor->spr.pos.Z = f - fdist; + actor->vel.Z = 0; } - else + + if (actor->spr.pos.Z < c + cdist) { - double c = getceilzofslopeptr(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y); - actor->ceilingz = c; - if (actor->spr.pos.Z < c + 50) - { - actor->spr.pos.Z = c + 50; - actor->vel.Z = 0; - } + actor->spr.pos.Z = c + cdist; + actor->vel.Z = 0; } } - if (actor->vel.Z > 0 && actor->floorz < actor->spr.pos.Z) - actor->spr.pos.Z = actor->floorz; - if (actor->vel.Z < 0) + else { - double c = getceilzofslopeptr(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y); - if (actor->spr.pos.Z < c + 66) + if (actor->vel.Z > 0 && actor->floorz < actor->spr.pos.Z) + actor->spr.pos.Z = actor->floorz; + if (actor->vel.Z < 0) { - actor->spr.pos.Z = c + 66; - actor->vel.Z *= 0.5; + double c = getceilzofslopeptr(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y); + if (actor->spr.pos.Z < c + 66) + { + actor->spr.pos.Z = c + 66; + actor->vel.Z *= 0.5; + } } } } diff --git a/source/games/duke/src/constants.h b/source/games/duke/src/constants.h index 73bf76042..896d3fe95 100644 --- a/source/games/duke/src/constants.h +++ b/source/games/duke/src/constants.h @@ -424,6 +424,8 @@ enum sflags3_t SFLAG3_QUICKALTERANG = 0x00400000, SFLAG3_SPAWNWEAPONDEBRIS = 0x00800000, SFLAG3_NOJIBS = 0x01000000, + SFLAG3_NOVERTICALMOVE = 0x02000000, + SFLAG3_MOVE_NOPLAYERINTERACT = 0x04000000, }; diff --git a/wadsrc/static/zscript/games/duke/actors/commander.zs b/wadsrc/static/zscript/games/duke/actors/commander.zs index 3a26fa43c..7eb8ff55f 100644 --- a/wadsrc/static/zscript/games/duke/actors/commander.zs +++ b/wadsrc/static/zscript/games/duke/actors/commander.zs @@ -11,6 +11,8 @@ class DukeCommander : DukeActor +NORANDOMANGLEWHENBLOCKED; gutsoffset -24; falladjustz 0; + floating_floordist 8; + floating_ceilingdist 80; } override void PlayFTASound() diff --git a/wadsrc/static/zscript/games/duke/actors/mech.zs b/wadsrc/static/zscript/games/duke/actors/mech.zs index f5f27ee74..c09ca8c24 100644 --- a/wadsrc/static/zscript/games/duke/actors/mech.zs +++ b/wadsrc/static/zscript/games/duke/actors/mech.zs @@ -10,6 +10,8 @@ class DukeDrone : DukeActor +QUICKALTERANG; +NOJIBS; falladjustz 0; + floating_floordist 30; + floating_ceilingdist 50; } override void PlayFTASound() @@ -25,6 +27,7 @@ class DukeTurret : DukeActor pic "ORGANTIC"; +INTERNAL_BADGUY; +KILLCOUNT; + +NOVERTICALMOVE; aimoffset 32; } @@ -49,6 +52,8 @@ class DukeRotateGun : DukeActor +NODAMAGEPUSH; +NORADIUSPUSH; +SHOOTCENTERED; + +NOVERTICALMOVE; + +MOVE_NOPLAYERINTERACT; sparkoffset -8; aimoffset 32; shootzoffset 0; diff --git a/wadsrc/static/zscript/games/duke/actors/redneckenemies.zs b/wadsrc/static/zscript/games/duke/actors/redneckenemies.zs index 02aaee08d..1575b7e8a 100644 --- a/wadsrc/static/zscript/games/duke/actors/redneckenemies.zs +++ b/wadsrc/static/zscript/games/duke/actors/redneckenemies.zs @@ -88,6 +88,7 @@ class RedneckCheerleader : DukeActor +KILLCOUNT; +LOOKALLAROUND; +ALTPROJECTILESPRITE; // owed to CON's shittiness. Todo: Think of something better. + jumptoplayer_factor 1.6; } override void Initialize() { @@ -233,6 +234,8 @@ class RedneckMama : DukeActor +LOOKALLAROUND; +NORADIUSPUSH; +SPAWNRABBITGUTS; // owed to CON's shittiness. Todo: Think of something better. + justjump1_factor 1.83; + justjump2_factor 2.286; } override void Initialize() @@ -284,6 +287,7 @@ class RedneckCheerStayput : RedneckCheerleader default { pic "CHEERSTAYPUT"; + jumptoplayer_factor 2.0; } override void initialize() @@ -443,6 +447,8 @@ class RedneckMosquito : DukeActor +QUICKALTERANG; +NOJIBS; falladjustz 0; + floating_floordist 30; + floating_ceilingdist 50; } override void Initialize() { diff --git a/wadsrc/static/zscript/games/duke/dukeactor.zs b/wadsrc/static/zscript/games/duke/dukeactor.zs index 348bd8894..b63688d07 100644 --- a/wadsrc/static/zscript/games/duke/dukeactor.zs +++ b/wadsrc/static/zscript/games/duke/dukeactor.zs @@ -116,6 +116,12 @@ class DukeActor : CoreActor native falladjustz 24; autoaimangle 8.4375; projectilespread 5.625; + jumptoplayer_factor 2.0; + justjump1_factor 2.133; + justjump2_factor 2.667; + windang_factor 2.667; + floating_floordist 0; + floating_ceilingdist 66; } enum EStatnums { @@ -242,6 +248,12 @@ class DukeActor : CoreActor native meta double projectilespread; meta double shootzoffset; meta double moveclipdist; + meta double jumptoplayer_factor; + meta double justjump1_factor; + meta double justjump2_factor; + meta double windang_factor; + meta double floating_floordist; + meta double floating_ceilingdist; property prefix: none; property gutsoffset: gutsoffset; @@ -253,6 +265,12 @@ class DukeActor : CoreActor native property projectilespread: projectilespread; property shootzoffset: shootzoffset; property moveclipdist: moveclipdist; + property jumptoplayer_factor: jumptoplayer_factor; + property justjump1_factor: justjump1_factor; + property justjump2_factor: justjump2_factor; + property windang_factor: windang_factor; + property floating_floordist: floating_floordist; + property floating_ceilingdist: floating_ceilingdist; native void SetSpritesetImage(int index); native int GetSpritesetSize();