- gFX.fxSpawnActor and a few other simple replacements.

This commit is contained in:
Christoph Oelckers 2021-11-24 00:41:19 +01:00
parent d99542a678
commit b063e19980
9 changed files with 52 additions and 52 deletions

View file

@ -2917,7 +2917,7 @@ bool actHealDude(DBloodActor* actor, int add, int threshold)
if (pXDude->health < (unsigned)threshold) if (pXDude->health < (unsigned)threshold)
{ {
spritetype* pSprite = &actor->s(); spritetype* pSprite = &actor->s();
if (actor->IsPlayerActor()) sfxPlay3DSound(pSprite->x, pSprite->y, pSprite->z, 780, pSprite->sectnum); if (actor->IsPlayerActor()) sfxPlay3DSound(pSprite->x, pSprite->y, pSprite->z, 780, pSprite->sector());
pXDude->health = min<uint32_t>(pXDude->health + add, threshold); pXDude->health = min<uint32_t>(pXDude->health + add, threshold);
return true; return true;
} }
@ -2992,7 +2992,7 @@ static bool actKillModernDude(DBloodActor* actor, DAMAGE_TYPE damageType)
else else
{ {
seqKill(actor); seqKill(actor);
DBloodActor* pEffectA = gFX.fxSpawnActor((FX_ID)52, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, pSprite->ang); DBloodActor* pEffectA = gFX.fxSpawnActor((FX_ID)52, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, pSprite->ang);
if (pEffectA != nullptr) if (pEffectA != nullptr)
{ {
auto pEffect = &pEffectA->s(); auto pEffect = &pEffectA->s();
@ -3932,7 +3932,7 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode)
case 4: case 4:
if (pWallHit) if (pWallHit)
{ {
auto pFX = gFX.fxSpawnActor(FX_52, pMissile->sectnum, pMissile->x, pMissile->y, pMissile->z, 0); auto pFX = gFX.fxSpawnActor(FX_52, pMissile->sector(), pMissile->x, pMissile->y, pMissile->z, 0);
if (pFX) pFX->s().ang = (GetWallAngle(pWallHit) + 512) & 2047; if (pFX) pFX->s().ang = (GetWallAngle(pWallHit) + 512) & 2047;
} }
break; break;
@ -4662,7 +4662,7 @@ static Collision MoveThing(DBloodActor* actor)
actor->zvel += 58254; actor->zvel += 58254;
if (pSprite->type == kThingZombieHead) if (pSprite->type == kThingZombieHead)
{ {
auto* fxActor = gFX.fxSpawnActor(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); auto* fxActor = gFX.fxSpawnActor(FX_27, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0);
if (fxActor) if (fxActor)
{ {
int v34 = (PlayClock * 3) & 2047; int v34 = (PlayClock * 3) & 2047;
@ -5211,17 +5211,17 @@ void MoveDude(DBloodActor* actor)
switch (tileGetSurfType(floorColl)) switch (tileGetSurfType(floorColl))
{ {
case kSurfWater: case kSurfWater:
gFX.fxSpawnActor(FX_9, pSprite->sectnum, pSprite->x, pSprite->y, floorZ, 0); gFX.fxSpawnActor(FX_9, pSprite->sector(), pSprite->x, pSprite->y, floorZ, 0);
break; break;
case kSurfLava: case kSurfLava:
{ {
auto pFX = gFX.fxSpawnActor(FX_10, pSprite->sectnum, pSprite->x, pSprite->y, floorZ, 0); auto pFX = gFX.fxSpawnActor(FX_10, pSprite->sector(), pSprite->x, pSprite->y, floorZ, 0);
if (pFX) if (pFX)
{ {
auto pFXs = &pFX->s(); auto pFXs = &pFX->s();
for (int i = 0; i < 7; i++) for (int i = 0; i < 7; i++)
{ {
auto pFX2 = gFX.fxSpawnActor(FX_14, pFXs->sectnum, pFXs->x, pFXs->y, pFXs->z, 0); auto pFX2 = gFX.fxSpawnActor(FX_14, pFXs->sector(), pFXs->x, pFXs->y, pFXs->z, 0);
if (pFX2) if (pFX2)
{ {
pFX2->xvel = Random2(0x6aaaa); pFX2->xvel = Random2(0x6aaaa);
@ -6068,7 +6068,7 @@ static void actCheckTraps()
int dy = MulScale(t, Sin(pSprite->ang), 30); int dy = MulScale(t, Sin(pSprite->ang), 30);
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
auto pFX = gFX.fxSpawnActor(FX_32, pSprite->sectnum, x, y, z, 0); auto pFX = gFX.fxSpawnActor(FX_32, pSprite->sector(), x, y, z, 0);
if (pFX) if (pFX)
{ {
pFX->xvel = dx + Random2(0x8888); pFX->xvel = dx + Random2(0x8888);
@ -7092,7 +7092,7 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6,
void FireballSeqCallback(int, DBloodActor* actor) void FireballSeqCallback(int, DBloodActor* actor)
{ {
auto pSprite = &actor->s(); auto pSprite = &actor->s();
auto pFX = gFX.fxSpawnActor(FX_11, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); auto pFX = gFX.fxSpawnActor(FX_11, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX) if (pFX)
{ {
pFX->xvel = actor->xvel; pFX->xvel = actor->xvel;
@ -7104,7 +7104,7 @@ void FireballSeqCallback(int, DBloodActor* actor)
void NapalmSeqCallback(int, DBloodActor* actor) void NapalmSeqCallback(int, DBloodActor* actor)
{ {
auto pSprite = &actor->s(); auto pSprite = &actor->s();
auto pFX = gFX.fxSpawnActor(FX_12, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); auto pFX = gFX.fxSpawnActor(FX_12, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX) if (pFX)
{ {
pFX->xvel = actor->xvel; pFX->xvel = actor->xvel;
@ -7116,7 +7116,7 @@ void NapalmSeqCallback(int, DBloodActor* actor)
void Fx32Callback(int, DBloodActor* actor) void Fx32Callback(int, DBloodActor* actor)
{ {
auto pSprite = &actor->s(); auto pSprite = &actor->s();
auto pFX = gFX.fxSpawnActor(FX_32, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); auto pFX = gFX.fxSpawnActor(FX_32, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX) if (pFX)
{ {
pFX->xvel = actor->xvel; pFX->xvel = actor->xvel;
@ -7128,7 +7128,7 @@ void Fx32Callback(int, DBloodActor* actor)
void Fx33Callback(int, DBloodActor* actor) void Fx33Callback(int, DBloodActor* actor)
{ {
auto pSprite = &actor->s(); auto pSprite = &actor->s();
auto pFX = gFX.fxSpawnActor(FX_33, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); auto pFX = gFX.fxSpawnActor(FX_33, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX) if (pFX)
{ {
pFX->xvel = actor->xvel; pFX->xvel = actor->xvel;

View file

@ -1442,7 +1442,7 @@ void removeLeech(DBloodActor* actLeech, bool delSprite)
if (actLeech != NULL) if (actLeech != NULL)
{ {
auto const pLeech = &actLeech->s(); auto const pLeech = &actLeech->s();
auto effectactor = gFX.fxSpawnActor((FX_ID)52, pLeech->sectnum, pLeech->x, pLeech->y, pLeech->z, pLeech->ang); auto effectactor = gFX.fxSpawnActor((FX_ID)52, pLeech->sector(), pLeech->x, pLeech->y, pLeech->z, pLeech->ang);
if (effectactor != NULL) if (effectactor != NULL)
{ {
spritetype* pEffect = &effectactor->s(); spritetype* pEffect = &effectactor->s();

View file

@ -46,7 +46,7 @@ void fxFlameLick(DBloodActor* actor, int) // 0
int x = pSprite->x + dx; int x = pSprite->x + dx;
int y = pSprite->y + dy; int y = pSprite->y + dy;
int z = bottom-Random(bottom-top); int z = bottom-Random(bottom-top);
auto pFX = gFX.fxSpawnActor(FX_32, pSprite->sectnum, x, y, z, 0); auto pFX = gFX.fxSpawnActor(FX_32, pSprite->sector(), x, y, z, 0);
if (pFX) if (pFX)
{ {
pFX->xvel = actor->xvel + Random2(-dx); pFX->xvel = actor->xvel + Random2(-dx);
@ -105,7 +105,7 @@ void fxFlareSpark(DBloodActor* actor, int) // 3
{ {
if (!actor) return; if (!actor) return;
spritetype *pSprite = &actor->s(); spritetype *pSprite = &actor->s();
auto pFX = gFX.fxSpawnActor(FX_28, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); auto pFX = gFX.fxSpawnActor(FX_28, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX) if (pFX)
{ {
pFX->xvel = actor->xvel + Random2(0x1aaaa); pFX->xvel = actor->xvel + Random2(0x1aaaa);
@ -119,7 +119,7 @@ void fxFlareSparkLite(DBloodActor* actor, int) // 4
{ {
if (!actor) return; if (!actor) return;
spritetype *pSprite = &actor->s(); spritetype *pSprite = &actor->s();
auto pFX = gFX.fxSpawnActor(FX_28, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); auto pFX = gFX.fxSpawnActor(FX_28, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX) if (pFX)
{ {
pFX->xvel = actor->xvel + Random2(0x1aaaa); pFX->xvel = actor->xvel + Random2(0x1aaaa);
@ -137,7 +137,7 @@ void fxZombieBloodSpurt(DBloodActor* actor, int) // 5
XSPRITE *pXSprite = &actor->x(); XSPRITE *pXSprite = &actor->x();
int top, bottom; int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom); GetSpriteExtents(pSprite, &top, &bottom);
auto pFX = gFX.fxSpawnActor(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, top, 0); auto pFX = gFX.fxSpawnActor(FX_27, pSprite->sector(), pSprite->x, pSprite->y, top, 0);
if (pFX) if (pFX)
{ {
pFX->xvel = actor->xvel + Random2(0x11111); pFX->xvel = actor->xvel + Random2(0x11111);
@ -161,7 +161,7 @@ void fxBloodSpurt(DBloodActor* actor, int) // 6
{ {
if (!actor) return; if (!actor) return;
spritetype *pSprite = &actor->s(); spritetype *pSprite = &actor->s();
auto pFX = gFX.fxSpawnActor(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); auto pFX = gFX.fxSpawnActor(FX_27, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX) if (pFX)
{ {
pFX->s().ang = 0; pFX->s().ang = 0;
@ -177,7 +177,7 @@ void fxArcSpark(DBloodActor* actor, int) // 7
{ {
if (!actor) return; if (!actor) return;
spritetype* pSprite = &actor->s(); spritetype* pSprite = &actor->s();
auto pFX = gFX.fxSpawnActor(FX_15, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); auto pFX = gFX.fxSpawnActor(FX_15, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX) if (pFX)
{ {
pFX->xvel = actor->xvel + Random2(0x10000); pFX->xvel = actor->xvel + Random2(0x10000);
@ -198,7 +198,7 @@ void fxDynPuff(DBloodActor* actor, int) // 8
int x = pSprite->x + MulScale(nDist, Cos(pSprite->ang-512), 30); int x = pSprite->x + MulScale(nDist, Cos(pSprite->ang-512), 30);
int y = pSprite->y + MulScale(nDist, Sin(pSprite->ang-512), 30); int y = pSprite->y + MulScale(nDist, Sin(pSprite->ang-512), 30);
int z = pSprite->z; int z = pSprite->z;
auto pFX = gFX.fxSpawnActor(FX_7, pSprite->sectnum, x, y, z, 0); auto pFX = gFX.fxSpawnActor(FX_7, pSprite->sector(), x, y, z, 0);
if (pFX) if (pFX)
{ {
pFX->xvel = actor->xvel; pFX->xvel = actor->xvel;
@ -286,7 +286,7 @@ void Respawn(DBloodActor* actor, int) // 9
pSprite->cstat &= (unsigned short)~CSTAT_SPRITE_INVISIBLE; pSprite->cstat &= (unsigned short)~CSTAT_SPRITE_INVISIBLE;
} }
gFX.fxSpawnActor(FX_29, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); gFX.fxSpawnActor(FX_29, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0);
sfxPlay3DSound(pSprite, 350, -1, 0); sfxPlay3DSound(pSprite, 350, -1, 0);
break; break;
} }
@ -312,7 +312,7 @@ void PlayerBubble(DBloodActor* actor, int) // 10
int x = pSprite->x + MulScale(nDist, Cos(nAngle), 30); int x = pSprite->x + MulScale(nDist, Cos(nAngle), 30);
int y = pSprite->y + MulScale(nDist, Sin(nAngle), 30); int y = pSprite->y + MulScale(nDist, Sin(nAngle), 30);
int z = bottom-Random(bottom-top); int z = bottom-Random(bottom-top);
auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23+Random(3)), pSprite->sectnum, x, y, z, 0); auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23+Random(3)), pSprite->sector(), x, y, z, 0);
if (pFX) if (pFX)
{ {
pFX->xvel = actor->xvel + Random2(0x1aaaa); pFX->xvel = actor->xvel + Random2(0x1aaaa);
@ -337,7 +337,7 @@ void EnemyBubble(DBloodActor* actor, int) // 11
int x = pSprite->x + MulScale(nDist, Cos(nAngle), 30); int x = pSprite->x + MulScale(nDist, Cos(nAngle), 30);
int y = pSprite->y + MulScale(nDist, Sin(nAngle), 30); int y = pSprite->y + MulScale(nDist, Sin(nAngle), 30);
int z = bottom-Random(bottom-top); int z = bottom-Random(bottom-top);
auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23+Random(3)), pSprite->sectnum, x, y, z, 0); auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23+Random(3)), pSprite->sector(), x, y, z, 0);
if (pFX) if (pFX)
{ {
pFX->xvel = actor->xvel + Random2(0x1aaaa); pFX->xvel = actor->xvel + Random2(0x1aaaa);
@ -400,7 +400,7 @@ void fxBloodBits(DBloodActor* actor, int) // 14
int nDist = Random(16)<<4; int nDist = Random(16)<<4;
int x = pSprite->x+MulScale(nDist, Cos(nAngle), 28); int x = pSprite->x+MulScale(nDist, Cos(nAngle), 28);
int y = pSprite->y+MulScale(nDist, Sin(nAngle), 28); int y = pSprite->y+MulScale(nDist, Sin(nAngle), 28);
gFX.fxSpawnActor(FX_48, pSprite->sectnum, x, y, pSprite->z, 0); gFX.fxSpawnActor(FX_48, pSprite->sector(), x, y, pSprite->z, 0);
if (pSprite->ang == 1024) if (pSprite->ang == 1024)
{ {
int nChannel = 28 + (actor->GetIndex() & 2); // this is a little stupid... int nChannel = 28 + (actor->GetIndex() & 2); // this is a little stupid...
@ -408,7 +408,7 @@ void fxBloodBits(DBloodActor* actor, int) // 14
} }
if (Chance(0x5000)) if (Chance(0x5000))
{ {
auto pFX = gFX.fxSpawnActor(FX_36, pSprite->sectnum, x, y, floorZ-64, 0); auto pFX = gFX.fxSpawnActor(FX_36, pSprite->sector(), x, y, floorZ-64, 0);
if (pFX) if (pFX)
pFX->s().ang = nAngle; pFX->s().ang = nAngle;
} }
@ -420,7 +420,7 @@ void fxTeslaAlt(DBloodActor* actor, int) // 15
{ {
if (!actor) return; if (!actor) return;
spritetype* pSprite = &actor->s(); spritetype* pSprite = &actor->s();
auto pFX = gFX.fxSpawnActor(FX_49, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); auto pFX = gFX.fxSpawnActor(FX_49, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX) if (pFX)
{ {
pFX->xvel = actor->xvel + Random2(0x1aaaa); pFX->xvel = actor->xvel + Random2(0x1aaaa);
@ -529,9 +529,9 @@ void fxPodBloodSpray(DBloodActor* actor, int) // 18
spritetype* pSprite = &actor->s(); spritetype* pSprite = &actor->s();
DBloodActor* pFX; DBloodActor* pFX;
if (pSprite->type == 53) if (pSprite->type == 53)
pFX = gFX.fxSpawnActor(FX_53, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); pFX = gFX.fxSpawnActor(FX_53, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0);
else else
pFX = gFX.fxSpawnActor(FX_54, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); pFX = gFX.fxSpawnActor(FX_54, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0);
if (pFX) if (pFX)
{ {
pFX->s().ang = 0; pFX->s().ang = 0;
@ -567,13 +567,13 @@ void fxPodBloodSplat(DBloodActor* actor, int) // 19
if (pSprite->type == 53 || pSprite->type == kThingPodGreenBall) if (pSprite->type == 53 || pSprite->type == kThingPodGreenBall)
{ {
if (Chance(0x500) || pSprite->type == kThingPodGreenBall) if (Chance(0x500) || pSprite->type == kThingPodGreenBall)
pFX = gFX.fxSpawnActor(FX_55, pSprite->sectnum, x, y, floorZ-64, 0); pFX = gFX.fxSpawnActor(FX_55, pSprite->sector(), x, y, floorZ-64, 0);
if (pFX) if (pFX)
pFX->s().ang = nAngle; pFX->s().ang = nAngle;
} }
else else
{ {
pFX = gFX.fxSpawnActor(FX_32, pSprite->sectnum, x, y, floorZ-64, 0); pFX = gFX.fxSpawnActor(FX_32, pSprite->sector(), x, y, floorZ-64, 0);
if (pFX) if (pFX)
pFX->s().ang = nAngle; pFX->s().ang = nAngle;
} }

View file

@ -265,7 +265,7 @@ void fxSpawnBlood(DBloodActor *actor, int )
return; return;
if (adult_lockout && gGameOptions.nGameType <= 0) if (adult_lockout && gGameOptions.nGameType <= 0)
return; return;
auto bloodactor = gFX.fxSpawnActor(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); auto bloodactor = gFX.fxSpawnActor(FX_27, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0);
if (bloodactor) if (bloodactor)
{ {
bloodactor->s().ang = 1024; bloodactor->s().ang = 1024;
@ -288,9 +288,9 @@ void fxSpawnPodStuff(DBloodActor* actor, int )
return; return;
DBloodActor *spawnactor; DBloodActor *spawnactor;
if (pSprite->type == kDudePodGreen) if (pSprite->type == kDudePodGreen)
spawnactor = gFX.fxSpawnActor(FX_53, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); spawnactor = gFX.fxSpawnActor(FX_53, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0);
else else
spawnactor = gFX.fxSpawnActor(FX_54, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0); spawnactor = gFX.fxSpawnActor(FX_54, pSprite->sector(), pSprite->x, pSprite->y, pSprite->z, 0);
if (spawnactor) if (spawnactor)
{ {
spawnactor->s().ang = 1024; spawnactor->s().ang = 1024;
@ -308,7 +308,7 @@ void fxSpawnEjectingBrass(DBloodActor* actor, int z, int a3, int a4)
int y = pSprite->y + MulScale(pSprite->clipdist - 4, Sin(pSprite->ang), 28); int y = pSprite->y + MulScale(pSprite->clipdist - 4, Sin(pSprite->ang), 28);
x += MulScale(a3, Cos(pSprite->ang + 512), 30); x += MulScale(a3, Cos(pSprite->ang + 512), 30);
y += MulScale(a3, Sin(pSprite->ang + 512), 30); y += MulScale(a3, Sin(pSprite->ang + 512), 30);
auto pBrass = gFX.fxSpawnActor((FX_ID)(FX_37 + Random(3)), pSprite->sectnum, x, y, z, 0); auto pBrass = gFX.fxSpawnActor((FX_ID)(FX_37 + Random(3)), pSprite->sector(), x, y, z, 0);
if (pBrass) if (pBrass)
{ {
if (!VanillaMode()) if (!VanillaMode())
@ -328,7 +328,7 @@ void fxSpawnEjectingShell(DBloodActor* actor, int z, int a3, int a4)
int y = pSprite->y + MulScale(pSprite->clipdist - 4, Sin(pSprite->ang), 28); int y = pSprite->y + MulScale(pSprite->clipdist - 4, Sin(pSprite->ang), 28);
x += MulScale(a3, Cos(pSprite->ang + 512), 30); x += MulScale(a3, Cos(pSprite->ang + 512), 30);
y += MulScale(a3, Sin(pSprite->ang + 512), 30); y += MulScale(a3, Sin(pSprite->ang + 512), 30);
auto pShell = gFX.fxSpawnActor((FX_ID)(FX_40 + Random(3)), pSprite->sectnum, x, y, z, 0); auto pShell = gFX.fxSpawnActor((FX_ID)(FX_40 + Random(3)), pSprite->sector(), x, y, z, 0);
if (pShell) if (pShell)
{ {
if (!VanillaMode()) if (!VanillaMode())

View file

@ -583,7 +583,7 @@ void GetZRange(DBloodActor *actor, int *ceilZ, Collision *ceilColl, int *floorZ,
int bakCstat = pSprite->cstat; int bakCstat = pSprite->cstat;
int32_t nTemp1, nTemp2; int32_t nTemp1, nTemp2;
pSprite->cstat &= ~257; pSprite->cstat &= ~257;
getzrange(&pSprite->pos, pSprite->sectnum, (int32_t*)ceilZ, &ceilHit, (int32_t*)floorZ, &floorHit, nDist, nMask); getzrange(&pSprite->pos, pSprite->sector(), (int32_t*)ceilZ, &ceilHit, (int32_t*)floorZ, &floorHit, nDist, nMask);
ceilColl->setFromEngine(ceilHit); ceilColl->setFromEngine(ceilHit);
floorColl->setFromEngine(floorHit); floorColl->setFromEngine(floorHit);
if (floorColl->type == kHitSector) if (floorColl->type == kHitSector)

View file

@ -1648,7 +1648,7 @@ void debrisBubble(DBloodActor* actor)
int x = pSprite->x + MulScale(nDist, Cos(nAngle), 30); int x = pSprite->x + MulScale(nDist, Cos(nAngle), 30);
int y = pSprite->y + MulScale(nDist, Sin(nAngle), 30); int y = pSprite->y + MulScale(nDist, Sin(nAngle), 30);
int z = bottom - Random(bottom - top); int z = bottom - Random(bottom - top);
auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23 + Random(3)), pSprite->sectnum, x, y, z, 0); auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23 + Random(3)), pSprite->sector(), x, y, z, 0);
if (pFX) { if (pFX) {
pFX->xvel = actor->xvel + Random2(0x1aaaa); pFX->xvel = actor->xvel + Random2(0x1aaaa);
pFX->yvel = actor->yvel + Random2(0x1aaaa); pFX->yvel = actor->yvel + Random2(0x1aaaa);
@ -1843,7 +1843,7 @@ void debrisMove(int listIndex)
} }
break; break;
case kSurfWater: case kSurfWater:
gFX.fxSpawnActor(FX_9, pSprite->sectnum, pSprite->x, pSprite->y, floorZ, 0); gFX.fxSpawnActor(FX_9, pSprite->sector(), pSprite->x, pSprite->y, floorZ, 0);
break; break;
} }
@ -3008,8 +3008,8 @@ void useTeleportTarget(DBloodActor* sourceactor, DBloodActor* actor)
XSECTOR* pXSector = (pSource->sector()->hasX()) ? &pSource->sector()->xs() : nullptr; XSECTOR* pXSector = (pSource->sector()->hasX()) ? &pSource->sector()->xs() : nullptr;
bool isDude = (!pPlayer && actor->IsDudeActor()); bool isDude = (!pPlayer && actor->IsDudeActor());
if (pSprite->sectnum != pSource->sectnum) if (pSprite->sector() != pSource->sector())
ChangeActorSect(actor, pSource->sectnum); ChangeActorSect(actor, pSource->sector());
pSprite->x = pSource->x; pSprite->y = pSource->y; pSprite->x = pSource->x; pSprite->y = pSource->y;
int zTop, zBot; int zTop, zBot;
@ -3175,7 +3175,7 @@ void useEffectGen(DBloodActor* sourceactor, DBloodActor* actor)
break; break;
} }
if ((pEffect = gFX.fxSpawnActor((FX_ID)fxId, pSprite->sectnum, pSprite->x, pSprite->y, pos, 0)) != NULL) if ((pEffect = gFX.fxSpawnActor((FX_ID)fxId, pSprite->sector(), pSprite->x, pSprite->y, pos, 0)) != NULL)
{ {
auto pEffectSpr = &pEffect->s(); auto pEffectSpr = &pEffect->s();
pEffect->SetOwner(sourceactor); pEffect->SetOwner(sourceactor);
@ -4996,7 +4996,7 @@ bool aiFightDudeCanSeeTarget(DBloodActor* dudeactor, DUDEINFO* pDudeInfo, DBlood
int eyeAboveZ = pDudeInfo->eyeHeight * pDude->yrepeat << 2; int eyeAboveZ = pDudeInfo->eyeHeight * pDude->yrepeat << 2;
// is there a line of sight to the target? // is there a line of sight to the target?
if (cansee(pDude->x, pDude->y, pDude->z, pDude->sectnum, pTarget->x, pTarget->y, pTarget->z - eyeAboveZ, pTarget->sectnum)) if (cansee(pDude->x, pDude->y, pDude->z, pDude->sector(), pTarget->x, pTarget->y, pTarget->z - eyeAboveZ, pTarget->sector()))
{ {
/*int nAngle = getangle(dx, dy); /*int nAngle = getangle(dx, dy);
int losAngle = ((1024 + nAngle - pDude->ang) & 2047) - 1024; int losAngle = ((1024 + nAngle - pDude->ang) & 2047) - 1024;
@ -7843,7 +7843,7 @@ void aiPatrolSetMarker(DBloodActor* actor)
continue; continue;
GetActorExtents(nextactor, &zt1, &zb1); GetActorExtents(nextactor, &zt1, &zb1);
if (cansee(pNext->x, pNext->y, zt1, pNext->sectnum, pSprite->x, pSprite->y, zt2, pSprite->sectnum)) if (cansee(pNext->x, pNext->y, zt1, pNext->sector(), pSprite->x, pSprite->y, zt2, pSprite->sector()))
{ {
closest = dist; closest = dist;
selected = nextactor; selected = nextactor;
@ -8314,7 +8314,7 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor)
{ {
eyeAboveZ = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2; eyeAboveZ = (pDudeInfo->eyeHeight * pSprite->yrepeat) << 2;
if (nDist < seeDist >> 3) GetActorExtents(pPlayer->actor, &z, &j); //use ztop of the target sprite if (nDist < seeDist >> 3) GetActorExtents(pPlayer->actor, &z, &j); //use ztop of the target sprite
if (!cansee(x, y, z, pSpr->sectnum, pSprite->x, pSprite->y, pSprite->z - eyeAboveZ, pSprite->sectnum)) if (!cansee(x, y, z, pSpr->sector(), pSprite->x, pSprite->y, pSprite->z - eyeAboveZ, pSprite->sector()))
continue; continue;
} }
else else

View file

@ -1445,7 +1445,7 @@ void OperateTeleport(unsigned int nSector, XSECTOR *pXSector)
pSprite->y = pDest->y; pSprite->y = pDest->y;
pSprite->z += sector[pDest->sectnum].floorz-sector[nSector].floorz; pSprite->z += sector[pDest->sectnum].floorz-sector[nSector].floorz;
pSprite->ang = pDest->ang; pSprite->ang = pDest->ang;
ChangeActorSect(actor, pDest->sectnum); ChangeActorSect(actor, pDest->sector());
sfxPlay3DSound(pDest, 201, -1, 0); sfxPlay3DSound(pDest, 201, -1, 0);
actor->xvel = actor->yvel = actor->zvel = 0; actor->xvel = actor->yvel = actor->zvel = 0;
actor->interpolated = false; actor->interpolated = false;
@ -2224,7 +2224,7 @@ void ActivateGenerator(DBloodActor* actor)
case kGenBubbleMulti: { case kGenBubbleMulti: {
int top, bottom; int top, bottom;
GetActorExtents(actor, &top, &bottom); GetActorExtents(actor, &top, &bottom);
gFX.fxSpawnActor((pSprite->type == kGenBubble) ? FX_23 : FX_26, pSprite->sectnum, pSprite->x, pSprite->y, top, 0); gFX.fxSpawnActor((pSprite->type == kGenBubble) ? FX_23 : FX_26, pSprite->sector(), pSprite->x, pSprite->y, top, 0);
break; break;
} }
} }

View file

@ -205,7 +205,7 @@ int CheckLink(DBloodActor *actor)
assert(aLower); assert(aLower);
spritetype *pLower = &aLower->s(); spritetype *pLower = &aLower->s();
assert(validSectorIndex(pLower->sectnum)); assert(validSectorIndex(pLower->sectnum));
ChangeActorSect(actor, pLower->sectnum); ChangeActorSect(actor, pLower->sector());
pSprite->x += pLower->x-pUpper->x; pSprite->x += pLower->x-pUpper->x;
pSprite->y += pLower->y-pUpper->y; pSprite->y += pLower->y-pUpper->y;
int z2; int z2;
@ -232,7 +232,7 @@ int CheckLink(DBloodActor *actor)
assert(aUpper); assert(aUpper);
spritetype *pUpper = &aUpper->s(); spritetype *pUpper = &aUpper->s();
assert(validSectorIndex(pUpper->sectnum)); assert(validSectorIndex(pUpper->sectnum));
ChangeActorSect(actor, pUpper->sectnum); ChangeActorSect(actor, pUpper->sector());
pSprite->x += pUpper->x-pLower->x; pSprite->x += pUpper->x-pLower->x;
pSprite->y += pUpper->y-pLower->y; pSprite->y += pUpper->y-pLower->y;
int z2; int z2;

View file

@ -396,7 +396,7 @@ void UpdateAimVector(PLAYER * pPlayer)
int angle = getangle(x2-x,y2-y); int angle = getangle(x2-x,y2-y);
if (abs(((angle-pPSprite->ang+1024)&2047)-1024) > pWeaponTrack->angleRange) if (abs(((angle-pPSprite->ang+1024)&2047)-1024) > pWeaponTrack->angleRange)
continue; continue;
if (pPlayer->aimTargetsCount < 16 && cansee(x,y,z,pPSprite->sectnum,x2,y2,z2,pSprite->sectnum)) if (pPlayer->aimTargetsCount < 16 && cansee(x,y,z,pPSprite->sector(),x2,y2,z2,pSprite->sector()))
pPlayer->aimTargets[pPlayer->aimTargetsCount++] = actor; pPlayer->aimTargets[pPlayer->aimTargetsCount++] = actor;
// Inlined? // Inlined?
int dz = (lz-z2)>>8; int dz = (lz-z2)>>8;
@ -408,7 +408,7 @@ void UpdateAimVector(PLAYER * pPlayer)
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int center = (pSprite->yrepeat*pDudeInfo->aimHeight)<<2; int center = (pSprite->yrepeat*pDudeInfo->aimHeight)<<2;
int dzCenter = (z2-center)-z; int dzCenter = (z2-center)-z;
if (cansee(x, y, z, pPSprite->sectnum, x2, y2, z2, pSprite->sectnum)) if (cansee(x, y, z, pPSprite->sector(), x2, y2, z2, pSprite->sector()))
{ {
nClosest = nDist2; nClosest = nDist2;
aim.dx = bcos(angle); aim.dx = bcos(angle);
@ -447,7 +447,7 @@ void UpdateAimVector(PLAYER * pPlayer)
int angle = getangle(dx,dy); int angle = getangle(dx,dy);
if (abs(((angle-pPSprite->ang+1024)&2047)-1024) > pWeaponTrack->thingAngle) if (abs(((angle-pPSprite->ang+1024)&2047)-1024) > pWeaponTrack->thingAngle)
continue; continue;
if (pPlayer->aimTargetsCount < 16 && cansee(x,y,z,pPSprite->sectnum,pSprite->x,pSprite->y,pSprite->z,pSprite->sectnum)) if (pPlayer->aimTargetsCount < 16 && cansee(x,y,z,pPSprite->sector(),pSprite->x,pSprite->y,pSprite->z,pSprite->sector()))
pPlayer->aimTargets[pPlayer->aimTargetsCount++] = actor; pPlayer->aimTargets[pPlayer->aimTargetsCount++] = actor;
// Inlined? // Inlined?
int dz2 = (lz-z2)>>8; int dz2 = (lz-z2)>>8;
@ -456,7 +456,7 @@ void UpdateAimVector(PLAYER * pPlayer)
int nDist2 = ksqrt(dx2*dx2+dy2*dy2+dz2*dz2); int nDist2 = ksqrt(dx2*dx2+dy2*dy2+dz2*dz2);
if (nDist2 >= nClosest) if (nDist2 >= nClosest)
continue; continue;
if (cansee(x, y, z, pPSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum)) if (cansee(x, y, z, pPSprite->sector(), pSprite->x, pSprite->y, pSprite->z, pSprite->sector()))
{ {
nClosest = nDist2; nClosest = nDist2;
aim.dx = bcos(angle); aim.dx = bcos(angle);