- all calls to CheckSpriteSect/Stat handled.

This commit is contained in:
Christoph Oelckers 2021-09-04 09:37:17 +02:00
parent 48073a2cd6
commit 118b3e1d70
7 changed files with 32 additions and 29 deletions

View file

@ -4710,7 +4710,7 @@ static Collision MoveThing(DBloodActor* actor)
}
}
}
if (CheckLink(pSprite)) GetZRange(pSprite, &ceilZ, &ceilColl, &floorZ, &floorColl, pSprite->clipdist << 2, CLIPMASK0);
if (CheckLink(actor)) GetZRange(pSprite, &ceilZ, &ceilColl, &floorZ, &floorColl, pSprite->clipdist << 2, CLIPMASK0);
GetActorExtents(actor, &top, &bottom);
if (bottom >= floorZ)
@ -5040,7 +5040,7 @@ void MoveDude(DBloodActor* actor)
}
}
vec3_t const oldpos = pSprite->pos;
int nLink = CheckLink(pSprite);
int nLink = CheckLink(actor);
if (nLink)
{
GetZRange(pSprite, &ceilZ, &ceilColl, &floorZ, &floorColl, wd, CLIPMASK0, PARALLAXCLIP_CEILING | PARALLAXCLIP_FLOOR);
@ -5469,7 +5469,7 @@ int MoveMissile(DBloodActor* actor)
assert(nSector >= 0 && nSector < kMaxSectors);
ChangeActorSect(actor, nSector);
}
CheckLink(pSprite);
CheckLink(actor);
gHitInfo.hitsect = pSprite->sectnum;
gHitInfo.hitx = pSprite->x;
gHitInfo.hity = pSprite->y;
@ -7328,7 +7328,7 @@ void actPostProcess(void)
}
}
else
ChangeSpriteStat(p.sprite->s().index, nStatus);
ChangeActorStat(p.sprite, nStatus);
}
gPost.Clear();
}

View file

@ -243,7 +243,7 @@ void Respawn(DBloodActor* actor, int) // 9
case 3: {
assert(pSprite->owner != kStatRespawn);
assert(pSprite->owner >= 0 && pSprite->owner < kMaxStatus);
ChangeSpriteStat(actor->s().index, pSprite->owner);
ChangeActorStat(actor, pSprite->owner);
pSprite->type = pSprite->inittype;
pSprite->owner = -1;
pSprite->flags &= ~kHitagRespawn;

View file

@ -27,6 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS
class DBloodActor;
void playlogos();
unsigned int qrand(void);
int wrand(void);
@ -61,7 +63,7 @@ struct ZONE {
extern ZONE gStartZone[8];
void warpInit(void);
int CheckLink(spritetype *pSprite);
int CheckLink(DBloodActor *pSprite);
int CheckLink(int *x, int *y, int *z, int *nSector);
int GetOctant(int x, int y);

View file

@ -1849,7 +1849,7 @@ void debrisMove(int listIndex)
}
if ((i = CheckLink(pSprite)) != 0)
if ((i = CheckLink(actor)) != 0)
{
GetZRange(pSprite, &ceilZ, &ceilColl, &floorZ, &floorColl, clipDist, CLIPMASK0, PARALLAXCLIP_CEILING | PARALLAXCLIP_FLOOR);
if (!(pSprite->cstat & CSTAT_SPRITE_INVISIBLE))

View file

@ -1678,7 +1678,7 @@ void playerProcess(PLAYER *pPlayer)
actDamageSprite(actor, actor, kDamageFall, 500<<4);
}
assert(nSector >= 0 && nSector < kMaxSectors);
ChangeSpriteSect(pSprite->index, nSector);
ChangeActorSect(actor, nSector);
}
}
ProcessInput(pPlayer);

View file

