From 3fc592c50585a7562391a7bc6f7cba9fbcea16d4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 9 Sep 2022 18:22:20 +0200 Subject: [PATCH] - wrap clipdist copy --- source/core/coreactor.h | 5 +++++ source/games/duke/src/gameexec.cpp | 2 +- source/games/exhumed/src/move.cpp | 2 +- source/games/sw/src/jweapon.cpp | 8 ++++---- source/games/sw/src/weapon.cpp | 12 ++++++------ 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/source/core/coreactor.h b/source/core/coreactor.h index be0633b24..49f45ce33 100644 --- a/source/core/coreactor.h +++ b/source/core/coreactor.h @@ -280,6 +280,11 @@ public: { spr. clipdist = val; } + + void copy_clipdist(DCoreActor* other) + { + spr. clipdist = other->spr. clipdist; + } }; diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 2d3893ee7..6db6b7c7f 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -2190,7 +2190,7 @@ int ParseState::parse(void) break; case concmd_clipdist: insptr++; - g_ac->spr.clipdist = (uint8_t) *insptr; + g_ac->spr.clipdist = (uint8_t) *insptr; insptr++; break; case concmd_cstat: diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index 5e7e7266f..6475d5107 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -812,7 +812,7 @@ void CreatePushBlock(sectortype* pSector) sBlockInfo[nBlock].field_8 = mindist * worldtoint; - pActor->spr.clipdist = (int(mindist * worldtoint) & 0xFF) << 2; + pActor->spr.clipdist = (int(mindist * worldtoint) & 0xFF) << 2; pSector->extra = nBlock; } diff --git a/source/games/sw/src/jweapon.cpp b/source/games/sw/src/jweapon.cpp index f449efd39..10e70591a 100644 --- a/source/games/sw/src/jweapon.cpp +++ b/source/games/sw/src/jweapon.cpp @@ -1190,7 +1190,7 @@ int SpawnRadiationCloud(DSWActor* actor) actorNew->spr.shade = -40; actorNew->spr.xrepeat = 32; actorNew->spr.yrepeat = 32; - actorNew->spr.clipdist = actor->spr.clipdist; + actorNew->copy_clipdist(actor); actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER); actorNew->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); actorNew->user.spal = actorNew->spr.pal = PALETTE_PLAYER6; @@ -1695,7 +1695,7 @@ int InitCaltrops(DSWActor* actor) actorNew->spr.xrepeat = 64; actorNew->spr.shade = -15; // !FRANK - clipbox must be <= weapon otherwise can clip thru walls - actorNew->spr.clipdist = actor->spr.clipdist; + actorNew->copy_clipdist(actor); actorNew->user.WeaponNum = actor->user.WeaponNum; actorNew->user.Radius = 200; actorNew->user.ceiling_dist = 3; @@ -1738,7 +1738,7 @@ int InitPhosphorus(DSWActor* actor) if (actor->spr.clipdist > 0) actorNew->spr.clipdist = actor->spr.clipdist-1; else - actorNew->spr.clipdist = actor->spr.clipdist; + actorNew->copy_clipdist(actor); actorNew->user.WeaponNum = actor->user.WeaponNum; actorNew->user.Radius = 600; actorNew->user.ceiling_dist = 3; @@ -1808,7 +1808,7 @@ int InitBloodSpray(DSWActor* actor, bool dogib, short velocity) actorNew->spr.yrepeat = 64-RandomRange(35); actorNew->spr.xrepeat = 64-RandomRange(35); actorNew->spr.shade = -15; - actorNew->spr.clipdist = actor->spr.clipdist; + actorNew->copy_clipdist(actor); actorNew->user.WeaponNum = actor->user.WeaponNum; actorNew->user.Radius = 600; actorNew->user.ceiling_dist = 3; diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 4f93eb6f3..ccf086489 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -9663,7 +9663,7 @@ int SpawnExtraMicroMini(DSWActor* actor) SetOwner(GetOwner(actor), actorNew); actorNew->spr.yrepeat = actorNew->spr.xrepeat = actor->spr.xrepeat; actorNew->spr.shade = actor->spr.shade; - actorNew->spr.clipdist = actor->spr.clipdist; + actorNew->copy_clipdist(actor); actorNew->user.RotNum = 5; NewStateGroup(actorNew, &sg_MicroMini[0]); @@ -10352,7 +10352,7 @@ void SpawnNuclearSecondaryExp(DSWActor* actor, DAngle ang) expActor->spr.shade = -128; expActor->spr.xrepeat = 218; expActor->spr.yrepeat = 152; - expActor->spr.clipdist = actor->spr.clipdist; + expActor->copy_clipdist(actor); expActor->user.ceiling_dist = (16); expActor->user.floor_dist = (16); expActor->spr.cstat |= (CSTAT_SPRITE_YCENTER); @@ -10415,7 +10415,7 @@ void SpawnNuclearExp(DSWActor* actor) expActor->spr.shade = -128; expActor->spr.xrepeat = 255; expActor->spr.yrepeat = 255; - expActor->spr.clipdist = actor->spr.clipdist; + expActor->copy_clipdist(actor); expActor->spr.cstat |= (CSTAT_SPRITE_YCENTER); expActor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); expActor->user.spal = expActor->spr.pal = PALETTE_PLAYER1; // Set nuke puff to gray @@ -10646,7 +10646,7 @@ void SpawnGrenadeSecondaryExp(DSWActor* actor, DAngle ang) expActor->spr.shade = -40; expActor->spr.xrepeat = 32; expActor->spr.yrepeat = 32; - expActor->spr.clipdist = actor->spr.clipdist; + expActor->copy_clipdist(actor); expActor->user.ceiling_dist = (16); expActor->user.floor_dist = (16); expActor->spr.cstat |= (CSTAT_SPRITE_YCENTER); @@ -10721,7 +10721,7 @@ void SpawnGrenadeExp(DSWActor* actor) expActor->spr.shade = -40; expActor->spr.xrepeat = 64 + 32; expActor->spr.yrepeat = 64 + 32; - expActor->spr.clipdist = actor->spr.clipdist; + expActor->copy_clipdist(actor); expActor->spr.cstat |= (CSTAT_SPRITE_YCENTER); expActor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); expActor->user.Radius = DamageData[DMG_GRENADE_EXP].radius; @@ -13107,7 +13107,7 @@ int InitStar(PLAYER* pp) actorNew2->spr.shade = actorNew->spr.shade; actorNew2->spr.extra = actorNew->spr.extra; - actorNew2->spr.clipdist = actorNew->spr.clipdist; + actorNew2->copy_clipdist(actorNew); actorNew2->user.WeaponNum = actorNew->user.WeaponNum; actorNew2->user.Radius = actorNew->user.Radius; actorNew2->user.ceiling_dist = actorNew->user.ceiling_dist;