diff --git a/source/core/namedef_custom.h b/source/core/namedef_custom.h index 542d4374a..fd74e62eb 100644 --- a/source/core/namedef_custom.h +++ b/source/core/namedef_custom.h @@ -47,6 +47,7 @@ xx(DukePaper) xx(RedneckFeather) xx(DukeSteamBase) xx(RedneckFire) +xx(DukePlayerOnWater) xx(spawnstate) xx(brokenstate) diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index b6e8f3f1e..6ac400fc5 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -277,28 +277,6 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi case DTILE_CHAINGUN: t->shade = -127; break; - case DTILE_PLAYERONWATER: - if (hw_models && modelManager.CheckModel(h->spr.picnum, h->spr.pal)) - { - k = 0; - t->cstat &= ~CSTAT_SPRITE_XFLIP; - } - else - { - k = angletorotation1(t->Angles.Yaw, viewang); - if (k > 4) - { - k = 8 - k; - t->cstat |= CSTAT_SPRITE_XFLIP; - } - else t->cstat &= ~CSTAT_SPRITE_XFLIP; - } - - t->picnum = h->spr.picnum + k + ((h->temp_data[0] < 4) * 5); - if (OwnerAc) t->shade = OwnerAc->spr.shade; - - break; - } h->dispicnum = t->picnum; diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index 716a06ecd..f11ef117e 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -354,19 +354,6 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi t->shade = -127; t->picnum = RTILE_RRTILE2944 + ((PlayClock >> 2) & 4); break; - case RTILE_PLAYERONWATER: - - k = angletorotation1(t->Angles.Yaw, viewang); - if (k > 4) - { - k = 8 - k; - t->cstat |= CSTAT_SPRITE_XFLIP; - } - else t->cstat &= ~CSTAT_SPRITE_XFLIP; - - t->picnum = h->spr.picnum + k + ((h->temp_data[0] < 4) * 5); - if (OwnerAc) t->shade = OwnerAc->spr.shade; - break; } h->dispicnum = t->picnum; diff --git a/source/games/duke/src/flags_d.cpp b/source/games/duke/src/flags_d.cpp index 968268c35..7b795d2e5 100644 --- a/source/games/duke/src/flags_d.cpp +++ b/source/games/duke/src/flags_d.cpp @@ -160,7 +160,7 @@ void initactorflags_d() setflag(SFLAG2_DONTANIMATE, { DTILE_TRIPBOMB, DTILE_LASERLINE }); //setflag(SFLAG2_INTERPOLATEANGLE, { DTILE_BEARINGPLATE }); setflag(SFLAG2_GREENBLOOD, { DTILE_OOZFILTER, DTILE_NEWBEAST, DTILE_NUKEBARREL }); - setflag(SFLAG2_ALWAYSROTATE1, { DTILE_RAT, DTILE_CAMERA1, DTILE_CHAIR3 }); + setflag(SFLAG2_ALWAYSROTATE1, { DTILE_RAT, DTILE_CAMERA1, DTILE_CHAIR3, DTILE_PLAYERONWATER }); setflag(SFLAG2_ALWAYSROTATE2, { DTILE_RPG }); setflag(SFLAG2_DIENOW, { DTILE_RADIUSEXPLOSION, DTILE_KNEE }); setflag(SFLAG2_TRANFERPALTOJIBS, { DTILE_LIZTROOP }); diff --git a/source/games/duke/src/flags_r.cpp b/source/games/duke/src/flags_r.cpp index b04fdddd5..13e709626 100644 --- a/source/games/duke/src/flags_r.cpp +++ b/source/games/duke/src/flags_r.cpp @@ -177,7 +177,7 @@ void initactorflags_r() if (isRRRA()) setflag(SFLAG2_BREAKMIRRORS, { RTILE_RPG2 }); setflag(SFLAG2_CAMERA, { RTILE_CAMERA1 }); setflag(SFLAG2_GREENBLOOD, { RTILE_OOZFILTER }); - setflag(SFLAG2_ALWAYSROTATE1, { RTILE_RAT, RTILE_CAMERA1, RTILE_CHAIR3 }); + setflag(SFLAG2_ALWAYSROTATE1, { RTILE_RAT, RTILE_CAMERA1, RTILE_CHAIR3, RTILE_PLAYERONWATER }); setflag(SFLAG2_ALWAYSROTATE2, { RTILE_RPG }); setflag(SFLAG2_DIENOW, { RTILE_RADIUSEXPLOSION }); setflag(SFLAG2_NORADIUSPUSH, { RTILE_HULK }); diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index aa11d8412..f753046a1 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -1630,7 +1630,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo if (p->on_ground == 1) { if (p->dummyplayersprite == nullptr) - p->dummyplayersprite = spawn(pact, DTILE_PLAYERONWATER); + p->dummyplayersprite = spawn(pact, PClass::FindActor(NAME_DukePlayerOnWater)); p->footprintcount = 6; if (tilesurface(p->cursector->floortexture) == TSURF_SLIME) diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 41f597bca..6d84feb33 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -1898,7 +1898,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo if (p->on_ground == 1) { if (p->dummyplayersprite == nullptr) - p->dummyplayersprite = spawn(pact, RTILE_PLAYERONWATER); + p->dummyplayersprite = spawn(pact, PClass::FindActor(NAME_DukePlayerOnWater)); p->footprintcount = 6; if (tilesurface(p->cursector->floortexture) == TSURF_SLIME) diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 03c82ca71..d21db2029 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -281,7 +281,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) } - if (targ->spr.picnum == DTILE_PLAYERONWATER) + if (targ->IsKindOf(NAME_DukePlayerOnWater)) { targ = targ->GetOwner(); if (!targ) return; diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index a5b13b765..d69b6606e 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -256,7 +256,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) break; } - if (targ->spr.picnum == RTILE_PLAYERONWATER) + if (targ->IsKindOf(NAME_DukePlayerOnWater)) { targ = targ->GetOwner(); if (!targ) return; diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp index 962744fa2..a243b5910 100644 --- a/source/games/duke/src/spawn_d.cpp +++ b/source/games/duke/src/spawn_d.cpp @@ -72,17 +72,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* if (!badguy(act) || commonEnemySetup(act, actj)) CallInitialize(act); break; - case DTILE_PLAYERONWATER: - if (actj) - { - act->spr.scale = actj->spr.scale; - act->vel.Z = 0.5; - if (act->sector()->lotag != 2) - act->spr.cstat |= CSTAT_SPRITE_INVISIBLE; - } - ChangeActorStat(act, STAT_DUMMYPLAYER); - break; - case DTILE_APLAYER: { act->spr.scale = DVector2(0, 0); diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index 70efad0de..18705966e 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -111,17 +111,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray* break; - case RTILE_PLAYERONWATER: - if (actj) - { - act->spr.scale = actj->spr.scale; - act->vel.Z = 0.5; - if (act->sector()->lotag != 2) - act->spr.cstat |= CSTAT_SPRITE_INVISIBLE; - } - ChangeActorStat(act, STAT_DUMMYPLAYER); - break; - case RTILE_APLAYER: { act->spr.scale = DVector2(0, 0); diff --git a/wadsrc/static/filter/dukelike/rmapinfo.spawnclasses b/wadsrc/static/filter/dukelike/rmapinfo.spawnclasses index a473dcbd1..71d6fbc7c 100644 --- a/wadsrc/static/filter/dukelike/rmapinfo.spawnclasses +++ b/wadsrc/static/filter/dukelike/rmapinfo.spawnclasses @@ -253,6 +253,7 @@ spawnclasses 3400 = DukeBlimp 762 = DukeMike 1518 = DukePlayerLyingDead + 1420 = DukePlayerOnWater 46 = DukeCrystalAmmo 55 = DukeSteroids diff --git a/wadsrc/static/filter/redneck/rmapinfo.spawnclasses b/wadsrc/static/filter/redneck/rmapinfo.spawnclasses index a079987d0..81530acfb 100644 --- a/wadsrc/static/filter/redneck/rmapinfo.spawnclasses +++ b/wadsrc/static/filter/redneck/rmapinfo.spawnclasses @@ -290,6 +290,7 @@ spawnclasses 241 = DukeWaterBubbleMaker 1391 = RedneckBlood 3998 = RedneckPlayerLyingDead + 3860 = DukePlayerOnWater 4861 = RedneckHen diff --git a/wadsrc/static/zscript/games/duke/actors/player.zs b/wadsrc/static/zscript/games/duke/actors/player.zs index 995dd2210..24e2e4008 100644 --- a/wadsrc/static/zscript/games/duke/actors/player.zs +++ b/wadsrc/static/zscript/games/duke/actors/player.zs @@ -1,3 +1,22 @@ +class DukePlayerOnWater : DukeActor +{ + default + { + pic "PLAYERONWATER"; + } + + override void Initialize() + { + if (!mapSpawned && self.ownerActor) + { + self.scale = self.ownerActor.scale; + self.vel.Z = 0.5; + if (self.sector.lotag != ST_2_UNDERWATER) + self.cstat |= CSTAT_SPRITE_INVISIBLE; + } + self.ChangeStat(STAT_DUMMYPLAYER); + } +} class DukePlayerLyingDead : DukeActor {