@ -1442,11 +1442,10 @@ void OperateTeleport(unsigned int nSector, XSECTOR *pXSector)
assert(pDest->statnum == kStatMarker);
assert(pDest->type == kMarkerWarpDest);
assert(pDest->sectnum >= 0 && pDest->sectnum < kMaxSectors);
int nSprite;
SectIterator it(nSector);
while ((nSprite = it.NextIndex()) >= 0)
BloodSectIterator it(nSector);
while (auto actor = it.Next())
{
spritetype *pSprite = &sprite[nSprite];
spritetype *pSprite = &actor->s();
if (pSprite->statnum == kStatDude)
{
PLAYER *pPlayer;
@ -1463,9 +1462,10 @@ void OperateTeleport(unsigned int nSector, XSECTOR *pXSector)
pSprite->y = pDest->y;
pSprite->z += sector[pDest->sectnum].floorz-sector[nSector].floorz;
pSprite->ang = pDest->ang;
ChangeSpriteSect(nSprite, pDest->sectnum);
ChangeActorSect(actor, pDest->sectnum);
sfxPlay3DSound(pDest, 201, -1, 0);
xvel[nSprite] = yvel[nSprite] = zvel[nSprite] = 0;
actor->xvel() = actor->yvel() = actor->zvel() = 0;
int nSprite = actor->s().index;
gInterpolateSprite.Clear(nSprite);
viewBackupSpriteLoc(nSprite, pSprite);
if (pPlayer)

View file

@ -175,14 +175,15 @@ void warpInit(void)
}
}
int CheckLink(spritetype *pSprite)
int CheckLink(DBloodActor *actor)
{
auto pSprite = &actor->s();
int nSector = pSprite->sectnum;
int nUpper = gUpperLink[nSector];
int nLower = gLowerLink[nSector];
if (nUpper >= 0)
auto aUpper = getUpperLink(nSector);
auto aLower = getLowerLink(nSector);
if (aUpper)
{
spritetype *pUpper = &sprite[nUpper];
spritetype* pUpper = &aUpper->s();
int z;
if (pUpper->type == kMarkerUpLink)
z = pUpper->z;
@ -190,11 +191,11 @@ int CheckLink(spritetype *pSprite)
z = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y);
if (z <= pSprite->z)
{
nLower = pUpper->owner;
assert(nLower >= 0 && nLower < kMaxSprites);
spritetype *pLower = &sprite[nLower];
aLower = aUpper->GetOwner();
assert(aLower);
spritetype *pLower = &aLower->s();
assert(pLower->sectnum >= 0 && pLower->sectnum < kMaxSectors);
ChangeSpriteSect(pSprite->index, pLower->sectnum);
ChangeActorSect(actor, pLower->sectnum);
pSprite->x += pLower->x-pUpper->x;
pSprite->y += pLower->y-pUpper->y;
int z2;
@ -207,9 +208,9 @@ int CheckLink(spritetype *pSprite)
return pUpper->type;
}
}
if (nLower >= 0)
if (aLower)
{
spritetype *pLower = &sprite[nLower];
spritetype *pLower = &aLower->s();
int z;
if (pLower->type == kMarkerLowLink)
z = pLower->z;
@ -217,11 +218,11 @@ int CheckLink(spritetype *pSprite)
z = getceilzofslope(pSprite->sectnum, pSprite->x, pSprite->y);
if (z >= pSprite->z)
{
nUpper = pLower->owner;
assert(nUpper >= 0 && nUpper < kMaxSprites);
spritetype *pUpper = &sprite[nUpper];
aUpper = aLower->GetOwner();
assert(aUpper);
spritetype *pUpper = &aUpper->s();
assert(pUpper->sectnum >= 0 && pUpper->sectnum < kMaxSectors);
ChangeSpriteSect(pSprite->index, pUpper->sectnum);
ChangeActorSect(actor, pUpper->sectnum);
pSprite->x += pUpper->x-pLower->x;
pSprite->y += pUpper->y-pLower->y;
int z2;