From 36fc6ede8eda1db2d443bba8050b4b9ac34b82b7 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Fri, 24 Dec 2021 18:25:27 +1100 Subject: [PATCH] - Blood: Repair `actor` variable collision in `GetZRange()` causing all kinds of weirdness. --- source/games/blood/src/gameutil.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/source/games/blood/src/gameutil.cpp b/source/games/blood/src/gameutil.cpp index efafa78bb..d484a6f63 100644 --- a/source/games/blood/src/gameutil.cpp +++ b/source/games/blood/src/gameutil.cpp @@ -569,13 +569,13 @@ void GetZRange(DBloodActor *actor, int *ceilZ, Collision *ceilColl, int *floorZ, XSECTOR *pXSector = &pSector->xs(); *floorZ += pXSector->Depth << 10; } - auto actor = barrier_cast(pSector->upperLink); - if (actor) + auto linkActor = barrier_cast(pSector->upperLink); + if (linkActor) { - auto link = actor->GetOwner(); - vec3_t lpos = actor->spr.pos + link->spr.pos - actor->spr.pos; - getzrange(lpos, link->spr.sector(), &nTemp1, scratch, (int32_t*)floorZ, *floorColl, nDist, nMask); - *floorZ -= link->spr.pos.Z - actor->spr.pos.Z; + auto linkOwner = linkActor->GetOwner(); + vec3_t lpos = actor->spr.pos + linkOwner->spr.pos - linkActor->spr.pos; + getzrange(lpos, linkOwner->spr.sector(), &nTemp1, scratch, (int32_t*)floorZ, *floorColl, nDist, nMask); + *floorZ -= linkOwner->spr.pos.Z - linkActor->spr.pos.Z; } } if (ceilColl->type == kHitSector) @@ -583,13 +583,13 @@ void GetZRange(DBloodActor *actor, int *ceilZ, Collision *ceilColl, int *floorZ, auto pSector = ceilColl->hitSector; if ((nClipParallax & PARALLAXCLIP_CEILING) == 0 && (pSector->ceilingstat & CSTAT_SECTOR_SKY)) *ceilZ = 0x80000000; - auto actor = barrier_cast(pSector->lowerLink); - if (actor) + auto linkActor = barrier_cast(pSector->lowerLink); + if (linkActor) { - auto link = actor->GetOwner(); - vec3_t lpos = actor->spr.pos + link->spr.pos - actor->spr.pos; - getzrange(lpos, link->spr.sector(), (int32_t*)ceilZ, *ceilColl, &nTemp1, scratch, nDist, nMask); - *ceilZ -= link->spr.pos.Z - actor->spr.pos.Z; + auto linkOwner = linkActor->GetOwner(); + vec3_t lpos = actor->spr.pos + linkOwner->spr.pos - linkActor->spr.pos; + getzrange(lpos, linkOwner->spr.sector(), (int32_t*)ceilZ, *ceilColl, &nTemp1, scratch, nDist, nMask); + *ceilZ -= linkOwner->spr.pos.Z - linkActor->spr.pos.Z; } } actor->spr.cstat = bakCstat;