diff --git a/source/games/sw/src/break.cpp b/source/games/sw/src/break.cpp index ccd0401b6..7a51ac59b 100644 --- a/source/games/sw/src/break.cpp +++ b/source/games/sw/src/break.cpp @@ -530,7 +530,7 @@ BREAK_INFO* SetupSpriteForBreak(DSWActor* actor) else actor->spr.extra |= (SPRX_BREAKABLE); - actor->spr.clipdist = ActorSizeX(actor); + SetActorSizeX(actor); actor->spr.cstat |= (CSTAT_SPRITE_BREAKABLE); } diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 3d8d11d71..a032186a0 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -2051,9 +2051,9 @@ inline double ActorSizeToTop(DSWActor* a) return (ActorSizeZ(a) + tileTopOffset(a->spr.picnum)) * 0.5; } -inline int ActorSizeX(DSWActor* sp) +inline void SetActorSizeX(DSWActor* sp) { - return MulScale(tileWidth(sp->spr.picnum), sp->spr.xrepeat, 6); + sp->spr.clipdist = MulScale(tileWidth(sp->spr.picnum), sp->spr.xrepeat, 6); } inline bool Facing(DSWActor* actor1, DSWActor* actor2) diff --git a/source/games/sw/src/ninja.cpp b/source/games/sw/src/ninja.cpp index 3549aa77a..69493c51f 100644 --- a/source/games/sw/src/ninja.cpp +++ b/source/games/sw/src/ninja.cpp @@ -2486,7 +2486,7 @@ void SpawnPlayerUnderSprite(PLAYER* pp) actor->user.ActorActionSet = plActor->user.ActorActionSet; actor->spr.picnum = plActor->spr.picnum; - actor->spr.clipdist = plActor->spr.clipdist; + actor->copy_clipdist(plActor); actor->spr.xrepeat = plActor->spr.xrepeat; actor->spr.yrepeat = plActor->spr.yrepeat; } diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 1f0ff088b..208b4e17c 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -1682,7 +1682,7 @@ void SpriteSetup(void) case BREAKABLE: // need something that tells missiles to hit them // but allows actors to move through them - actor->spr.clipdist = ActorSizeX(actor); + SetActorSizeX(actor); actor->spr.extra |= (SPRX_BREAKABLE); actor->spr.cstat |= (CSTAT_SPRITE_BREAKABLE); break; @@ -3466,7 +3466,7 @@ NUKE_REPLACEMENT: SpawnUser(actor, actor->spr.picnum, nullptr); - actor->spr.clipdist = ActorSizeX(actor); + SetActorSizeX(actor); actor->spr.cstat |= (CSTAT_SPRITE_BREAKABLE); actor->spr.extra |= (SPRX_BREAKABLE); break; diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index f96036bdb..0e3741c7e 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -17016,7 +17016,7 @@ int InitEnemyMine(DSWActor* actor) int HelpMissileLateral(DSWActor* actor, int dist) { auto old_xvel = actor->vel.X; - auto old_clipdist = actor->spr.clipdist; + SAVE_CLIP; actor->vel.X = dist * maptoworld; // not worth changing 28 call locations... @@ -17027,7 +17027,7 @@ int HelpMissileLateral(DSWActor* actor, int dist) actor->user.coll = move_missile(actor, DVector3(vec, 0), 16, 16, 0, 1); actor->vel.X = old_xvel; - actor->spr.clipdist = old_clipdist; + RESTORE_CLIP; actor->backuppos(); return 0; @@ -18698,7 +18698,7 @@ int ShrapKillSprite(DSWActor* actor) break; case GORE_Lung: if (RandomRange(1000) > 500) break; - actor->spr.clipdist = ActorSizeX(actor); + SetActorSizeX(actor); SpawnFloorSplash(actor); if (RandomRange(1000) < 500) PlaySound(DIGI_GIBS1, actor, v3df_none); @@ -18720,7 +18720,7 @@ int ShrapKillSprite(DSWActor* actor) break; case GORE_Liver: if (RandomRange(1000) > 500) break; - actor->spr.clipdist = ActorSizeX(actor); + SetActorSizeX(actor); SpawnFloorSplash(actor); if (RandomRange(1000) < 500) PlaySound(DIGI_GIBS1, actor, v3df_none); @@ -18742,7 +18742,7 @@ int ShrapKillSprite(DSWActor* actor) break; case GORE_SkullCap: if (RandomRange(1000) > 500) break; - actor->spr.clipdist = ActorSizeX(actor); + SetActorSizeX(actor); SpawnFloorSplash(actor); if (rnd_num > 683) { @@ -18760,7 +18760,7 @@ int ShrapKillSprite(DSWActor* actor) break; case GORE_Head: if (RandomRange(1000) > 500) break; - actor->spr.clipdist = ActorSizeX(actor); + SetActorSizeX(actor); QueueFloorBlood(actor); QueueGeneric(actor,GORE_Head); return 0;