- Blood: replaced the remaining spr.pos with int_pos()

This commit is contained in:
Christoph Oelckers 2022-01-30 18:09:26 +01:00
parent 5296051fef
commit 0f8bf5f743
8 changed files with 106 additions and 106 deletions

View file

@ -64,8 +64,8 @@ void HackSeqCallback(int, DBloodActor* actor)
auto target = actor->GetTarget();
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
DUDEINFO* pDudeInfoT = getDudeInfo(target->spr.type);
int tx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int ty = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int tx = actor->xspr.TargetPos.X - actor->int_pos().X;
int ty = actor->xspr.TargetPos.Y - actor->int_pos().Y;
int nAngle = getangle(tx, ty);
int height = (actor->spr.yrepeat * pDudeInfo->eyeHeight) << 2;
int height2 = (target->spr.yrepeat * pDudeInfoT->eyeHeight) << 2;
@ -91,8 +91,8 @@ static void zombaThinkGoto(DBloodActor* actor)
{
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int dx = actor->xspr.TargetPos.X - actor->int_pos().X;
int dy = actor->xspr.TargetPos.Y - actor->int_pos().Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);
@ -113,8 +113,8 @@ static void zombaThinkChase(DBloodActor* actor)
if (!actor->ValidateTarget(__FUNCTION__)) return;
auto target = actor->GetTarget();
int dx = target->spr.pos.X - actor->spr.pos.X;
int dy = target->spr.pos.Y - actor->spr.pos.Y;
int dx = target->int_pos().X - actor->int_pos().X;
int dy = target->int_pos().Y - actor->int_pos().Y;
aiChooseDirection(actor, getangle(dx, dy));
if (target->xspr.health == 0)
{
@ -135,7 +135,7 @@ static void zombaThinkChase(DBloodActor* actor)
{
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->spr.ang) & 2047) - 1024;
int height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2;
if (cansee(target->spr.pos.X, target->spr.pos.Y, target->spr.pos.Z, target->sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - height, actor->sector()))
if (cansee(target->int_pos().X, target->int_pos().Y, target->int_pos().Z, target->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - height, actor->sector()))
{
if (abs(nDeltaAngle) <= pDudeInfo->periphery)
{
@ -163,8 +163,8 @@ static void zombaThinkPonder(DBloodActor* actor)
if (!actor->ValidateTarget(__FUNCTION__)) return;
auto target = actor->GetTarget();
int dx = target->spr.pos.X - actor->spr.pos.X;
int dy = target->spr.pos.Y - actor->spr.pos.Y;
int dx = target->int_pos().X - actor->int_pos().X;
int dy = target->int_pos().Y - actor->int_pos().Y;
aiChooseDirection(actor, getangle(dx, dy));
if (target->xspr.health == 0)
{
@ -181,7 +181,7 @@ static void zombaThinkPonder(DBloodActor* actor)
{
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->spr.ang) & 2047) - 1024;
int height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2;
if (cansee(target->spr.pos.X, target->spr.pos.Y, target->spr.pos.Z, target->sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - height, actor->sector()))
if (cansee(target->int_pos().X, target->int_pos().Y, target->int_pos().Z, target->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - height, actor->sector()))
{
if (abs(nDeltaAngle) <= pDudeInfo->periphery)
{
@ -212,16 +212,16 @@ static void myThinkTarget(DBloodActor* actor)
auto owneractor = actor->GetOwner();
if (owneractor == nullptr || owneractor == pPlayer->actor || pPlayer->actor->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
continue;
int x = pPlayer->actor->spr.pos.X;
int y = pPlayer->actor->spr.pos.Y;
int z = pPlayer->actor->spr.pos.Z;
int x = pPlayer->actor->int_pos().X;
int y = pPlayer->actor->int_pos().Y;
int z = pPlayer->actor->int_pos().Z;
auto pSector = pPlayer->actor->sector();
int dx = x - actor->spr.pos.X;
int dy = y - actor->spr.pos.Y;
int dx = x - actor->int_pos().X;
int dy = y - actor->int_pos().Y;
int nDist = approxDist(dx, dy);
if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist)
continue;
if (!cansee(x, y, z, pSector, actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - ((pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2), actor->sector()))
if (!cansee(x, y, z, pSector, actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - ((pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2), actor->sector()))
continue;
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->spr.ang) & 2047) - 1024;
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
@ -266,7 +266,7 @@ static void entryAIdle(DBloodActor* actor)
static void entryEStand(DBloodActor* actor)
{
sfxPlay3DSound(actor, 1100, -1, 0);
actor->spr.ang = getangle(actor->xspr.TargetPos.X - actor->spr.pos.X, actor->xspr.TargetPos.Y - actor->spr.pos.Y);
actor->spr.ang = getangle(actor->xspr.TargetPos.X - actor->int_pos().X, actor->xspr.TargetPos.Y - actor->int_pos().Y);
}
END_BLD_NS

View file

@ -66,8 +66,8 @@ void PukeSeqCallback(int, DBloodActor* actor)
DUDEINFO* pDudeInfoT = getDudeInfo(target->spr.type);
int height = (pDudeInfo->eyeHeight * actor->spr.yrepeat);
int height2 = (pDudeInfoT->eyeHeight * target->spr.yrepeat);
int tx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int ty = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int tx = actor->xspr.TargetPos.X - actor->int_pos().X;
int ty = actor->xspr.TargetPos.Y - actor->int_pos().Y;
int nAngle = getangle(tx, ty);
int dx = bcos(nAngle);
int dy = bsin(nAngle);
@ -90,8 +90,8 @@ static void zombfThinkGoto(DBloodActor* actor)
{
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int dx = actor->xspr.TargetPos.X - actor->int_pos().X;
int dy = actor->xspr.TargetPos.Y - actor->int_pos().Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);
@ -112,8 +112,8 @@ static void zombfThinkChase(DBloodActor* actor)
if (!actor->ValidateTarget(__FUNCTION__)) return;
auto target = actor->GetTarget();
int dx = target->spr.pos.X - actor->spr.pos.X;
int dy = target->spr.pos.Y - actor->spr.pos.Y;
int dx = target->int_pos().X - actor->int_pos().X;
int dy = target->int_pos().Y - actor->int_pos().Y;
aiChooseDirection(actor, getangle(dx, dy));
if (target->xspr.health == 0)
{
@ -130,14 +130,14 @@ static void zombfThinkChase(DBloodActor* actor)
{
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->spr.ang) & 2047) - 1024;
int height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2;
if (cansee(target->spr.pos.X, target->spr.pos.Y, target->spr.pos.Z, target->sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - height, actor->sector()))
if (cansee(target->int_pos().X, target->int_pos().Y, target->int_pos().Z, target->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - height, actor->sector()))
{
if (abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(actor, actor->GetTarget());
if (nDist < 0x1400 && nDist > 0xe00 && abs(nDeltaAngle) < 85)
{
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
int hit = HitScan(actor, actor->int_pos().Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit)
{
case -1:
@ -156,7 +156,7 @@ static void zombfThinkChase(DBloodActor* actor)
}
else if (nDist < 0x1400 && nDist > 0x600 && abs(nDeltaAngle) < 85)
{
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
int hit = HitScan(actor, actor->int_pos().Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit)
{
case -1:
@ -175,7 +175,7 @@ static void zombfThinkChase(DBloodActor* actor)
}
else if (nDist < 0x400 && abs(nDeltaAngle) < 85)
{
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
int hit = HitScan(actor, actor->int_pos().Z, dx, dy, 0, CLIPMASK1, 0);
switch (hit)
{
case -1:

View file

@ -911,7 +911,7 @@ void viewProcessSprites(tspriteArray& tsprites, int32_t cX, int32_t cY, int32_t
POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
pNTSprite->pos.X += MulScale(pPosture->zOffset, Cos(pTSprite->ang), 28);
pNTSprite->pos.Y += MulScale(pPosture->zOffset, Sin(pTSprite->ang), 28);
pNTSprite->pos.Z = pPlayer->actor->spr.pos.Z - pPosture->xOffset;
pNTSprite->pos.Z = pPlayer->actor->int_pos().Z - pPosture->xOffset;
}
}

View file

@ -60,9 +60,9 @@ void ambProcess(void)
{
if (actor->xspr.state)
{
int dx = actor->spr.pos.X-gMe->actor->spr.pos.X;
int dy = actor->spr.pos.Y-gMe->actor->spr.pos.Y;
int dz = actor->spr.pos.Z-gMe->actor->spr.pos.Z;
int dx = actor->int_pos().X-gMe->actor->int_pos().X;
int dy = actor->int_pos().Y-gMe->actor->int_pos().Y;
int dz = actor->int_pos().Z-gMe->actor->int_pos().Z;
dx >>= 4;
dy >>= 4;
dz >>= 8;

View file

@ -47,8 +47,8 @@ void fxFlameLick(DBloodActor* actor, sectortype*) // 0
int nAngle = Random(2048);
int dx = MulScale(nDist, Cos(nAngle), 30);
int dy = MulScale(nDist, Sin(nAngle), 30);
int x = actor->spr.pos.X + dx;
int y = actor->spr.pos.Y + dy;
int x = actor->int_pos().X + dx;
int y = actor->int_pos().Y + dy;
int z = bottom - Random(bottom - top);
auto pFX = gFX.fxSpawnActor(FX_32, actor->sector(), x, y, z, 0);
if (pFX)
@ -125,7 +125,7 @@ void FlareBurst(DBloodActor* actor, sectortype*) // 2
void fxFlareSpark(DBloodActor* actor, sectortype*) // 3
{
if (!actor) return;
auto pFX = gFX.fxSpawnActor(FX_28, actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, 0);
auto pFX = gFX.fxSpawnActor(FX_28, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0);
if (pFX)
{
pFX->vel.X = actor->vel.X + Random2(0x1aaaa);
@ -144,7 +144,7 @@ void fxFlareSpark(DBloodActor* actor, sectortype*) // 3
void fxFlareSparkLite(DBloodActor* actor, sectortype*) // 4
{
if (!actor) return;
auto pFX = gFX.fxSpawnActor(FX_28, actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, 0);
auto pFX = gFX.fxSpawnActor(FX_28, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0);
if (pFX)
{
pFX->vel.X = actor->vel.X + Random2(0x1aaaa);
@ -166,7 +166,7 @@ void fxZombieBloodSpurt(DBloodActor* actor, sectortype*) // 5
assert(actor->hasX());
int top, bottom;
GetActorExtents(actor, &top, &bottom);
auto pFX = gFX.fxSpawnActor(FX_27, actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, top, 0);
auto pFX = gFX.fxSpawnActor(FX_27, actor->sector(), actor->int_pos().X, actor->int_pos().Y, top, 0);
if (pFX)
{
pFX->vel.X = actor->vel.X + Random2(0x11111);
@ -195,7 +195,7 @@ void fxZombieBloodSpurt(DBloodActor* actor, sectortype*) // 5
void fxBloodSpurt(DBloodActor* actor, sectortype*) // 6
{
if (!actor) return;
auto pFX = gFX.fxSpawnActor(FX_27, actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, 0);
auto pFX = gFX.fxSpawnActor(FX_27, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0);
if (pFX)
{
pFX->spr.ang = 0;
@ -215,7 +215,7 @@ void fxBloodSpurt(DBloodActor* actor, sectortype*) // 6
void fxArcSpark(DBloodActor* actor, sectortype*) // 7
{
if (!actor) return;
auto pFX = gFX.fxSpawnActor(FX_15, actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, 0);
auto pFX = gFX.fxSpawnActor(FX_15, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0);
if (pFX)
{
pFX->vel.X = actor->vel.X + Random2(0x10000);
@ -237,9 +237,9 @@ void fxDynPuff(DBloodActor* actor, sectortype*) // 8
if (actor->vel.Z)
{
int nDist = (actor->spr.xrepeat * (tileWidth(actor->spr.picnum) / 2)) >> 2;
int x = actor->spr.pos.X + MulScale(nDist, Cos(actor->spr.ang - 512), 30);
int y = actor->spr.pos.Y + MulScale(nDist, Sin(actor->spr.ang - 512), 30);
int z = actor->spr.pos.Z;
int x = actor->int_pos().X + MulScale(nDist, Cos(actor->spr.ang - 512), 30);
int y = actor->int_pos().Y + MulScale(nDist, Sin(actor->spr.ang - 512), 30);
int z = actor->int_pos().Z;
auto pFX = gFX.fxSpawnActor(FX_7, actor->sector(), x, y, z, 0);
if (pFX)
{
@ -298,7 +298,7 @@ void Respawn(DBloodActor* actor, sectortype*) // 9
if (actor->IsDudeActor())
{
int nType = actor->spr.type - kDudeBase;
actor->spr.pos = actor->basePoint;
actor->int_pos() = actor->basePoint;
actor->spr.cstat |= CSTAT_SPRITE_BLOOD_BIT1 | CSTAT_SPRITE_BLOCK_ALL;
#ifdef NOONE_EXTENSIONS
if (!gModernMap || actor->xspr.sysData2 <= 0) actor->xspr.health = dudeInfo[actor->spr.type - kDudeBase].startHealth << 4;
@ -334,7 +334,7 @@ void Respawn(DBloodActor* actor, sectortype*) // 9
actor->spr.cstat &= ~CSTAT_SPRITE_INVISIBLE;
}
gFX.fxSpawnActor(FX_29, actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, 0);
gFX.fxSpawnActor(FX_29, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0);
sfxPlay3DSound(actor, 350, -1, 0);
break;
}
@ -361,8 +361,8 @@ void PlayerBubble(DBloodActor* actor, sectortype*) // 10
{
int nDist = (actor->spr.xrepeat * (tileWidth(actor->spr.picnum) / 2)) >> 2;
int nAngle = Random(2048);
int x = actor->spr.pos.X + MulScale(nDist, Cos(nAngle), 30);
int y = actor->spr.pos.Y + MulScale(nDist, Sin(nAngle), 30);
int x = actor->int_pos().X + MulScale(nDist, Cos(nAngle), 30);
int y = actor->int_pos().Y + MulScale(nDist, Sin(nAngle), 30);
int z = bottom - Random(bottom - top);
auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23 + Random(3)), actor->sector(), x, y, z, 0);
if (pFX)
@ -391,8 +391,8 @@ void EnemyBubble(DBloodActor* actor, sectortype*) // 11
{
int nDist = (actor->spr.xrepeat * (tileWidth(actor->spr.picnum) / 2)) >> 2;
int nAngle = Random(2048);
int x = actor->spr.pos.X + MulScale(nDist, Cos(nAngle), 30);
int y = actor->spr.pos.Y + MulScale(nDist, Sin(nAngle), 30);
int x = actor->int_pos().X + MulScale(nDist, Cos(nAngle), 30);
int y = actor->int_pos().Y + MulScale(nDist, Sin(nAngle), 30);
int z = bottom - Random(bottom - top);
auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23 + Random(3)), actor->sector(), x, y, z, 0);
if (pFX)
@ -464,9 +464,9 @@ void fxBloodBits(DBloodActor* actor, sectortype*) // 14
actor->add_int_z(floorZ - bottom);
int nAngle = Random(2048);
int nDist = Random(16) << 4;
int x = actor->spr.pos.X + MulScale(nDist, Cos(nAngle), 28);
int y = actor->spr.pos.Y + MulScale(nDist, Sin(nAngle), 28);
gFX.fxSpawnActor(FX_48, actor->sector(), x, y, actor->spr.pos.Z, 0);
int x = actor->int_pos().X + MulScale(nDist, Cos(nAngle), 28);
int y = actor->int_pos().Y + MulScale(nDist, Sin(nAngle), 28);
gFX.fxSpawnActor(FX_48, actor->sector(), x, y, actor->int_pos().Z, 0);
if (actor->spr.ang == 1024)
{
int nChannel = 28 + (actor->GetIndex() & 2); // this is a little stupid...
@ -491,7 +491,7 @@ void fxBloodBits(DBloodActor* actor, sectortype*) // 14
void fxTeslaAlt(DBloodActor* actor, sectortype*) // 15
{
if (!actor) return;
auto pFX = gFX.fxSpawnActor(FX_49, actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, 0);
auto pFX = gFX.fxSpawnActor(FX_49, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0);
if (pFX)
{
pFX->vel.X = actor->vel.X + Random2(0x1aaaa);
@ -620,9 +620,9 @@ void fxPodBloodSpray(DBloodActor* actor, sectortype*) // 18
if (!actor) return;
DBloodActor* pFX;
if (actor->spr.type == 53)
pFX = gFX.fxSpawnActor(FX_53, actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, 0);
pFX = gFX.fxSpawnActor(FX_53, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0);
else
pFX = gFX.fxSpawnActor(FX_54, actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, 0);
pFX = gFX.fxSpawnActor(FX_54, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0);
if (pFX)
{
pFX->spr.ang = 0;
@ -651,8 +651,8 @@ void fxPodBloodSplat(DBloodActor* actor, sectortype*) // 19
actor->add_int_z(floorZ - bottom);
int nAngle = Random(2048);
int nDist = Random(16) << 4;
int x = actor->spr.pos.X + MulScale(nDist, Cos(nAngle), 28);
int y = actor->spr.pos.Y + MulScale(nDist, Sin(nAngle), 28);
int x = actor->int_pos().X + MulScale(nDist, Cos(nAngle), 28);
int y = actor->int_pos().Y + MulScale(nDist, Sin(nAngle), 28);
if (actor->spr.ang == 1024 && actor->spr.type == 53)
{
int nChannel = 28 + (actor->GetIndex() & 2);
@ -708,7 +708,7 @@ void sub_76A08(DBloodActor* actor, DBloodActor* actor2, PLAYER* pPlayer) // ???
{
int top, bottom;
GetActorExtents(actor, &top, &bottom);
actor->set_int_pos({ actor2->spr.pos.X, actor2->spr.pos.Y, actor2->sector()->floorz - (bottom - actor->spr.pos.Z) });
actor->set_int_pos({ actor2->int_pos().X, actor2->int_pos().Y, actor2->sector()->floorz - (bottom - actor->int_pos().Z) });
actor->spr.ang = actor2->spr.ang;
ChangeActorSect(actor, actor2->sector());
sfxPlay3DSound(actor2, 201, -1, 0);
@ -746,7 +746,7 @@ void DropVoodooCb(DBloodActor* actor, sectortype*) // unused
evPostActor(actor, 0, kCallbackRemove);
return;
}
actor->spr.ang = getangle(Owner->spr.pos.X - actor->spr.pos.X, Owner->spr.pos.Y - actor->spr.pos.Y);
actor->spr.ang = getangle(Owner->int_pos().X - actor->int_pos().X, Owner->int_pos().Y - actor->int_pos().Y);
if (actor->hasX())
{
if (actor->xspr.data1 == 0)

View file

@ -210,15 +210,15 @@ void CFX::fxProcess(void)
actAirDrag(actor, pFXData->drag);
actor->add_int_pos({ actor->vel.X >> 12, actor->vel.Y >> 12, actor->vel.Z >> 8 });
// Weird...
if (actor->vel.X || (actor->vel.Y && actor->spr.pos.Z >= actor->sector()->floorz))
if (actor->vel.X || (actor->vel.Y && actor->int_pos().Z >= actor->sector()->floorz))
{
updatesector(actor->spr.pos.X, actor->spr.pos.Y, &pSector);
updatesector(actor->int_pos().X, actor->int_pos().Y, &pSector);
if (pSector == nullptr)
{
remove(actor);
continue;
}
if (getflorzofslopeptr(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y) <= actor->spr.pos.Z)
if (getflorzofslopeptr(actor->sector(), actor->int_pos().X, actor->int_pos().Y) <= actor->int_pos().Z)
{
if (pFXData->funcID < 0 || pFXData->funcID >= kCallbackMax)
{
@ -237,13 +237,13 @@ void CFX::fxProcess(void)
if (actor->vel.X || actor->vel.Y || actor->vel.Z)
{
int32_t floorZ, ceilZ;
getzsofslopeptr(pSector, actor->spr.pos.X, actor->spr.pos.Y, &ceilZ, &floorZ);
if (ceilZ > actor->spr.pos.Z && !(pSector->ceilingstat & CSTAT_SECTOR_SKY))
getzsofslopeptr(pSector, actor->int_pos().X, actor->int_pos().Y, &ceilZ, &floorZ);
if (ceilZ > actor->int_pos().Z && !(pSector->ceilingstat & CSTAT_SECTOR_SKY))
{
remove(actor);
continue;
}
if (floorZ < actor->spr.pos.Z)
if (floorZ < actor->int_pos().Z)
{
if (pFXData->funcID < 0 || pFXData->funcID >= kCallbackMax)
{
@ -269,11 +269,11 @@ void fxSpawnBlood(DBloodActor* actor, int)
if (!actor->insector())
return;
auto pSector = actor->sector();
if (!FindSector(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, &pSector))
if (!FindSector(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, &pSector))
return;
if (adult_lockout && gGameOptions.nGameType <= 0)
return;
auto bloodactor = gFX.fxSpawnActor(FX_27, actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, 0);
auto bloodactor = gFX.fxSpawnActor(FX_27, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0);
if (bloodactor)
{
bloodactor->spr.ang = 1024;
@ -295,15 +295,15 @@ void fxSpawnPodStuff(DBloodActor* actor, int)
if (!actor->insector())
return;
auto pSector = actor->sector();
if (!FindSector(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, &pSector))
if (!FindSector(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, &pSector))
return;
if (adult_lockout && gGameOptions.nGameType <= 0)
return;
DBloodActor* spawnactor;
if (actor->spr.type == kDudePodGreen)
spawnactor = gFX.fxSpawnActor(FX_53, actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, 0);
spawnactor = gFX.fxSpawnActor(FX_53, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0);
else
spawnactor = gFX.fxSpawnActor(FX_54, actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, 0);
spawnactor = gFX.fxSpawnActor(FX_54, actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, 0);
if (spawnactor)
{
spawnactor->spr.ang = 1024;
@ -322,8 +322,8 @@ void fxSpawnPodStuff(DBloodActor* actor, int)
void fxSpawnEjectingBrass(DBloodActor* actor, int z, int a3, int a4)
{
int x = actor->spr.pos.X + MulScale(actor->spr.clipdist - 4, Cos(actor->spr.ang), 28);
int y = actor->spr.pos.Y + MulScale(actor->spr.clipdist - 4, Sin(actor->spr.ang), 28);
int x = actor->int_pos().X + MulScale(actor->spr.clipdist - 4, Cos(actor->spr.ang), 28);
int y = actor->int_pos().Y + MulScale(actor->spr.clipdist - 4, Sin(actor->spr.ang), 28);
x += MulScale(a3, Cos(actor->spr.ang + 512), 30);
y += MulScale(a3, Sin(actor->spr.ang + 512), 30);
auto pBrass = gFX.fxSpawnActor((FX_ID)(FX_37 + Random(3)), actor->sector(), x, y, z, 0);
@ -347,8 +347,8 @@ void fxSpawnEjectingBrass(DBloodActor* actor, int z, int a3, int a4)
void fxSpawnEjectingShell(DBloodActor* actor, int z, int a3, int a4)
{
int x = actor->spr.pos.X + MulScale(actor->spr.clipdist - 4, Cos(actor->spr.ang), 28);
int y = actor->spr.pos.Y + MulScale(actor->spr.clipdist - 4, Sin(actor->spr.ang), 28);
int x = actor->int_pos().X + MulScale(actor->spr.clipdist - 4, Cos(actor->spr.ang), 28);
int y = actor->int_pos().Y + MulScale(actor->spr.clipdist - 4, Sin(actor->spr.ang), 28);
x += MulScale(a3, Cos(actor->spr.ang + 512), 30);
y += MulScale(a3, Sin(actor->spr.ang + 512), 30);
auto pShell = gFX.fxSpawnActor((FX_ID)(FX_40 + Random(3)), actor->sector(), x, y, z, 0);

View file

@ -123,24 +123,24 @@ bool FindSector(int nX, int nY, sectortype** pSector)
bool CheckProximity(DBloodActor* actor, int nX, int nY, int nZ, sectortype* pSector, int nDist)
{
assert(actor != nullptr);
int oX = abs(nX - actor->spr.pos.X) >> 4;
int oX = abs(nX - actor->int_pos().X) >> 4;
if (oX >= nDist) return 0;
int oY = abs(nY - actor->spr.pos.Y) >> 4;
int oY = abs(nY - actor->int_pos().Y) >> 4;
if (oY >= nDist) return 0;
int oZ = abs(nZ - actor->spr.pos.Z) >> 8;
int oZ = abs(nZ - actor->int_pos().Z) >> 8;
if (oZ >= nDist) return 0;
if (approxDist(oX, oY) >= nDist) return 0;
int bottom, top;
GetActorExtents(actor, &top, &bottom);
if (cansee(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, actor->sector(), nX, nY, nZ, pSector))
if (cansee(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->sector(), nX, nY, nZ, pSector))
return 1;
if (cansee(actor->spr.pos.X, actor->spr.pos.Y, bottom, actor->sector(), nX, nY, nZ, pSector))
if (cansee(actor->int_pos().X, actor->int_pos().Y, bottom, actor->sector(), nX, nY, nZ, pSector))
return 1;
if (cansee(actor->spr.pos.X, actor->spr.pos.Y, top, actor->sector(), nX, nY, nZ, pSector))
if (cansee(actor->int_pos().X, actor->int_pos().Y, top, actor->sector(), nX, nY, nZ, pSector))
return 1;
return 0;
}
@ -387,8 +387,8 @@ int HitScan(DBloodActor* actor, int z, int dx, int dy, int dz, unsigned int nMas
assert(actor != nullptr);
assert(dx != 0 || dy != 0);
gHitInfo.clearObj();
int x = actor->spr.pos.X;
int y = actor->spr.pos.Y;
int x = actor->int_pos().X;
int y = actor->int_pos().Y;
auto bakCstat = actor->spr.cstat;
actor->spr.cstat &= ~CSTAT_SPRITE_BLOCK_HITSCAN;
if (nRange)
@ -435,9 +435,9 @@ int VectorScan(DBloodActor* actor, int nOffset, int nZOffset, int dx, int dy, in
int nNum = 256;
gHitInfo.clearObj();
int x1 = actor->spr.pos.X + MulScale(nOffset, Cos(actor->spr.ang + 512), 30);
int y1 = actor->spr.pos.Y + MulScale(nOffset, Sin(actor->spr.ang + 512), 30);
int z1 = actor->spr.pos.Z + nZOffset;
int x1 = actor->int_pos().X + MulScale(nOffset, Cos(actor->spr.ang + 512), 30);
int y1 = actor->int_pos().Y + MulScale(nOffset, Sin(actor->spr.ang + 512), 30);
int z1 = actor->int_pos().Z + nZOffset;
auto bakCstat = actor->spr.cstat;
actor->spr.cstat &= ~CSTAT_SPRITE_BLOCK_HITSCAN;
if (nRange)
@ -456,7 +456,7 @@ int VectorScan(DBloodActor* actor, int nOffset, int nZOffset, int dx, int dy, in
actor->spr.cstat = bakCstat;
while (nNum--)
{
if (nRange && approxDist(gHitInfo.hitpos.X - actor->spr.pos.X, gHitInfo.hitpos.Y - actor->spr.pos.Y) > nRange)
if (nRange && approxDist(gHitInfo.hitpos.X - actor->int_pos().X, gHitInfo.hitpos.Y - actor->int_pos().Y) > nRange)
return -1;
auto other = gHitInfo.actor();
if (other != nullptr)
@ -469,7 +469,7 @@ int VectorScan(DBloodActor* actor, int nOffset, int nZOffset, int dx, int dy, in
if (tileWidth(nPicnum) == 0 || tileHeight(nPicnum) == 0)
return 3;
int height = (tileHeight(nPicnum) * other->spr.yrepeat) << 2;
int otherZ = other->spr.pos.Z;
int otherZ = other->int_pos().Z;
if (other->spr.cstat & CSTAT_SPRITE_YCENTER)
otherZ += height / 2;
int nTopOfs = tileTopOffset(nPicnum);
@ -483,7 +483,7 @@ int VectorScan(DBloodActor* actor, int nOffset, int nZOffset, int dx, int dy, in
{
int width = (tileWidth(nPicnum) * other->spr.xrepeat) >> 2;
width = (width * 3) / 4;
int check1 = ((y1 - other->spr.pos.Y) * dx - (x1 - other->spr.pos.X) * dy) / ksqrt(dx * dx + dy * dy);
int check1 = ((y1 - other->int_pos().Y) * dx - (x1 - other->int_pos().X) * dy) / ksqrt(dx * dx + dy * dy);
assert(width > 0);
int width2 = Scale(check1, tileWidth(nPicnum), width);
int nLeftOfs = tileLeftOffset(nPicnum);
@ -577,9 +577,9 @@ int VectorScan(DBloodActor* actor, int nOffset, int nZOffset, int dx, int dy, in
if (!upper) return 2;
auto link = upper->GetOwner();
gHitInfo.clearObj();
x1 = gHitInfo.hitpos.X + link->spr.pos.X - upper->spr.pos.X;
y1 = gHitInfo.hitpos.Y + link->spr.pos.Y - upper->spr.pos.Y;
z1 = gHitInfo.hitpos.Z + link->spr.pos.Z - upper->spr.pos.Z;
x1 = gHitInfo.hitpos.X + link->int_pos().X - upper->int_pos().X;
y1 = gHitInfo.hitpos.Y + link->int_pos().Y - upper->int_pos().Y;
z1 = gHitInfo.hitpos.Z + link->int_pos().Z - upper->int_pos().Z;
pos = { x1, y1, z1 };
hitscan(pos, link->sector(), { dx, dy, dz << 4 }, gHitInfo, CLIPMASK1);
@ -591,9 +591,9 @@ int VectorScan(DBloodActor* actor, int nOffset, int nZOffset, int dx, int dy, in
if (!lower) return 1;
auto link = lower->GetOwner();
gHitInfo.clearObj();
x1 = gHitInfo.hitpos.X + link->spr.pos.X - lower->spr.pos.X;
y1 = gHitInfo.hitpos.Y + link->spr.pos.Y - lower->spr.pos.Y;
z1 = gHitInfo.hitpos.Z + link->spr.pos.Z - lower->spr.pos.Z;
x1 = gHitInfo.hitpos.X + link->int_pos().X - lower->int_pos().X;
y1 = gHitInfo.hitpos.Y + link->int_pos().Y - lower->int_pos().Y;
z1 = gHitInfo.hitpos.Z + link->int_pos().Z - lower->int_pos().Z;
pos = { x1, y1, z1 };
hitscan(pos, link->sector(), { dx, dy, dz << 4 }, gHitInfo, CLIPMASK1);
continue;
@ -618,7 +618,7 @@ void GetZRange(DBloodActor* actor, int* ceilZ, Collision* ceilColl, int* floorZ,
auto bakCstat = actor->spr.cstat;
int32_t nTemp1;
actor->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
getzrange(actor->spr.pos, actor->sector(), (int32_t*)ceilZ, *ceilColl, (int32_t*)floorZ, *floorColl, nDist, nMask);
getzrange(actor->int_pos(), actor->sector(), (int32_t*)ceilZ, *ceilColl, (int32_t*)floorZ, *floorColl, nDist, nMask);
if (floorColl->type == kHitSector)
{
auto pSector = floorColl->hitSector;
@ -633,9 +633,9 @@ void GetZRange(DBloodActor* actor, int* ceilZ, Collision* ceilColl, int* floorZ,
if (linkActor)
{
auto linkOwner = linkActor->GetOwner();
vec3_t lpos = actor->spr.pos + linkOwner->spr.pos - linkActor->spr.pos;
vec3_t lpos = actor->int_pos() + linkOwner->int_pos() - linkActor->int_pos();
getzrange(lpos, linkOwner->sector(), &nTemp1, scratch, (int32_t*)floorZ, *floorColl, nDist, nMask);
*floorZ -= linkOwner->spr.pos.Z - linkActor->spr.pos.Z;
*floorZ -= linkOwner->int_pos().Z - linkActor->int_pos().Z;
}
}
if (ceilColl->type == kHitSector)
@ -647,9 +647,9 @@ void GetZRange(DBloodActor* actor, int* ceilZ, Collision* ceilColl, int* floorZ,
if (linkActor)
{
auto linkOwner = linkActor->GetOwner();
vec3_t lpos = actor->spr.pos + linkOwner->spr.pos - linkActor->spr.pos;
vec3_t lpos = actor->int_pos() + linkOwner->int_pos() - linkActor->int_pos();
getzrange(lpos, linkOwner->sector(), (int32_t*)ceilZ, *ceilColl, &nTemp1, scratch, nDist, nMask);
*ceilZ -= linkOwner->spr.pos.Z - linkActor->spr.pos.Z;
*ceilZ -= linkOwner->int_pos().Z - linkActor->int_pos().Z;
}
}
actor->spr.cstat = bakCstat;
@ -681,9 +681,9 @@ void GetZRangeAtXYZ(int x, int y, int z, sectortype* pSector, int* ceilZ, Collis
if (actor)
{
auto link = actor->GetOwner();
vec3_t newpos = lpos + link->spr.pos - actor->spr.pos;
vec3_t newpos = lpos + link->int_pos() - actor->int_pos();
getzrange(newpos, link->sector(), &nTemp1, scratch, (int32_t*)floorZ, *floorColl, nDist, nMask);
*floorZ -= link->spr.pos.Z - actor->spr.pos.Z;
*floorZ -= link->int_pos().Z - actor->int_pos().Z;
}
}
if (ceilColl->type == kHitSector)
@ -695,9 +695,9 @@ void GetZRangeAtXYZ(int x, int y, int z, sectortype* pSector, int* ceilZ, Collis
if (actor)
{
auto link = actor->GetOwner();
vec3_t newpos = lpos + link->spr.pos - actor->spr.pos;
vec3_t newpos = lpos + link->int_pos() - actor->int_pos();
getzrange(newpos, link->sector(), (int32_t*)ceilZ, *ceilColl, &nTemp1, scratch, nDist, nMask);
*ceilZ -= link->spr.pos.Z - actor->spr.pos.Z;
*ceilZ -= link->int_pos().Z - actor->int_pos().Z;
}
}
}

View file

@ -274,7 +274,7 @@ void GibFX(DBloodActor* actor, GIBFX* pGFX, CGibPosition* pPos, CGibVelocity* pV
auto pSector = actor->sector();
if (adult_lockout && gGameOptions.nGameType == 0 && pGFX->fxId == FX_13)
return;
CGibPosition gPos(actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z);
CGibPosition gPos(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z);
if (pPos)
gPos = *pPos;
int32_t ceilZ, floorZ;
@ -289,8 +289,8 @@ void GibFX(DBloodActor* actor, GIBFX* pGFX, CGibPosition* pPos, CGibVelocity* pV
if (!pPos && (actor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == 0)
{
int nAngle = Random(2048);
gPos.x = actor->spr.pos.X + MulScale(actor->spr.clipdist << 2, Cos(nAngle), 30);
gPos.y = actor->spr.pos.Y + MulScale(actor->spr.clipdist << 2, Sin(nAngle), 30);
gPos.x = actor->int_pos().X + MulScale(actor->spr.clipdist << 2, Cos(nAngle), 30);
gPos.y = actor->int_pos().Y + MulScale(actor->spr.clipdist << 2, Sin(nAngle), 30);
gPos.z = bottom - Random(bottom - top);
}
auto pFX = gFX.fxSpawnActor(pGFX->fxId, pSector, gPos.x, gPos.y, gPos.z, 0);
@ -360,8 +360,8 @@ void GibThing(DBloodActor* actor, GIBTHING* pGThing, CGibPosition* pPos, CGibVel
if (!pPos)
{
int nAngle = Random(2048);
x = actor->spr.pos.X + MulScale(actor->spr.clipdist << 2, Cos(nAngle), 30);
y = actor->spr.pos.Y + MulScale(actor->spr.clipdist << 2, Sin(nAngle), 30);
x = actor->int_pos().X + MulScale(actor->spr.clipdist << 2, Cos(nAngle), 30);
y = actor->int_pos().Y + MulScale(actor->spr.clipdist << 2, Sin(nAngle), 30);
z = bottom - Random(bottom - top);
}
else