mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-13 20:42:11 +00:00
- handle all non- "pSprite = actor->s();" calls of s() in Blood AI code.
This commit is contained in:
parent
bff3bbea73
commit
612167cbf1
6 changed files with 52 additions and 58 deletions
|
@ -79,9 +79,9 @@ void SlashSeqCallback(int, DBloodActor* actor)
|
|||
sfxPlay3DSound(actor, 9012 + Random(2), -1, 0);
|
||||
}
|
||||
|
||||
void StompSeqCallback(int, DBloodActor* actor1)
|
||||
void StompSeqCallback(int, DBloodActor* actor)
|
||||
{
|
||||
spritetype* pSprite = &actor1->s();
|
||||
spritetype* pSprite = &actor->s();
|
||||
int dx = bcos(pSprite->ang);
|
||||
int dy = bsin(pSprite->ang);
|
||||
int x = pSprite->pos.X;
|
||||
|
@ -93,7 +93,7 @@ void StompSeqCallback(int, DBloodActor* actor1)
|
|||
int v10 = 25 + 30 * gGameOptions.nDifficulty;
|
||||
const bool newSectCheckMethod = !cl_bloodvanillaenemies && !VanillaMode(); // use new sector checking logic
|
||||
auto sectorMap = GetClosestSpriteSectors(pSector, x, y, vc, nullptr, newSectCheckMethod);
|
||||
int hit = HitScan(actor1, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
|
||||
int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
|
||||
DBloodActor* actor2 = nullptr;
|
||||
actHitcodeToData(hit, &gHitInfo, &actor2);
|
||||
|
||||
|
@ -101,7 +101,7 @@ void StompSeqCallback(int, DBloodActor* actor1)
|
|||
BloodStatIterator it1(kStatDude);
|
||||
while (auto actor2 = it1.Next())
|
||||
{
|
||||
if (actor1 != actor2)
|
||||
if (actor != actor2)
|
||||
{
|
||||
spritetype* pSprite2 = &actor2->s();
|
||||
if (actor2->hasX())
|
||||
|
@ -113,7 +113,7 @@ void StompSeqCallback(int, DBloodActor* actor1)
|
|||
if (CheckSector(sectorMap, actor2) && CheckProximity(actor2, x, y, z, pSector, vc))
|
||||
{
|
||||
int top, bottom;
|
||||
GetActorExtents(actor1, &top, &bottom);
|
||||
GetActorExtents(actor, &top, &bottom);
|
||||
if (abs(bottom - pSector->floorz) == 0)
|
||||
{
|
||||
int dx = abs(pSprite->pos.X - pSprite2->pos.X);
|
||||
|
@ -128,7 +128,7 @@ void StompSeqCallback(int, DBloodActor* actor1)
|
|||
nDamage = v1c + ((vc - nDist2) * v10) / vc;
|
||||
if (IsPlayerSprite(pSprite2))
|
||||
gPlayer[pSprite2->type - kDudePlayer1].quakeEffect += nDamage * 4;
|
||||
actDamageSprite(actor1, actor2, kDamageFall, nDamage << 4);
|
||||
actDamageSprite(actor, actor2, kDamageFall, nDamage << 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -158,11 +158,11 @@ void StompSeqCallback(int, DBloodActor* actor1)
|
|||
nDamage = v1c + ((vc - nDist2) * v10) / vc;
|
||||
if (IsPlayerSprite(pSprite2))
|
||||
gPlayer[pSprite2->type - kDudePlayer1].quakeEffect += nDamage * 4;
|
||||
actDamageSprite(actor1, actor2, kDamageFall, nDamage << 4);
|
||||
actDamageSprite(actor, actor2, kDamageFall, nDamage << 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
sfxPlay3DSound(actor1, 9015 + Random(2), -1, 0);
|
||||
sfxPlay3DSound(actor, 9015 + Random(2), -1, 0);
|
||||
}
|
||||
|
||||
static void MorphToBeast(DBloodActor* actor)
|
||||
|
|
|
@ -93,11 +93,11 @@ void cerberusBurnSeqCallback(int, DBloodActor* actor)
|
|||
while (auto actor2 = it.Next())
|
||||
{
|
||||
spritetype* pSprite2 = &actor2->s();
|
||||
if (pSprite == pSprite2 || !(pSprite2->flags & 8))
|
||||
if (pSprite == pSprite2 || !(actor2->spr.flags & 8))
|
||||
continue;
|
||||
int x2 = pSprite2->pos.X;
|
||||
int y2 = pSprite2->pos.Y;
|
||||
int z2 = pSprite2->pos.Z;
|
||||
int x2 = actor2->spr.pos.X;
|
||||
int y2 = actor2->spr.pos.Y;
|
||||
int z2 = actor2->spr.pos.Z;
|
||||
int nDist = approxDist(x2 - x, y2 - y);
|
||||
if (nDist == 0 || nDist > 0x2800)
|
||||
continue;
|
||||
|
@ -126,8 +126,8 @@ void cerberusBurnSeqCallback(int, DBloodActor* actor)
|
|||
int nDeltaAngle = ((nAngle - pSprite->ang + 1024) & 2047) - 1024;
|
||||
if (abs(nDeltaAngle) <= tt1.at8)
|
||||
{
|
||||
int tz = pSprite2->pos.Z - pSprite->pos.Z;
|
||||
if (cansee(x, y, z, pSprite->sector(), x2, y2, z2, pSprite2->sector()))
|
||||
int tz = actor2->spr.pos.Z - pSprite->pos.Z;
|
||||
if (cansee(x, y, z, pSprite->sector(), x2, y2, z2, actor2->spr.sector()))
|
||||
{
|
||||
nClosest = nDist2;
|
||||
aim.dx = bcos(nAngle);
|
||||
|
@ -171,12 +171,11 @@ void cerberusBurnSeqCallback2(int, DBloodActor* actor)
|
|||
BloodStatIterator it(kStatDude);
|
||||
while (auto actor2 = it.Next())
|
||||
{
|
||||
spritetype* pSprite2 = &actor2->s();
|
||||
if (pSprite == pSprite2 || !(pSprite2->flags & 8))
|
||||
if (actor == actor2 || !(actor2->spr.flags & 8))
|
||||
continue;
|
||||
int x2 = pSprite2->pos.X;
|
||||
int y2 = pSprite2->pos.Y;
|
||||
int z2 = pSprite2->pos.Z;
|
||||
int x2 = actor2->spr.pos.X;
|
||||
int y2 = actor2->spr.pos.Y;
|
||||
int z2 = actor2->spr.pos.Z;
|
||||
int nDist = approxDist(x2 - x, y2 - y);
|
||||
if (nDist == 0 || nDist > 0x2800)
|
||||
continue;
|
||||
|
@ -205,10 +204,10 @@ void cerberusBurnSeqCallback2(int, DBloodActor* actor)
|
|||
int nDeltaAngle = ((nAngle - pSprite->ang + 1024) & 2047) - 1024;
|
||||
if (abs(nDeltaAngle) <= tt1.at8)
|
||||
{
|
||||
DUDEINFO* pDudeInfo2 = getDudeInfo(pSprite2->type);
|
||||
int height = (pDudeInfo2->aimHeight * pSprite2->yrepeat) << 2;
|
||||
DUDEINFO* pDudeInfo2 = getDudeInfo(actor2->spr.type);
|
||||
int height = (pDudeInfo2->aimHeight * actor2->spr.yrepeat) << 2;
|
||||
int tz = (z2 - height) - z;
|
||||
if (cansee(x, y, z, pSprite->sector(), x2, y2, z2, pSprite2->sector()))
|
||||
if (cansee(x, y, z, pSprite->sector(), x2, y2, z2, actor2->spr.sector()))
|
||||
{
|
||||
nClosest = nDist2;
|
||||
aim.dx = bcos(nAngle);
|
||||
|
|
|
@ -121,12 +121,11 @@ void BlastSSeqCallback(int, DBloodActor* actor)
|
|||
BloodStatIterator it(kStatDude);
|
||||
while (auto actor2 = it.Next())
|
||||
{
|
||||
spritetype* pSprite2 = &actor2->s();
|
||||
if (pSprite == pSprite2 || !(pSprite2->flags & 8))
|
||||
if (actor == actor2 || !(actor2->spr.flags & 8))
|
||||
continue;
|
||||
int x2 = pSprite2->pos.X;
|
||||
int y2 = pSprite2->pos.Y;
|
||||
int z2 = pSprite2->pos.Z;
|
||||
int x2 = actor2->spr.pos.X;
|
||||
int y2 = actor2->spr.pos.Y;
|
||||
int z2 = actor2->spr.pos.Z;
|
||||
int nDist = approxDist(x2 - x, y2 - y);
|
||||
if (nDist == 0 || nDist > 0x2800)
|
||||
continue;
|
||||
|
@ -155,8 +154,8 @@ void BlastSSeqCallback(int, DBloodActor* actor)
|
|||
int nDeltaAngle = ((nAngle - pSprite->ang + 1024) & 2047) - 1024;
|
||||
if (abs(nDeltaAngle) <= tt.at8)
|
||||
{
|
||||
int tz = pSprite2->pos.Z - pSprite->pos.Z;
|
||||
if (cansee(x, y, z, pSprite->sector(), x2, y2, z2, pSprite2->sector()))
|
||||
int tz = actor2->spr.pos.Z - pSprite->pos.Z;
|
||||
if (cansee(x, y, z, pSprite->sector(), x2, y2, z2, actor2->spr.sector()))
|
||||
{
|
||||
nClosest = nDist2;
|
||||
aim.dx = bcos(nAngle);
|
||||
|
|
|
@ -107,12 +107,11 @@ void ghostBlastSeqCallback(int, DBloodActor* actor)
|
|||
BloodStatIterator it(kStatDude);
|
||||
while (auto actor2 = it.Next())
|
||||
{
|
||||
spritetype* pSprite2 = &actor2->s();
|
||||
if (pSprite == pSprite2 || !(pSprite2->flags & 8))
|
||||
if (actor == actor2 || !(actor2->spr.flags & 8))
|
||||
continue;
|
||||
int x2 = pSprite2->pos.X;
|
||||
int y2 = pSprite2->pos.Y;
|
||||
int z2 = pSprite2->pos.Z;
|
||||
int x2 = actor2->spr.pos.X;
|
||||
int y2 = actor2->spr.pos.Y;
|
||||
int z2 = actor2->spr.pos.Z;
|
||||
int nDist = approxDist(x2 - x, y2 - y);
|
||||
if (nDist == 0 || nDist > 0x2800)
|
||||
continue;
|
||||
|
@ -128,7 +127,7 @@ void ghostBlastSeqCallback(int, DBloodActor* actor)
|
|||
int tz = z + MulScale(actor->dudeSlope, nDist, 10);
|
||||
int tsr = MulScale(9460, nDist, 10);
|
||||
int top, bottom;
|
||||
GetSpriteExtents(pSprite2, &top, &bottom);
|
||||
GetActorExtents(actor2, &top, &bottom);
|
||||
if (tz - tsr > bottom || tz + tsr < top)
|
||||
continue;
|
||||
int dx = (tx - x2) >> 4;
|
||||
|
@ -141,8 +140,8 @@ void ghostBlastSeqCallback(int, DBloodActor* actor)
|
|||
int nDeltaAngle = ((nAngle - pSprite->ang + 1024) & 2047) - 1024;
|
||||
if (abs(nDeltaAngle) <= tt.at8)
|
||||
{
|
||||
int tz = pSprite2->pos.Z - pSprite->pos.Z;
|
||||
if (cansee(x, y, z, pSprite->sector(), x2, y2, z2, pSprite2->sector()))
|
||||
int tz = actor2->spr.pos.Z - pSprite->pos.Z;
|
||||
if (cansee(x, y, z, pSprite->sector(), x2, y2, z2, actor2->spr.sector()))
|
||||
{
|
||||
nClosest = nDist2;
|
||||
aim.dx = bcos(nAngle);
|
||||
|
|
|
@ -43,14 +43,14 @@ AISTATE spidBite = { kAiStateChase, 6, nSpidBiteClient, 60, NULL, NULL, NULL, &s
|
|||
AISTATE spidJump = { kAiStateChase, 8, nSpidJumpClient, 60, NULL, aiMoveForward, NULL, &spidChase };
|
||||
AISTATE spidBirth = { kAiStateOther, 0, nSpidBirthClient, 60, NULL, NULL, NULL, &spidIdle };
|
||||
|
||||
static void spidBlindEffect(DBloodActor* dudeactor, int nBlind, int max)
|
||||
static void spidBlindEffect(DBloodActor* actor, int nBlind, int max)
|
||||
{
|
||||
spritetype* pDude = &dudeactor->s();
|
||||
if (IsPlayerSprite(pDude))
|
||||
spritetype* pSprite = &actor->s();
|
||||
if (actor->IsPlayerActor())
|
||||
{
|
||||
nBlind <<= 4;
|
||||
max <<= 4;
|
||||
PLAYER* pPlayer = &gPlayer[pDude->type - kDudePlayer1];
|
||||
PLAYER* pPlayer = &gPlayer[pSprite->type - kDudePlayer1];
|
||||
if (pPlayer->blindEffect < max)
|
||||
{
|
||||
pPlayer->blindEffect = ClipHigh(pPlayer->blindEffect + nBlind, max);
|
||||
|
@ -70,7 +70,6 @@ void SpidBiteSeqCallback(int, DBloodActor* actor)
|
|||
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||
|
||||
auto const target = actor->GetTarget();
|
||||
spritetype* pTarget = &target->s();
|
||||
if (target->IsPlayerActor())
|
||||
{
|
||||
int hit = HitScan(actor, pSprite->pos.Z, dx, dy, 0, CLIPMASK1, 0);
|
||||
|
|
|
@ -74,12 +74,11 @@ void sub_71BD4(int, DBloodActor* actor)
|
|||
BloodStatIterator it(kStatDude);
|
||||
while (auto actor2 = it.Next())
|
||||
{
|
||||
spritetype* pSprite2 = &actor2->s();
|
||||
if (pSprite == pSprite2 || !(pSprite2->flags & 8))
|
||||
if (actor == actor2 || !(actor2->spr.flags & 8))
|
||||
continue;
|
||||
int x2 = pSprite2->pos.X;
|
||||
int y2 = pSprite2->pos.Y;
|
||||
int z2 = pSprite2->pos.Z;
|
||||
int x2 = actor2->spr.pos.X;
|
||||
int y2 = actor2->spr.pos.Y;
|
||||
int z2 = actor2->spr.pos.Z;
|
||||
int nDist = approxDist(x2 - x, y2 - y);
|
||||
if (nDist == 0 || nDist > 0x2800)
|
||||
continue;
|
||||
|
@ -95,7 +94,7 @@ void sub_71BD4(int, DBloodActor* actor)
|
|||
int tz = z + MulScale(actor->dudeSlope, nDist, 10);
|
||||
int tsr = MulScale(9460, nDist, 10);
|
||||
int top, bottom;
|
||||
GetSpriteExtents(pSprite2, &top, &bottom);
|
||||
GetActorExtents(actor2, &top, &bottom);
|
||||
if (tz - tsr > bottom || tz + tsr < top)
|
||||
continue;
|
||||
int dx = (tx - x2) >> 4;
|
||||
|
@ -108,8 +107,8 @@ void sub_71BD4(int, DBloodActor* actor)
|
|||
int nDeltaAngle = ((nAngle - pSprite->ang + 1024) & 2047) - 1024;
|
||||
if (abs(nDeltaAngle) <= tt.at8)
|
||||
{
|
||||
int tz = pSprite2->pos.Z - pSprite->pos.Z;
|
||||
if (cansee(x, y, z, pSprite->sector(), x2, y2, z2, pSprite2->sector()))
|
||||
int tz = actor2->spr.pos.Z - pSprite->pos.Z;
|
||||
if (cansee(x, y, z, pSprite->sector(), x2, y2, z2, actor2->spr.sector()))
|
||||
{
|
||||
nClosest = nDist2;
|
||||
aim.dx = bcos(nAngle);
|
||||
|
@ -148,12 +147,11 @@ void sub_720AC(int, DBloodActor* actor)
|
|||
BloodStatIterator it(kStatDude);
|
||||
while (auto actor2 = it.Next())
|
||||
{
|
||||
spritetype* pSprite2 = &actor2->s();
|
||||
if (pSprite == pSprite2 || !(pSprite2->flags & 8))
|
||||
if (actor == actor2 || !(actor2->spr.flags & 8))
|
||||
continue;
|
||||
int x2 = pSprite2->pos.X;
|
||||
int y2 = pSprite2->pos.Y;
|
||||
int z2 = pSprite2->pos.Z;
|
||||
int x2 = actor2->spr.pos.X;
|
||||
int y2 = actor2->spr.pos.Y;
|
||||
int z2 = actor2->spr.pos.Z;
|
||||
int nDist = approxDist(x2 - x, y2 - y);
|
||||
if (nDist == 0 || nDist > 0x2800)
|
||||
continue;
|
||||
|
@ -169,7 +167,7 @@ void sub_720AC(int, DBloodActor* actor)
|
|||
int tz = z + MulScale(actor->dudeSlope, nDist, 10);
|
||||
int tsr = MulScale(9460, nDist, 10);
|
||||
int top, bottom;
|
||||
GetSpriteExtents(pSprite2, &top, &bottom);
|
||||
GetActorExtents(actor2, &top, &bottom);
|
||||
if (tz - tsr > bottom || tz + tsr < top)
|
||||
continue;
|
||||
int dx = (tx - x2) >> 4;
|
||||
|
@ -182,8 +180,8 @@ void sub_720AC(int, DBloodActor* actor)
|
|||
int nDeltaAngle = ((nAngle - pSprite->ang + 1024) & 2047) - 1024;
|
||||
if (abs(nDeltaAngle) <= tt.at8)
|
||||
{
|
||||
int tz = pSprite2->pos.Z - pSprite->pos.Z;
|
||||
if (cansee(x, y, z, pSprite->sector(), x2, y2, z2, pSprite2->sector()))
|
||||
int tz = actor2->spr.pos.Z - pSprite->pos.Z;
|
||||
if (cansee(x, y, z, pSprite->sector(), x2, y2, z2, actor2->spr.sector()))
|
||||
{
|
||||
nClosest = nDist2;
|
||||
aim.dx = bcos(nAngle);
|
||||
|
|
Loading…
Reference in a new issue