- renamed XSPRITE::target to target_i.

This is to make searching for it easier as 'target' is a very common word in the source.
This commit is contained in:
Christoph Oelckers 2021-09-16 00:40:09 +02:00
parent 774a015e6b
commit 7a6629ce6a
32 changed files with 390 additions and 390 deletions

View file

@ -5347,7 +5347,7 @@ int MoveMissile(DBloodActor* actor)
gHitInfo.hitsprite = -1;
if (pSprite->type == kMissileFlameSpray) actAirDrag(actor, 0x1000);
if (pXSprite->target != -1 && (actor->xvel() || actor->yvel() || actor->zvel()))
if (pXSprite->target_i != -1 && (actor->xvel() || actor->yvel() || actor->zvel()))
{
auto target = actor->GetTarget();
spritetype* pTarget = &target->s();
@ -5637,7 +5637,7 @@ void actExplodeSprite(DBloodActor* actor)
pSprite->flags &= ~3;
pSprite->type = nType;
const EXPLOSION* pExplodeInfo = &explodeInfo[nType];
pXSprite->target = 0;
pXSprite->target_i = 0;
pXSprite->data1 = pExplodeInfo->ticks;
pXSprite->data2 = pExplodeInfo->quakeEffect;
pXSprite->data3 = pExplodeInfo->flashEffect;
@ -5710,7 +5710,7 @@ static void actCheckProximity()
continue;
#endif
if (pSprite->type == kThingDroppedLifeLeech) pXSprite->target = -1;
if (pSprite->type == kThingDroppedLifeLeech) pXSprite->target_i = -1;
BloodStatIterator it1(kStatDude);
while (auto dudeactor = it1.Next())
{
@ -5730,7 +5730,7 @@ static void actCheckProximity()
if (pSprite->type == kModernThingEnemyLifeLeech) proxyDist = 512;
#endif
if (pSprite->type == kThingDroppedLifeLeech && pXSprite->target == -1)
if (pSprite->type == kThingDroppedLifeLeech && pXSprite->target_i == -1)
{
auto Owner = actor->GetOwner();
if (!Owner->IsPlayerActor()) continue;
@ -5751,7 +5751,7 @@ static void actCheckProximity()
{
case kThingDroppedLifeLeech:
if (!Chance(0x4000) && nextdude) continue;
if (pSprite2->cstat & CLIPMASK0) pXSprite->target = pSprite2->index;
if (pSprite2->cstat & CLIPMASK0) pXSprite->target_i = pSprite2->index;
else continue;
break;
@ -5762,7 +5762,7 @@ static void actCheckProximity()
break;
case kModernThingEnemyLifeLeech:
if (pXSprite->target != pSprite2->index) continue;
if (pXSprite->target_i != pSprite2->index) continue;
break;
#endif
@ -5981,9 +5981,9 @@ static void actCheckExplosion()
{
if (pXSprite->data1 && CheckProximity(pDude, x, y, z, nSector, radius))
{
if (pExplodeInfo->dmg && pXSprite->target == 0)
if (pExplodeInfo->dmg && pXSprite->target_i == 0)
{
pXSprite->target = 1;
pXSprite->target_i = 1;
actDamageSprite(Owner, dudeactor, kDamageFall, (pExplodeInfo->dmg + Random(pExplodeInfo->dmgRng)) << 4);
}
if (pExplodeInfo->dmgType) ConcussSprite(actor, dudeactor, x, y, z, pExplodeInfo->dmgType);
@ -6196,7 +6196,7 @@ static void actCheckDudes()
{
pXSprite->health = dudeInfo[28].startHealth << 4;
pSprite->type = kDudeCerberusOneHead;
if (pXSprite->target != -1) aiSetTarget(pXSprite, pXSprite->target);
if (pXSprite->target_i != -1) aiSetTarget(pXSprite, pXSprite->target_i);
aiActivateDude(actor);
}
}
@ -6704,7 +6704,7 @@ spritetype* actFireMissile(spritetype *pSprite, int a2, int a3, int a4, int a5,
pMissile->cstat |= 1;
int nXSprite = pMissile->extra;
assert(nXSprite > 0 && nXSprite < kMaxXSprites);
xsprite[nXSprite].target = -1;
xsprite[nXSprite].target_i = -1;
evPost(nMissile, 3, 600, kCallbackRemove);
actBuildMissile(pMissile, nXSprite, nSprite);

View file

@ -269,17 +269,17 @@ void aiChooseDirection(DBloodActor* actor, int a3)
int v8 = 341;
if (vc < 0)
v8 = -341;
if (CanMove(actor, pXSprite->target, pSprite->ang+vc, vsi))
if (CanMove(actor, pXSprite->target_i, pSprite->ang+vc, vsi))
pXSprite->goalAng = pSprite->ang+vc;
else if (CanMove(actor, pXSprite->target, pSprite->ang+vc/2, vsi))
else if (CanMove(actor, pXSprite->target_i, pSprite->ang+vc/2, vsi))
pXSprite->goalAng = pSprite->ang+vc/2;
else if (CanMove(actor, pXSprite->target, pSprite->ang-vc/2, vsi))
else if (CanMove(actor, pXSprite->target_i, pSprite->ang-vc/2, vsi))
pXSprite->goalAng = pSprite->ang-vc/2;
else if (CanMove(actor, pXSprite->target, pSprite->ang+v8, vsi))
else if (CanMove(actor, pXSprite->target_i, pSprite->ang+v8, vsi))
pXSprite->goalAng = pSprite->ang+v8;
else if (CanMove(actor, pXSprite->target, pSprite->ang, vsi))
else if (CanMove(actor, pXSprite->target_i, pSprite->ang, vsi))
pXSprite->goalAng = pSprite->ang;
else if (CanMove(actor, pXSprite->target, pSprite->ang-v8, vsi))
else if (CanMove(actor, pXSprite->target_i, pSprite->ang-v8, vsi))
pXSprite->goalAng = pSprite->ang-v8;
//else if (pSprite->flags&2)
//pXSprite->goalAng = pSprite->ang+341;
@ -289,10 +289,10 @@ void aiChooseDirection(DBloodActor* actor, int a3)
pXSprite->dodgeDir = 1;
else
pXSprite->dodgeDir = -1;
if (!CanMove(actor, pXSprite->target, pSprite->ang+pXSprite->dodgeDir*512, 512))
if (!CanMove(actor, pXSprite->target_i, pSprite->ang+pXSprite->dodgeDir*512, 512))
{
pXSprite->dodgeDir = -pXSprite->dodgeDir;
if (!CanMove(actor, pXSprite->target, pSprite->ang+pXSprite->dodgeDir*512, 512))
if (!CanMove(actor, pXSprite->target_i, pSprite->ang+pXSprite->dodgeDir*512, 512))
pXSprite->dodgeDir = 0;
}
}
@ -392,7 +392,7 @@ void aiActivateDude(DBloodActor* actor)
pDudeExtraE->xval2 = 0;
pDudeExtraE->xval3 = 1;
pDudeExtraE->xval1 = 0;
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
aiNewState(actor, &ghostSearch);
else
{
@ -410,7 +410,7 @@ void aiActivateDude(DBloodActor* actor)
DUDEEXTRA_at6_u1 *pDudeExtraE = &actor->dudeExtra.at6.u1;
pDudeExtraE->xval3 = 1;
pDudeExtraE->xval1 = 0;
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
switch (pXSprite->medium)
{
@ -455,7 +455,7 @@ void aiActivateDude(DBloodActor* actor)
DUDEEXTRA_at6_u1* pDudeExtraE = &actor->dudeExtra.at6.u1;
pDudeExtraE->xval3 = 1;
pDudeExtraE->xval1 = 0;
if (pXSprite->target == -1) {
if (pXSprite->target_i == -1) {
if (spriteIsUnderwater(pSprite, false)) aiGenDudeNewState(pSprite, &genDudeSearchW);
else aiGenDudeNewState(pSprite, &genDudeSearchL);
} else {
@ -466,7 +466,7 @@ void aiActivateDude(DBloodActor* actor)
break;
}
case kDudeModernCustomBurning:
if (pXSprite->target == -1) aiGenDudeNewState(pSprite, &genDudeBurnSearch);
if (pXSprite->target_i == -1) aiGenDudeNewState(pSprite, &genDudeBurnSearch);
else aiGenDudeNewState(pSprite, &genDudeBurnChase);
break;
#endif
@ -475,7 +475,7 @@ void aiActivateDude(DBloodActor* actor)
DUDEEXTRA_at6_u1 *pDudeExtraE = &actor->dudeExtra.at6.u1;
pDudeExtraE->xval3 = 1; pDudeExtraE->xval1 = 0;
pSprite->type = kDudeCultistTommy;
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
switch (pXSprite->medium)
{
@ -513,7 +513,7 @@ void aiActivateDude(DBloodActor* actor)
pDudeExtraE->xval3 = 1;
pDudeExtraE->xval1 = 0;
pSprite->type = kDudeCultistShotgun;
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
switch (pXSprite->medium)
{
@ -546,7 +546,7 @@ void aiActivateDude(DBloodActor* actor)
break;
}
case kDudeBurningCultist:
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
aiNewState(actor, &cultistBurnSearch);
else
aiNewState(actor, &cultistBurnChase);
@ -559,7 +559,7 @@ void aiActivateDude(DBloodActor* actor)
pDudeExtraE->xval1 = 0;
if (!pSprite->flags)
pSprite->flags = 9;
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
aiNewState(actor, &batSearch);
else
{
@ -575,7 +575,7 @@ void aiActivateDude(DBloodActor* actor)
pDudeExtraE->xval2 = 0;
pDudeExtraE->xval3 = 1;
pDudeExtraE->xval1 = 0;
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
aiNewState(actor, &eelSearch);
else
{
@ -596,7 +596,7 @@ void aiActivateDude(DBloodActor* actor)
pDudeExtraE->xval1 = 0;
pDudeExtraE->xval2 = 0;
pDudeExtraE->xval3 = 1;
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
if (pXSector && pXSector->Underwater)
aiNewState(actor, &gillBeastSwimSearch);
@ -621,7 +621,7 @@ void aiActivateDude(DBloodActor* actor)
DUDEEXTRA_at6_u2 *pDudeExtraE = &actor->dudeExtra.at6.u2;
pDudeExtraE->xval2 = 1;
pDudeExtraE->xval1 = 0;
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
aiNewState(actor, &zombieASearch);
else
{
@ -667,7 +667,7 @@ void aiActivateDude(DBloodActor* actor)
DUDEEXTRA_at6_u2 *pDudeExtraE = &actor->dudeExtra.at6.u2;
pDudeExtraE->xval2 = 1;
pDudeExtraE->xval1 = 0;
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
aiNewState(actor, &zombieFSearch);
else
{
@ -680,13 +680,13 @@ void aiActivateDude(DBloodActor* actor)
break;
}
case kDudeBurningZombieAxe:
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
aiNewState(actor, &zombieABurnSearch);
else
aiNewState(actor, &zombieABurnChase);
break;
case kDudeBurningZombieButcher:
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
aiNewState(actor, &zombieFBurnSearch);
else
aiNewState(actor, &zombieFBurnChase);
@ -696,7 +696,7 @@ void aiActivateDude(DBloodActor* actor)
pDudeExtraE->xval2 = 0;
pDudeExtraE->xval3 = 1;
pDudeExtraE->xval1 = 0;
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
aiNewState(actor, &gargoyleFSearch);
else
{
@ -714,7 +714,7 @@ void aiActivateDude(DBloodActor* actor)
pDudeExtraE->xval2 = 0;
pDudeExtraE->xval3 = 1;
pDudeExtraE->xval1 = 0;
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
aiNewState(actor, &gargoyleFSearch);
else
{
@ -753,7 +753,7 @@ void aiActivateDude(DBloodActor* actor)
#endif
break;
case kDudeCerberusTwoHead:
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
aiNewState(actor, &cerberusSearch);
else
{
@ -762,7 +762,7 @@ void aiActivateDude(DBloodActor* actor)
}
break;
case kDudeCerberusOneHead:
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
aiNewState(actor, &cerberus2Search);
else
{
@ -771,7 +771,7 @@ void aiActivateDude(DBloodActor* actor)
}
break;
case kDudeHellHound:
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
aiNewState(actor, &houndSearch);
else
{
@ -780,7 +780,7 @@ void aiActivateDude(DBloodActor* actor)
}
break;
case kDudeHand:
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
aiNewState(actor, &handSearch);
else
{
@ -789,7 +789,7 @@ void aiActivateDude(DBloodActor* actor)
}
break;
case kDudeRat:
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
aiNewState(actor, &ratSearch);
else
{
@ -798,7 +798,7 @@ void aiActivateDude(DBloodActor* actor)
}
break;
case kDudeInnocent:
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
aiNewState(actor, &innocentSearch);
else
{
@ -808,7 +808,7 @@ void aiActivateDude(DBloodActor* actor)
}
break;
case kDudeTchernobog:
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
aiNewState(actor, &tchernobogSearch);
else
{
@ -821,7 +821,7 @@ void aiActivateDude(DBloodActor* actor)
case kDudeSpiderBlack:
pSprite->flags |= 2;
pSprite->cstat &= ~8;
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
aiNewState(actor, &spidSearch);
else
{
@ -836,7 +836,7 @@ void aiActivateDude(DBloodActor* actor)
pDudeExtraE->xval1 = 0;
pSprite->flags |= 2;
pSprite->cstat &= ~8;
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
aiNewState(actor, &spidSearch);
else
{
@ -850,7 +850,7 @@ void aiActivateDude(DBloodActor* actor)
DUDEEXTRA_at6_u2 *pDudeExtraE = &actor->dudeExtra.at6.u2;
pDudeExtraE->xval2 = 1;
pDudeExtraE->xval1 = 0;
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
switch (pXSprite->medium)
{
@ -883,7 +883,7 @@ void aiActivateDude(DBloodActor* actor)
DUDEEXTRA_at6_u2 *pDudeExtraE = &actor->dudeExtra.at6.u2;
pDudeExtraE->xval2 = 1;
pDudeExtraE->xval1 = 0;
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
switch (pXSprite->medium)
{
@ -914,7 +914,7 @@ void aiActivateDude(DBloodActor* actor)
}
case kDudePodGreen:
case kDudePodFire:
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
aiNewState(actor, &podSearch);
else
{
@ -927,7 +927,7 @@ void aiActivateDude(DBloodActor* actor)
break;
case kDudeTentacleGreen:
case kDudeTentacleFire:
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
aiNewState(actor, &tentacleSearch);
else
{
@ -946,7 +946,7 @@ void aiActivateDude(DBloodActor* actor)
void aiSetTarget(XSPRITE *pXSprite, int x, int y, int z)
{
pXSprite->target = -1;
pXSprite->target_i = -1;
pXSprite->targetX = x;
pXSprite->targetY = y;
pXSprite->targetZ = z;
@ -960,7 +960,7 @@ void aiSetTarget(XSPRITE *pXSprite, int nTarget)
{
if (sprite[pXSprite->reference].owner != nTarget)
{
pXSprite->target = nTarget;
pXSprite->target_i = nTarget;
DUDEINFO *pDudeInfo = getDudeInfo(pTarget->type);
pXSprite->targetX = pTarget->x;
pXSprite->targetY = pTarget->y;
@ -986,12 +986,12 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType
spritetype *pSource = &source->s();
int nSource = pSource->index;
if (pSprite == pSource) return 0;
else if (pXSprite->target == -1) // if no target, give the dude a target
else if (pXSprite->target_i == -1) // if no target, give the dude a target
{
aiSetTarget(pXSprite, nSource);
aiActivateDude(&bloodActors[pXSprite->reference]);
}
else if (nSource != pXSprite->target) // if found a new target, retarget
else if (nSource != pXSprite->target_i) // if found a new target, retarget
{
int nThresh = nDamage;
if (pSprite->type == pSource->type)
@ -1683,8 +1683,8 @@ void aiInitSprite(spritetype *pSprite)
if (gModernMap) {
// must keep it in case of loading save
if (pXSprite->dudeFlag4 && spriRangeIsFine(pXSprite->target) && sprite[pXSprite->target].type == kMarkerPath) {
stateTimer = pXSprite->stateTimer; targetMarker = pXSprite->target;
if (pXSprite->dudeFlag4 && spriRangeIsFine(pXSprite->target_i) && sprite[pXSprite->target_i].type == kMarkerPath) {
stateTimer = pXSprite->stateTimer; targetMarker = pXSprite->target_i;
targetX = pXSprite->targetX; targetY = pXSprite->targetY;
targetZ = pXSprite->targetZ;
}
@ -1919,7 +1919,7 @@ void aiInitSprite(spritetype *pSprite)
// restore dude's path
if (spriRangeIsFine(targetMarker)) {
pXSprite->target = targetMarker;
pXSprite->target_i = targetMarker;
pXSprite->targetX = targetX;
pXSprite->targetY = targetY;
pXSprite->targetZ = targetZ;
@ -1930,8 +1930,8 @@ void aiInitSprite(spritetype *pSprite)
// make dude follow the markers
bool uwater = spriteIsUnderwater(pSprite);
if (pXSprite->target <= 0 || sprite[pXSprite->target].type != kMarkerPath) {
pXSprite->target = -1; aiPatrolSetMarker(pSprite, pXSprite);
if (pXSprite->target_i <= 0 || sprite[pXSprite->target_i].type != kMarkerPath) {
pXSprite->target_i = -1; aiPatrolSetMarker(pSprite, pXSprite);
}
if (stateTimer > 0) {

View file

@ -66,7 +66,7 @@ void batBiteSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype *pSprite = &actor->s();
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
@ -74,7 +74,7 @@ void batBiteSeqCallback(int, DBloodActor* actor)
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
int height = (pSprite->yrepeat*pDudeInfo->eyeHeight)<<2;
int height2 = (pTarget->yrepeat*pDudeInfoT->eyeHeight)<<2;
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
actFireVector(actor, 0, 0, dx, dy, height2-height, kVectorBatBite);
}
@ -160,15 +160,15 @@ static void batThinkPonder(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
aiNewState(actor, &batSearch);
return;
}
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -188,7 +188,7 @@ static void batThinkPonder(DBloodActor* actor)
GetSpriteExtents(pSprite, &top, &bottom);
if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum))
{
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
if (height2-height < 0x3000 && nDist < 0x1800 && nDist > 0xc00 && abs(nDeltaAngle) < 85)
aiNewState(actor, &batDodgeUp);
else if (height2-height > 0x5000 && nDist < 0x1800 && nDist > 0xc00 && abs(nDeltaAngle) < 85)
@ -209,7 +209,7 @@ static void batThinkPonder(DBloodActor* actor)
}
}
aiNewState(actor, &batGoto);
pXSprite->target = -1;
pXSprite->target_i = -1;
}
static void batMoveDodgeUp(DBloodActor* actor)
@ -268,15 +268,15 @@ static void batThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
aiNewState(actor, &batGoto);
return;
}
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -304,7 +304,7 @@ static void batThinkChase(DBloodActor* actor)
{
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
int floorZ = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y);
if (height2-height < 0x2000 && nDist < 0x200 && abs(nDeltaAngle) < 85)
aiNewState(actor, &batBite);
@ -322,7 +322,7 @@ static void batThinkChase(DBloodActor* actor)
}
}
pXSprite->target = -1;
pXSprite->target_i = -1;
aiNewState(actor, &batHide);
}
@ -338,7 +338,7 @@ static void batMoveForward(DBloodActor* actor)
int nAccel = pDudeInfo->frontSpeed<<2;
if (abs(nAng) > 341)
return;
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
pSprite->ang = (pSprite->ang+256)&2047;
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
@ -351,7 +351,7 @@ static void batMoveForward(DBloodActor* actor)
int vy = actor->yvel();
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
t1 += nAccel;
else
t1 += nAccel>>1;

View file

@ -67,7 +67,7 @@ void SlashSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype *pSprite = &actor->s();
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
// Correct ?
@ -222,7 +222,7 @@ static void beastThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
XSECTOR *pXSector;
int nXSector = sector[pSprite->sectnum].extra;
@ -238,8 +238,8 @@ static void beastThinkChase(DBloodActor* actor)
}
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -281,7 +281,7 @@ static void beastThinkChase(DBloodActor* actor)
{
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
actor->dudeSlope = DivScale(pTarget->z-pSprite->z, nDist, 10);
if (nDist < 0x1400 && nDist > 0xa00 && abs(nDeltaAngle) < 85 && (pTarget->flags&2)
&& IsPlayerSprite(pTarget) && Chance(0x8000))
@ -378,7 +378,7 @@ static void beastThinkChase(DBloodActor* actor)
aiNewState(actor, &beastSwimGoto);
else
aiNewState(actor, &beastGoto);
pXSprite->target = -1;
pXSprite->target_i = -1;
}
static void beastThinkSwimGoto(DBloodActor* actor)
@ -401,15 +401,15 @@ static void beastThinkSwimChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
aiNewState(actor, &beastSwimGoto);
return;
}
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -435,7 +435,7 @@ static void beastThinkSwimChase(DBloodActor* actor)
{
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
if (nDist < 0x400 && abs(nDeltaAngle) < 85)
aiNewState(actor, &beastSwimSlash);
else
@ -450,7 +450,7 @@ static void beastThinkSwimChase(DBloodActor* actor)
return;
}
aiNewState(actor, &beastSwimGoto);
pXSprite->target = -1;
pXSprite->target_i = -1;
}
static void beastMoveForward(DBloodActor* actor)
@ -485,7 +485,7 @@ static void sub_628A0(DBloodActor* actor)
int nAccel = pDudeInfo->frontSpeed<<2;
if (abs(nAng) > 341)
return;
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
pSprite->ang = (pSprite->ang+256)&2047;
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
@ -498,7 +498,7 @@ static void sub_628A0(DBloodActor* actor)
int vy = actor->yvel();
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
t1 += nAccel;
else
t1 += nAccel>>2;
@ -512,7 +512,7 @@ static void sub_62AE0(DBloodActor* actor)
auto pSprite = &actor->s();
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
@ -549,7 +549,7 @@ static void sub_62D7C(DBloodActor* actor)
int nSprite = pSprite->index;
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;

View file

@ -65,7 +65,7 @@ void eelBiteSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype *pSprite = &actor->s();
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
@ -80,12 +80,12 @@ void eelBiteSeqCallback(int, DBloodActor* actor)
* copied from lines 177:181
* resolves this case, but may cause other issues?
*/
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
aiNewState(actor, &eelSearch);
return;
}
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
actFireVector(actor, 0, 0, dx, dy, height2-height, kVectorBoneelBite);
}
@ -173,15 +173,15 @@ static void eelThinkPonder(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
aiNewState(actor, &eelSearch);
return;
}
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -201,7 +201,7 @@ static void eelThinkPonder(DBloodActor* actor)
GetSpriteExtents(pSprite, &top, &bottom);
if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum))
{
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
if (height2-height < -0x2000 && nDist < 0x1800 && nDist > 0xc00 && abs(nDeltaAngle) < 85)
aiNewState(actor, &eelDodgeUp);
else if (height2-height > 0xccc && nDist < 0x1800 && nDist > 0xc00 && abs(nDeltaAngle) < 85)
@ -222,7 +222,7 @@ static void eelThinkPonder(DBloodActor* actor)
}
}
aiNewState(actor, &eelGoto);
pXSprite->target = -1;
pXSprite->target_i = -1;
}
static void eelMoveDodgeUp(DBloodActor* actor)
@ -281,15 +281,15 @@ static void eelThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
aiNewState(actor, &eelGoto);
return;
}
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -317,7 +317,7 @@ static void eelThinkChase(DBloodActor* actor)
{
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
if (nDist < 0x399 && top2 > top && abs(nDeltaAngle) < 85)
aiNewState(actor, &eelSwoop);
else if (nDist <= 0x399 && abs(nDeltaAngle) < 85)
@ -331,7 +331,7 @@ static void eelThinkChase(DBloodActor* actor)
return;
}
pXSprite->target = -1;
pXSprite->target_i = -1;
aiNewState(actor, &eelSearch);
}
@ -347,7 +347,7 @@ static void eelMoveForward(DBloodActor* actor)
int nAccel = (pDudeInfo->frontSpeed-(((4-gGameOptions.nDifficulty)<<26)/120)/120)<<2;
if (abs(nAng) > 341)
return;
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
pSprite->ang = (pSprite->ang+256)&2047;
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
@ -360,7 +360,7 @@ static void eelMoveForward(DBloodActor* actor)
int vy = actor->yvel();
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
t1 += nAccel;
else
t1 += nAccel>>1;

View file

@ -130,7 +130,7 @@ static void burnThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
switch (pSprite->type)
{
@ -162,8 +162,8 @@ static void burnThinkChase(DBloodActor* actor)
}
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -207,7 +207,7 @@ static void burnThinkChase(DBloodActor* actor)
{
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
if (nDist < 0x333 && abs(nDeltaAngle) < 85)
{
switch (pSprite->type)
@ -268,7 +268,7 @@ static void burnThinkChase(DBloodActor* actor)
break;
#endif
}
pXSprite->target = -1;
pXSprite->target_i = -1;
}
END_BLD_NS

View file

@ -121,7 +121,7 @@ static void calebThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
XSECTOR *pXSector;
int nXSector = sector[pSprite->sectnum].extra;
@ -137,8 +137,8 @@ static void calebThinkChase(DBloodActor* actor)
}
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -183,7 +183,7 @@ static void calebThinkChase(DBloodActor* actor)
{
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
actor->dudeSlope = DivScale(pTarget->z-pSprite->z, nDist, 10);
if (nDist < 0x599 && abs(nDeltaAngle) < 28)
{
@ -243,7 +243,7 @@ static void calebThinkChase(DBloodActor* actor)
aiNewState(actor, &tinycalebGoto);
if (Chance(0x2000))
sfxPlay3DSound(pSprite, 10000 + Random(5), -1, 0);
pXSprite->target = -1;
pXSprite->target_i = -1;
}
static void calebThinkSwimGoto(DBloodActor* actor)
@ -266,15 +266,15 @@ static void calebThinkSwimChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
aiNewState(actor, &tinycalebSwimGoto);
return;
}
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -300,7 +300,7 @@ static void calebThinkSwimChase(DBloodActor* actor)
{
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
if (nDist < 0x400 && abs(nDeltaAngle) < 85)
aiNewState(actor, &tinycalebSwimAttack);
else
@ -310,7 +310,7 @@ static void calebThinkSwimChase(DBloodActor* actor)
return;
}
aiNewState(actor, &tinycalebSwimGoto);
pXSprite->target = -1;
pXSprite->target_i = -1;
}
static void sub_65D04(DBloodActor* actor)
@ -326,7 +326,7 @@ static void sub_65D04(DBloodActor* actor)
int nAccel = pDudeInfo->frontSpeed<<2;
if (abs(nAng) > 341)
return;
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
pSprite->ang = (pSprite->ang+256)&2047;
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
@ -339,7 +339,7 @@ static void sub_65D04(DBloodActor* actor)
int vy = yvel[nSprite];
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
t1 += nAccel;
else
t1 += nAccel>>2;
@ -354,7 +354,7 @@ static void sub_65F44(DBloodActor* actor)
int nSprite = pSprite->index;
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
@ -391,7 +391,7 @@ static void sub_661E0(DBloodActor* actor)
int nSprite = pSprite->index;
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;

View file

@ -68,11 +68,11 @@ void cerberusBiteSeqCallback(int, DBloodActor* actor)
return;
}
///assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {
if (!(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites)) {
Printf(PRINT_HIGH, "pXSprite->target >= 0 && pXSprite->target < kMaxSprites");
return;
}
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
int dz = pTarget->z-pSprite->z;
actFireVector(actor, 350, -100, dx, dy, dz, kVectorCerberusHack);
actFireVector(actor, -350, 0, dx, dy, dz, kVectorCerberusHack);
@ -86,7 +86,7 @@ void cerberusBurnSeqCallback(int, DBloodActor* actor)
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int height = pDudeInfo->eyeHeight*pSprite->yrepeat;
///assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {
if (!(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites)) {
Printf(PRINT_HIGH, "pXSprite->target >= 0 && pXSprite->target < kMaxSprites");
return;
}
@ -166,7 +166,7 @@ void cerberusBurnSeqCallback2(int, DBloodActor* actor)
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
///assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {
if (!(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites)) {
Printf(PRINT_HIGH, "pXSprite->target >= 0 && pXSprite->target < kMaxSprites");
return;
}
@ -351,7 +351,7 @@ static void cerberusThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1) {
if (pXSprite->target_i == -1) {
switch (pSprite->type) {
case kDudeCerberusTwoHead:
aiNewState(actor, &cerberusGoto);
@ -372,11 +372,11 @@ static void cerberusThinkChase(DBloodActor* actor)
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
///assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {
if (!(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites)) {
Printf(PRINT_HIGH, "pXSprite->target >= 0 && pXSprite->target < kMaxSprites");
return;
}
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -414,7 +414,7 @@ static void cerberusThinkChase(DBloodActor* actor)
if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum))
{
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) {
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
if (nDist < 0x1b00 && nDist > 0xd00 && abs(nDeltaAngle) < 85) {
switch (pSprite->type) {
@ -490,7 +490,7 @@ static void cerberusThinkChase(DBloodActor* actor)
aiNewState(actor, &cerberus2Goto);
break;
}
pXSprite->target = -1;
pXSprite->target_i = -1;
}
END_BLD_NS

View file

@ -136,8 +136,8 @@ void cultThrowSeqCallback(int, DBloodActor* actor)
nMissile = kThingArmedTNTBundle;
char v4 = Chance(0x6000);
sfxPlay3DSound(pSprite, 455, -1, 0);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
int dx = pTarget->x - pSprite->x;
int dy = pTarget->y - pSprite->y;
@ -173,8 +173,8 @@ void sub_68230(int, DBloodActor* actor)
if (gGameOptions.nDifficulty > 2)
nMissile = kThingArmedTNTBundle;
sfxPlay3DSound(pSprite, 455, -1, 0);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
int dx = pTarget->x - pSprite->x;
int dy = pTarget->y - pSprite->y;
@ -236,7 +236,7 @@ static void cultThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
switch (pXSprite->medium)
{
@ -252,8 +252,8 @@ static void cultThinkChase(DBloodActor* actor)
}
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -299,7 +299,7 @@ static void cultThinkChase(DBloodActor* actor)
{
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
actor->dudeSlope = DivScale(pTarget->z-pSprite->z, nDist, 10);
switch (pSprite->type) {
case kDudeCultistTommy:
@ -633,7 +633,7 @@ static void cultThinkChase(DBloodActor* actor)
aiNewState(actor, &cultistSwimGoto);
break;
}
pXSprite->target = -1;
pXSprite->target_i = -1;
}
END_BLD_NS

View file

@ -81,7 +81,7 @@ void SlashFSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
int height = (pSprite->yrepeat*pDudeInfo->eyeHeight)<<2;
@ -110,7 +110,7 @@ void BlastSSeqCallback(int, DBloodActor* actor)
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
wrand(); // ???
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
int height = (pSprite->yrepeat*getDudeInfo(pSprite->type)->eyeHeight) << 2;
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
@ -355,7 +355,7 @@ static void gargThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
aiNewState(actor, &gargoyleFGoto);
return;
@ -367,11 +367,11 @@ static void gargThinkChase(DBloodActor* actor)
}
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
///assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {
if (!(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites)) {
Printf(PRINT_HIGH, "pXSprite->target >= 0 && pXSprite->target < kMaxSprites");
return;
}
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -399,7 +399,7 @@ static void gargThinkChase(DBloodActor* actor)
{
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
int floorZ = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y);
switch (pSprite->type) {
case kDudeGargoyleFlesh:
@ -530,7 +530,7 @@ static void gargThinkChase(DBloodActor* actor)
}
aiNewState(actor, &gargoyleFGoto);
pXSprite->target = -1;
pXSprite->target_i = -1;
}
static void entryFStatue(DBloodActor* actor)
@ -565,7 +565,7 @@ static void gargMoveForward(DBloodActor* actor)
int nAccel = pDudeInfo->frontSpeed<<2;
if (abs(nAng) > 341)
return;
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
pSprite->ang = (pSprite->ang+256)&2047;
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
@ -578,7 +578,7 @@ static void gargMoveForward(DBloodActor* actor)
int vy = actor->yvel();
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
t1 += nAccel;
else
t1 += nAccel>>1;

View file

@ -65,7 +65,7 @@ void ghostSlashSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
int height = (pSprite->yrepeat*pDudeInfo->eyeHeight)<<2;
@ -93,7 +93,7 @@ void ghostBlastSeqCallback(int, DBloodActor* actor)
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
wrand(); // ???
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
int height = (pSprite->yrepeat*getDudeInfo(pSprite->type)->eyeHeight) << 2;
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
@ -333,7 +333,7 @@ static void ghostThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
aiNewState(actor, &ghostGoto);
return;
@ -344,12 +344,12 @@ static void ghostThinkChase(DBloodActor* actor)
return;
}
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
///assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {
Printf(PRINT_HIGH, "pXSprite->target >= 0 && pXSprite->target < kMaxSprites");
///assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
if (!(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites)) {
Printf(PRINT_HIGH, "pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites");
return;
}
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -377,7 +377,7 @@ static void ghostThinkChase(DBloodActor* actor)
{
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
int floorZ = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y);
switch (pSprite->type) {
case kDudePhantasm:
@ -440,7 +440,7 @@ static void ghostThinkChase(DBloodActor* actor)
}
aiNewState(actor, &ghostGoto);
pXSprite->target = -1;
pXSprite->target_i = -1;
}
static void ghostMoveForward(DBloodActor* actor)
@ -459,7 +459,7 @@ static void ghostMoveForward(DBloodActor* actor)
int nAccel = pDudeInfo->frontSpeed<<2;
if (abs(nAng) > 341)
return;
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
pSprite->ang = (pSprite->ang+256)&2047;
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
@ -472,7 +472,7 @@ static void ghostMoveForward(DBloodActor* actor)
int vy = actor->yvel();
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
t1 += nAccel;
else
t1 += nAccel>>1;

View file

@ -62,7 +62,7 @@ void GillBiteSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
int dz = pSprite->z-pTarget->z;
@ -112,7 +112,7 @@ static void gillThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
XSECTOR *pXSector;
int nXSector = sector[pSprite->sectnum].extra;
@ -128,8 +128,8 @@ static void gillThinkChase(DBloodActor* actor)
}
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -171,7 +171,7 @@ static void gillThinkChase(DBloodActor* actor)
{
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
actor->dudeSlope = DivScale(pTarget->z-pSprite->z, nDist, 10);
if (nDist < 921 && abs(nDeltaAngle) < 28)
{
@ -230,7 +230,7 @@ static void gillThinkChase(DBloodActor* actor)
else
aiNewState(actor, &gillBeastGoto);
sfxPlay3DSound(pSprite, 1701, -1, 0);
pXSprite->target = -1;
pXSprite->target_i = -1;
}
static void gillThinkSwimGoto(DBloodActor* actor)
@ -253,15 +253,15 @@ static void gillThinkSwimChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
aiNewState(actor, &gillBeastSwimSearch);
return;
}
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -287,7 +287,7 @@ static void gillThinkSwimChase(DBloodActor* actor)
{
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
if (nDist < 0x400 && abs(nDeltaAngle) < 85)
aiNewState(actor, &gillBeastSwimBite);
else
@ -302,7 +302,7 @@ static void gillThinkSwimChase(DBloodActor* actor)
return;
}
aiNewState(actor, &gillBeastSwimGoto);
pXSprite->target = -1;
pXSprite->target_i = -1;
}
static void sub_6CB00(DBloodActor* actor)
@ -318,7 +318,7 @@ static void sub_6CB00(DBloodActor* actor)
int nAccel = (pDudeInfo->frontSpeed-(((4-gGameOptions.nDifficulty)<<27)/120)/120)<<2;
if (abs(nAng) > 341)
return;
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
pSprite->ang = (pSprite->ang+256)&2047;
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
@ -331,7 +331,7 @@ static void sub_6CB00(DBloodActor* actor)
int vy = actor->yvel();
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
t1 += nAccel;
else
t1 += nAccel>>2;
@ -345,7 +345,7 @@ static void sub_6CD74(DBloodActor* actor)
auto pSprite = &actor->s();
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;
@ -381,7 +381,7 @@ static void sub_6D03C(DBloodActor* actor)
auto pSprite = &actor->s();
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
int nAng = ((pXSprite->goalAng+1024-pSprite->ang)&2047)-1024;

View file

@ -46,7 +46,7 @@ void HandJumpSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
if (IsPlayerSprite(pTarget))
{
PLAYER *pPlayer = &gPlayer[pTarget->type-kDudePlayer1];
@ -86,15 +86,15 @@ static void handThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
aiNewState(actor, &handGoto);
return;
}
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -118,7 +118,7 @@ static void handThinkChase(DBloodActor* actor)
{
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
if (nDist < 0x233 && abs(nDeltaAngle) < 85 && gGameOptions.nGameType == 0)
aiNewState(actor, &handJump);
return;
@ -127,7 +127,7 @@ static void handThinkChase(DBloodActor* actor)
}
aiNewState(actor, &handGoto);
pXSprite->target = -1;
pXSprite->target_i = -1;
}
END_BLD_NS

View file

@ -55,12 +55,12 @@ void houndBiteSeqCallback(int, DBloodActor* actor)
return;
}
///assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {
Printf(PRINT_HIGH, "pXSprite->target >= 0 && pXSprite->target < kMaxSprites");
///assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
if (!(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites)) {
Printf(PRINT_HIGH, "pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites");
return;
}
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
#ifdef NOONE_EXTENSIONS
if (IsPlayerSprite(pTarget) || gModernMap) // allow to hit non-player targets
actFireVector(actor, 0, 0, dx, dy, pTarget->z - pSprite->z, kVectorHoundBite);
@ -109,7 +109,7 @@ static void houndThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
aiNewState(actor, &houndGoto);
return;
@ -120,12 +120,12 @@ static void houndThinkChase(DBloodActor* actor)
return;
}
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
///assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {
Printf(PRINT_HIGH, "pXSprite->target >= 0 && pXSprite->target < kMaxSprites");
///assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
if (!(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites)) {
Printf(PRINT_HIGH, "pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites");
return;
}
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -149,7 +149,7 @@ static void houndThinkChase(DBloodActor* actor)
{
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
if (nDist < 0xb00 && nDist > 0x500 && abs(nDeltaAngle) < 85)
aiNewState(actor, &houndBurn);
else if(nDist < 0x266 && abs(nDeltaAngle) < 85)
@ -160,7 +160,7 @@ static void houndThinkChase(DBloodActor* actor)
}
aiNewState(actor, &houndGoto);
pXSprite->target = -1;
pXSprite->target_i = -1;
}
END_BLD_NS

View file

@ -69,15 +69,15 @@ static void innocThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
aiNewState(actor, &innocentGoto);
return;
}
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -101,7 +101,7 @@ static void innocThinkChase(DBloodActor* actor)
{
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
if (nDist < 0x666 && abs(nDeltaAngle) < 85)
aiNewState(actor, &innocentIdle);
return;
@ -111,7 +111,7 @@ static void innocThinkChase(DBloodActor* actor)
aiPlay3DSound(pSprite, 7000+Random(6), AI_SFX_PRIORITY_1, -1);
aiNewState(actor, &innocentGoto);
pXSprite->target = -1;
pXSprite->target_i = -1;
}

View file

@ -65,13 +65,13 @@ void podAttack(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
///assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {
Printf(PRINT_HIGH, "pXSprite->target >= 0 && pXSprite->target < kMaxSprites");
///assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
if (!(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites)) {
Printf(PRINT_HIGH, "pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites");
return;
}
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
///assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) {
@ -182,7 +182,7 @@ static void aiPodChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1) {
if (pXSprite->target_i == -1) {
switch (pSprite->type) {
case kDudePodGreen:
case kDudePodFire:
@ -201,12 +201,12 @@ static void aiPodChase(DBloodActor* actor)
return;
}
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
///assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {
Printf(PRINT_HIGH, "pXSprite->target >= 0 && pXSprite->target < kMaxSprites");
///assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
if (!(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites)) {
Printf(PRINT_HIGH, "pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites");
return;
}
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -234,7 +234,7 @@ static void aiPodChase(DBloodActor* actor)
{
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
if (abs(nDeltaAngle) < 85 && pTarget->type != kDudePodGreen && pTarget->type != kDudePodFire) {
switch (pSprite->type) {
case kDudePodGreen:
@ -262,7 +262,7 @@ static void aiPodChase(DBloodActor* actor)
aiNewState(actor, &tentacleMove);
break;
}
pXSprite->target = -1;
pXSprite->target_i = -1;
}
END_BLD_NS

View file

@ -49,8 +49,8 @@ void ratBiteSeqCallback(int, DBloodActor* actor)
int dx = CosScale16(pSprite->ang);
int dy = SinScale16(pSprite->ang);
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
if (IsPlayerSprite(pTarget))
actFireVector(actor, 0, 0, dx, dy, pTarget->z-pSprite->z, kVectorRatBite);
}
@ -83,15 +83,15 @@ static void ratThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
aiNewState(actor, &ratGoto);
return;
}
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -115,7 +115,7 @@ static void ratThinkChase(DBloodActor* actor)
{
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
if (nDist < 0x399 && abs(nDeltaAngle) < 85)
aiNewState(actor, &ratBite);
return;
@ -124,7 +124,7 @@ static void ratThinkChase(DBloodActor* actor)
}
aiNewState(actor, &ratGoto);
pXSprite->target = -1;
pXSprite->target_i = -1;
}
END_BLD_NS

View file

@ -73,8 +73,8 @@ void SpidBiteSeqCallback(int, DBloodActor* actor)
dy += Random2(2000);
int dz = Random2(2000);
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
if (IsPlayerSprite(pTarget)) {
@ -122,8 +122,8 @@ void SpidJumpSeqCallback(int, DBloodActor* actor)
dy += Random2(200);
int dz = Random2(200);
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
if (IsPlayerSprite(pTarget)) {
dz += pTarget->z-pSprite->z;
switch (pSprite->type) {
@ -144,8 +144,8 @@ void SpidBirthSeqCallback(int, DBloodActor* actor)
spritetype* pSprite = &actor->s();
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
DUDEEXTRA_at6_u1 *pDudeExtraE = &actor->dudeExtra.at6.u1;
int dx = pXSprite->targetX-pSprite->x;
int dy = pXSprite->targetY-pSprite->y;
@ -200,15 +200,15 @@ static void spidThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
aiNewState(actor, &spidGoto);
return;
}
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -229,7 +229,7 @@ static void spidThinkChase(DBloodActor* actor)
int height = (pDudeInfo->eyeHeight*pSprite->yrepeat)<<2;
if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum)) {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) {
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
switch (pSprite->type) {
case kDudeSpiderRed:
@ -257,7 +257,7 @@ static void spidThinkChase(DBloodActor* actor)
}
aiNewState(actor, &spidGoto);
pXSprite->target = -1;
pXSprite->target_i = -1;
}
END_BLD_NS

View file

@ -50,7 +50,7 @@ void sub_71A90(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int nTarget = pTarget->index;
int nOwner = pSprite->owner;
@ -67,9 +67,9 @@ void sub_71BD4(int, DBloodActor* actor)
spritetype* pSprite = &actor->s();
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int height = pSprite->yrepeat*pDudeInfo->eyeHeight;
///assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {
Printf(PRINT_HIGH, "pXSprite->target >= 0 && pXSprite->target < kMaxSprites");
///assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
if (!(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites)) {
Printf(PRINT_HIGH, "pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites");
return;
}
int x = pSprite->x;
@ -140,9 +140,9 @@ void sub_720AC(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
///assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {
Printf(PRINT_HIGH, "pXSprite->target >= 0 && pXSprite->target < kMaxSprites");
///assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
if (!(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites)) {
Printf(PRINT_HIGH, "pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites");
return;
}
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
@ -306,7 +306,7 @@ static void sub_72934(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
aiNewState(actor, &tcherno13A9B8);
return;
@ -317,12 +317,12 @@ static void sub_72934(DBloodActor* actor)
return;
}
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
///assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites)) {
Printf(PRINT_HIGH, "pXSprite->target >= 0 && pXSprite->target < kMaxSprites");
///assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
if (!(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites)) {
Printf(PRINT_HIGH, "pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites");
return;
}
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -346,7 +346,7 @@ static void sub_72934(DBloodActor* actor)
{
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
if (nDist < 0x1f00 && nDist > 0xd00 && abs(nDeltaAngle) < 85)
aiNewState(actor, &tcherno13AA0C);
else if (nDist < 0xd00 && nDist > 0xb00 && abs(nDeltaAngle) < 85)
@ -359,7 +359,7 @@ static void sub_72934(DBloodActor* actor)
}
aiNewState(actor, &tcherno13A9B8);
pXSprite->target = -1;
pXSprite->target_i = -1;
}
END_BLD_NS

View file

@ -130,7 +130,7 @@ static bool genDudeAdjustSlope(DBloodActor* actor, int dist, int weaponType, int
{
spritetype* pSprite = &actor->s();
XSPRITE* pXSprite = &actor->x();
if (spriRangeIsFine(pXSprite->target))
if (spriRangeIsFine(pXSprite->target_i))
{
int fStart = 0;
int fEnd = 0;
@ -140,8 +140,8 @@ static bool genDudeAdjustSlope(DBloodActor* actor, int dist, int weaponType, int
for (int i = -8191; i < 8192; i += by)
{
HitScan(pSprite, pSprite->z, CosScale16(pSprite->ang), SinScale16(pSprite->ang), i, clipMask, dist);
if (!fStart && pXSprite->target == gHitInfo.hitsprite) fStart = i;
else if (fStart && pXSprite->target != gHitInfo.hitsprite)
if (!fStart && pXSprite->target_i == gHitInfo.hitsprite) fStart = i;
else if (fStart && pXSprite->target_i != gHitInfo.hitsprite)
{
fEnd = i;
break;
@ -183,12 +183,12 @@ void punchCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
if (pXSprite->target != -1)
if (pXSprite->target_i != -1)
{
int nZOffset1 = getDudeInfo(pSprite->type)->eyeHeight * pSprite->yrepeat << 2;
int nZOffset2 = 0;
spritetype* pTarget = &sprite[pXSprite->target];
spritetype* pTarget = &sprite[pXSprite->target_i];
if(IsDudeSprite(pTarget))
nZOffset2 = getDudeInfo(pTarget->type)->eyeHeight * pTarget->yrepeat << 2;
@ -208,7 +208,7 @@ void genDudeAttack1(int, DBloodActor* actor)
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
if (pXSprite->target < 0) return;
if (pXSprite->target_i < 0) return;
int dx, dy, dz;
xvel[pSprite->index] = yvel[pSprite->index] = 0;
@ -241,8 +241,8 @@ void genDudeAttack1(int, DBloodActor* actor)
pSpawned->owner = pSprite->index;
if (xspriRangeIsFine(pSpawned->extra)) {
xsprite[pSpawned->extra].target = pXSprite->target;
if (pXSprite->target > -1)
xsprite[pSpawned->extra].target_i = pXSprite->target_i;
if (pXSprite->target_i > -1)
aiActivateDude(&bloodActors[pSpawned->index]);
}
@ -281,10 +281,10 @@ static void ThrowThing(DBloodActor* actor, bool impact)
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
if (!(pXSprite->target >= 0 && pXSprite->target < kMaxSprites))
if (!(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites))
return;
spritetype * pTarget = &sprite[pXSprite->target];
spritetype * pTarget = &sprite[pXSprite->target_i];
if (!(pTarget->type >= kDudeBase && pTarget->type < kDudeMax))
return;
@ -363,7 +363,7 @@ static void ThrowThing(DBloodActor* actor, bool impact)
pThing->cstat &= ~CSTAT_SPRITE_BLOCK;
pThing->pal = 6;
pThing->clipdist = 0;
pXThing->target = pTarget->index;
pXThing->target_i = pTarget->index;
pXThing->Proximity = true;
pXThing->stateTimer = 1;
@ -418,7 +418,7 @@ static void unicultThinkChase(DBloodActor* actor)
auto const pXSprite = &actor->x();
auto const pSprite = &actor->s();
if (pSprite->type < kDudeBase || pSprite->type >= kDudeMax) return;
else if (pXSprite->target < 0 || pXSprite->target >= kMaxSprites) {
else if (pXSprite->target_i < 0 || pXSprite->target_i >= kMaxSprites) {
if(spriteIsUnderwater(pSprite,false)) aiGenDudeNewState(pSprite, &genDudeGotoW);
else aiGenDudeNewState(pSprite, &genDudeGotoL);
return;
@ -428,13 +428,13 @@ static void unicultThinkChase(DBloodActor* actor)
}
spritetype* pTarget = &sprite[pXSprite->target];
spritetype* pTarget = &sprite[pXSprite->target_i];
XSPRITE* pXTarget = (!IsDudeSprite(pTarget) || !xspriRangeIsFine(pTarget->extra)) ? NULL : &xsprite[pTarget->extra];
if (pXTarget == NULL) { // target lost
if(spriteIsUnderwater(pSprite,false)) aiGenDudeNewState(pSprite, &genDudeSearchShortW);
else aiGenDudeNewState(pSprite, &genDudeSearchShortL);
pXSprite->target = -1;
pXSprite->target_i = -1;
return;
} else if (pXTarget->health <= 0) { // target is dead
@ -446,7 +446,7 @@ static void unicultThinkChase(DBloodActor* actor)
}
else if (spriteIsUnderwater(pSprite, false)) aiGenDudeNewState(pSprite, &genDudeGotoW);
else aiGenDudeNewState(pSprite, &genDudeGotoL);
pXSprite->target = -1;
pXSprite->target_i = -1;
return;
}
@ -475,7 +475,7 @@ static void unicultThinkChase(DBloodActor* actor)
if (powerupCheck(pPlayer, kPwUpShadowCloak) > 0) {
if (spriteIsUnderwater(pSprite, false)) aiGenDudeNewState(pSprite, &genDudeSearchShortW);
else aiGenDudeNewState(pSprite, &genDudeSearchShortL);
pXSprite->target = -1;
pXSprite->target_i = -1;
return;
}
}
@ -489,7 +489,7 @@ static void unicultThinkChase(DBloodActor* actor)
if (spriteIsUnderwater(pSprite, false)) aiGenDudeNewState(pSprite, &genDudeSearchW);
else aiGenDudeNewState(pSprite, &genDudeSearchL);
pXSprite->target = -1;
pXSprite->target_i = -1;
return;
}
@ -533,7 +533,7 @@ static void unicultThinkChase(DBloodActor* actor)
XSPRITE* pXLeech = &xsprite[pLeech->extra];
int ldist = aiFightGetTargetDist(pTarget, pDudeInfo, pLeech);
if (ldist > 3 || !cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum,
pLeech->x, pLeech->y, pLeech->z, pLeech->sectnum) || pXLeech->target == -1) {
pLeech->x, pLeech->y, pLeech->z, pLeech->sectnum) || pXLeech->target_i == -1) {
aiGenDudeNewState(pSprite, &genDudeThrow2);
genDudeThrow2.nextState = &genDudeDodgeShortL;
@ -595,7 +595,7 @@ static void unicultThinkChase(DBloodActor* actor)
} else if (weaponType == kGenDudeWeaponSummon) {
// don't attack slaves
if (pXSprite->target >= 0 && sprite[pXSprite->target].owner == pSprite->index) {
if (pXSprite->target_i >= 0 && sprite[pXSprite->target_i].owner == pSprite->index) {
aiSetTarget(pXSprite, pSprite->x, pSprite->y, pSprite->z);
return;
} else if (gGenDudeExtra[pSprite->index].slaveCount > gGameOptions.nDifficulty || dist < meleeVector->maxDist) {
@ -677,7 +677,7 @@ static void unicultThinkChase(DBloodActor* actor)
objDist = approxDist(gHitInfo.hitx - pSprite->x, gHitInfo.hity - pSprite->y);
}
if (pXSprite->target != gHitInfo.hitsprite && targetDist > objDist) {
if (pXSprite->target_i != gHitInfo.hitsprite && targetDist > objDist) {
walltype* pHWall = NULL; XWALL* pXHWall = NULL;
spritetype* pHSprite = NULL; XSPRITE* pXHSprite = NULL;
bool hscn = false; bool blck = false; bool failed = false;
@ -716,7 +716,7 @@ static void unicultThinkChase(DBloodActor* actor)
break;
if (IsDudeSprite(pHSprite) && (weaponType != kGenDudeWeaponHitscan || hscn)) {
// dodge a bit in sides
if (pXHSprite->target != pSprite->index) {
if (pXHSprite->target_i != pSprite->index) {
if (pExtra->baseDispersion < 1024 && weaponType != kGenDudeWeaponMissile) {
if (spriteIsUnderwater(pSprite)) aiGenDudeNewState(pSprite, &genDudeDodgeShorterW);
else if (inDuck(pXSprite->aiState)) aiGenDudeNewState(pSprite, &genDudeDodgeShorterD);
@ -774,7 +774,7 @@ static void unicultThinkChase(DBloodActor* actor)
{
if (genDudeAdjustSlope(actor, dist, weaponType)) break;
VectorScan(pSprite, 0, 0, CosScale16(pSprite->ang), SinScale16(pSprite->ang), actor->dudeSlope, dist, 1);
if (pXSprite->target == gHitInfo.hitsprite) break;
if (pXSprite->target_i == gHitInfo.hitsprite) break;
bool immune = nnExtIsImmune(pHSprite, gVectorData[curWeapon].dmgType);
if (!(pXHSprite != NULL && (!immune || (immune && pHSprite->statnum == kStatThing && pXHSprite->Vector)) && !pXHSprite->locked))
@ -828,7 +828,7 @@ static void unicultThinkChase(DBloodActor* actor)
if (masked) VectorScan(pSprite, 0, 0, CosScale16(pSprite->ang), SinScale16(pSprite->ang), actor->dudeSlope, dist, 1);
//viewSetSystemMessage("WALL VHIT: %d", gHitInfo.hitwall);
if ((pXSprite->target != gHitInfo.hitsprite) && (pHWall->type != kWallGib || !masked || pXHWall == NULL || !pXHWall->triggerVector || pXHWall->locked)) {
if ((pXSprite->target_i != gHitInfo.hitsprite) && (pHWall->type != kWallGib || !masked || pXHWall == NULL || !pXHWall->triggerVector || pXHWall->locked)) {
if (spriteIsUnderwater(pSprite)) aiGenDudeNewState(pSprite, &genDudeChaseW);
else aiGenDudeNewState(pSprite, &genDudeChaseL);
return;
@ -880,7 +880,7 @@ static void unicultThinkChase(DBloodActor* actor)
}
}
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
switch (state) {
case 1:
aiGenDudeNewState(pSprite, &genDudeFireW);
@ -999,7 +999,7 @@ void aiGenDudeMoveForward(DBloodActor* actor)
int nAccel = pDudeInfo->frontSpeed << 2;
if (abs(nAng) > 341)
return;
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
pSprite->ang = (pSprite->ang + 256) & 2047;
int dx = pXSprite->targetX - pSprite->x;
int dy = pXSprite->targetY - pSprite->y;
@ -1012,7 +1012,7 @@ void aiGenDudeMoveForward(DBloodActor* actor)
int vy = yvel[pSprite->index];
int t1 = DMulScale(vx, nCos, vy, nSin, 30);
int t2 = DMulScale(vx, nSin, -vy, nCos, 30);
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
t1 += nAccel;
else
t1 += nAccel >> 1;
@ -1048,26 +1048,26 @@ void aiGenDudeChooseDirection(spritetype* pSprite, XSPRITE* pXSprite, int a3, in
int t1 = DMulScale(xvel, Cos(pSprite->ang), yvel, Sin(pSprite->ang), 30);
int vsi = ((t1 * 15) >> 12) / 2; int v8 = (vc >= 0) ? 341 : -341;
if (CanMove(actor, pXSprite->target, pSprite->ang + vc, vsi))
if (CanMove(actor, pXSprite->target_i, pSprite->ang + vc, vsi))
pXSprite->goalAng = pSprite->ang + vc;
else if (CanMove(actor, pXSprite->target, pSprite->ang + vc / 2, vsi))
else if (CanMove(actor, pXSprite->target_i, pSprite->ang + vc / 2, vsi))
pXSprite->goalAng = pSprite->ang + vc / 2;
else if (CanMove(actor, pXSprite->target, pSprite->ang - vc / 2, vsi))
else if (CanMove(actor, pXSprite->target_i, pSprite->ang - vc / 2, vsi))
pXSprite->goalAng = pSprite->ang - vc / 2;
else if (CanMove(actor, pXSprite->target, pSprite->ang + v8, vsi))
else if (CanMove(actor, pXSprite->target_i, pSprite->ang + v8, vsi))
pXSprite->goalAng = pSprite->ang + v8;
else if (CanMove(actor, pXSprite->target, pSprite->ang, vsi))
else if (CanMove(actor, pXSprite->target_i, pSprite->ang, vsi))
pXSprite->goalAng = pSprite->ang;
else if (CanMove(actor, pXSprite->target, pSprite->ang - v8, vsi))
else if (CanMove(actor, pXSprite->target_i, pSprite->ang - v8, vsi))
pXSprite->goalAng = pSprite->ang - v8;
else
pXSprite->goalAng = pSprite->ang + 341;
pXSprite->dodgeDir = (Chance(0x8000)) ? 1 : -1;
if (!CanMove(actor, pXSprite->target, pSprite->ang + pXSprite->dodgeDir * 512, 512)) {
if (!CanMove(actor, pXSprite->target_i, pSprite->ang + pXSprite->dodgeDir * 512, 512)) {
pXSprite->dodgeDir = -pXSprite->dodgeDir;
if (!CanMove(actor, pXSprite->target, pSprite->ang + pXSprite->dodgeDir * 512, 512))
if (!CanMove(actor, pXSprite->target_i, pSprite->ang + pXSprite->dodgeDir * 512, 512))
pXSprite->dodgeDir = 0;
}
}
@ -1551,7 +1551,7 @@ void dudeLeechOperate(spritetype* pSprite, XSPRITE* pXSprite, EVENT event)
return;
}
int nTarget = pXSprite->target;
int nTarget = pXSprite->target_i;
if (spriRangeIsFine(nTarget) && nTarget != pSprite->owner) {
spritetype* pTarget = &sprite[nTarget];
if (pTarget->statnum == kStatDude && !(pTarget->flags & 32) && pTarget->extra > 0 && pTarget->extra < kMaxXSprites && !pXSprite->stateTimer) {
@ -1810,7 +1810,7 @@ void genDudeTransform(spritetype* pSprite) {
seqSpawn(seqId, 3, pSprite->extra, -1);
// save target
int target = pXSprite->target;
int target = pXSprite->target_i;
// re-init sprite
aiInitSprite(pSprite);
@ -1848,14 +1848,14 @@ void updateTargetOfLeech(spritetype* pSprite) {
spritetype* pLeech = leechIsDropped(pSprite);
if (pLeech == NULL || pLeech->extra < 0) gGenDudeExtra[pSprite->index].nLifeLeech = -1;
else if (xsprite[pSprite->extra].target != xsprite[pLeech->extra].target) {
else if (xsprite[pSprite->extra].target_i != xsprite[pLeech->extra].target_i) {
XSPRITE* pXDude = &xsprite[pSprite->extra]; XSPRITE* pXLeech = &xsprite[pLeech->extra];
if (pXDude->target < 0 && spriRangeIsFine(pXLeech->target)) {
aiSetTarget(pXDude, pXLeech->target);
if (pXDude->target_i < 0 && spriRangeIsFine(pXLeech->target_i)) {
aiSetTarget(pXDude, pXLeech->target_i);
if (inIdle(pXDude->aiState))
aiActivateDude(&bloodActors[pXDude->reference]);
} else {
pXLeech->target = pXDude->target;
pXLeech->target_i = pXDude->target_i;
}
}
}
@ -1868,7 +1868,7 @@ void updateTargetOfSlaves(spritetype* pSprite) {
XSPRITE* pXSprite = &xsprite[pSprite->extra];
GENDUDEEXTRA* pExtra = genDudeExtra(pSprite); short* slave = pExtra->slave;
spritetype* pTarget = (pXSprite->target >= 0 && IsDudeSprite(&sprite[pXSprite->target])) ? &sprite[pXSprite->target] : NULL;
spritetype* pTarget = (pXSprite->target_i >= 0 && IsDudeSprite(&sprite[pXSprite->target_i])) ? &sprite[pXSprite->target_i] : NULL;
XSPRITE* pXTarget = (pTarget != NULL && xspriRangeIsFine(pTarget->extra) && xsprite[pTarget->extra].health > 0) ? &xsprite[pTarget->extra] : NULL;
int newCnt = pExtra->slaveCount;
@ -1882,9 +1882,9 @@ void updateTargetOfSlaves(spritetype* pSprite) {
XSPRITE* pXSlave = &xsprite[pSlave->index];
if (pXTarget != NULL) {
if (pXSprite->target != pXSlave->target) aiSetTarget(pXSlave, pXSprite->target);
if (pXSprite->target_i != pXSlave->target_i) aiSetTarget(pXSlave, pXSprite->target_i);
// check if slave have proper target
if (!spriRangeIsFine(pXSlave->target) || sprite[pXSlave->target].owner == pSprite->index)
if (!spriRangeIsFine(pXSlave->target_i) || sprite[pXSlave->target_i].owner == pSprite->index)
aiSetTarget(pXSlave, pSprite->x, pSprite->y, pSprite->z);
} else {
aiSetTarget(pXSlave, pSprite->x, pSprite->y, pSprite->z); // try return to master
@ -2098,7 +2098,7 @@ bool genDudePrepare(spritetype* pSprite, int propId) {
bool oldStatus = pExtra->canWalk;
pExtra->canWalk = !!getSequence(i);
if (oldStatus != pExtra->canWalk) {
if (!spriRangeIsFine(pXSprite->target))
if (!spriRangeIsFine(pXSprite->target_i))
{
if (spriteIsUnderwater(pSprite, false)) aiGenDudeNewState(pSprite, &genDudeIdleW);
else aiGenDudeNewState(pSprite, &genDudeIdleL);

View file

@ -63,7 +63,7 @@ void HackSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
int tx = pXSprite->targetX-pSprite->x;
@ -111,15 +111,15 @@ static void zombaThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
aiNewState(actor, &zombieASearch);
return;
}
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -147,7 +147,7 @@ static void zombaThinkChase(DBloodActor* actor)
{
if (abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
if (nDist < 0x400 && abs(nDeltaAngle) < 85)
aiNewState(actor, &zombieAHack);
return;
@ -156,22 +156,22 @@ static void zombaThinkChase(DBloodActor* actor)
}
aiNewState(actor, &zombieAGoto);
pXSprite->target = -1;
pXSprite->target_i = -1;
}
static void zombaThinkPonder(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
aiNewState(actor, &zombieASearch);
return;
}
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -195,7 +195,7 @@ static void zombaThinkPonder(DBloodActor* actor)
{
if (abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
if (nDist < 0x400)
{
if (abs(nDeltaAngle) < 85)
@ -271,7 +271,7 @@ static void entryEZombie(DBloodActor* actor)
static void entryAIdle(DBloodActor* actor)
{
auto pXSprite = &actor->x();
pXSprite->target = -1;
pXSprite->target_i = -1;
}
static void entryEStand(DBloodActor* actor)

View file

@ -52,7 +52,7 @@ void zombfHackSeqCallback(int, DBloodActor* actor)
spritetype* pSprite = &actor->s();
if (pSprite->type != kDudeZombieButcher)
return;
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int height = (pDudeInfo->eyeHeight*pSprite->yrepeat);
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
@ -64,7 +64,7 @@ void PukeSeqCallback(int, DBloodActor* actor)
{
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
spritetype *pTarget = &sprite[pXSprite->target];
spritetype *pTarget = &sprite[pXSprite->target_i];
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
int height = (pDudeInfo->eyeHeight*pSprite->yrepeat);
@ -112,15 +112,15 @@ static void zombfThinkChase(DBloodActor* actor)
{
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (pXSprite->target == -1)
if (pXSprite->target_i == -1)
{
aiNewState(actor, &zombieFGoto);
return;
}
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target];
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype *pTarget = &sprite[pXSprite->target_i];
XSPRITE *pXTarget = &xsprite[pTarget->extra];
int dx = pTarget->x-pSprite->x;
int dy = pTarget->y-pSprite->y;
@ -144,7 +144,7 @@ static void zombfThinkChase(DBloodActor* actor)
{
if (abs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(pXSprite, pXSprite->target);
aiSetTarget(pXSprite, pXSprite->target_i);
if (nDist < 0x1400 && nDist > 0xe00 && abs(nDeltaAngle) < 85)
{
int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0);
@ -208,7 +208,7 @@ static void zombfThinkChase(DBloodActor* actor)
}
aiNewState(actor, &zombieFSearch);
pXSprite->target = -1;
pXSprite->target_i = -1;
}
END_BLD_NS

View file

@ -806,7 +806,7 @@ void viewProcessSprites(spritetype* tsprite, int& spritesortcnt, int32_t cX, int
case kMissileFlareAlt:
if (pTSprite->statnum == kStatFlare) {
assert(pTXSprite != NULL);
if (pTXSprite->target == gView->nSprite) {
if (pTXSprite->target_i == gView->nSprite) {
pTSprite->xrepeat = 0;
break;
}
@ -833,7 +833,7 @@ void viewProcessSprites(spritetype* tsprite, int& spritesortcnt, int32_t cX, int
{
if (pTSprite->type == kDudeHand && pTXSprite->aiState == &hand13A3B4)
{
spritetype *pTTarget = &sprite[pTXSprite->target];
spritetype *pTTarget = &sprite[pTXSprite->target_i];
assert(pTXSprite != NULL && pTTarget != NULL);
if (IsPlayerSprite(pTTarget))
{

View file

@ -55,13 +55,13 @@ public:
void SetTarget(DBloodActor* own)
{
x().target = own ? own->s().index : -1;
x().target_i = own ? own->s().index : -1;
}
DBloodActor* GetTarget()
{
if (x().target == -1 || x().target == kMaxSprites - 1) return nullptr;
return base() + x().target;
if (x().target_i == -1 || x().target_i == kMaxSprites - 1) return nullptr;
return base() + x().target_i;
}
void SetBurnSource(DBloodActor* own)

View file

@ -269,7 +269,7 @@ void Respawn(int nSprite) // 9
// return dude to the patrol state
if (gModernMap && pXSprite->dudeFlag4) {
pXSprite->data3 = 0;
pXSprite->target = -1;
pXSprite->target_i = -1;
}
#else
pSprite->clipdist = getDudeInfo(nType + kDudeBase)->clipdist;
@ -377,7 +377,7 @@ void FinishHim(int nSprite) // 13
spritetype* pSprite = &sprite[nSprite];
int nXSprite = pSprite->extra;
XSPRITE* pXSprite = &xsprite[nXSprite];
if (IsPlayerSprite(pSprite) && playerSeqPlaying(&gPlayer[pSprite->type - kDudePlayer1], 16) && pXSprite->target == gMe->nSprite)
if (IsPlayerSprite(pSprite) && playerSeqPlaying(&gPlayer[pSprite->type - kDudePlayer1], 16) && pXSprite->target_i == gMe->nSprite)
sndStartSample(3313, -1, 1, 0);
}

View file

@ -957,7 +957,7 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, shor
pXSprite->dudeAmbush = bitReader.readUnsigned(1);
pXSprite->dudeGuard = bitReader.readUnsigned(1);
pXSprite->dudeFlag4 = bitReader.readUnsigned(1);
pXSprite->target = bitReader.readSigned(16);
pXSprite->target_i = bitReader.readSigned(16);
pXSprite->targetX = bitReader.readSigned(32);
pXSprite->targetY = bitReader.readSigned(32);
pXSprite->targetZ = bitReader.readSigned(32);

View file

@ -112,7 +112,7 @@ struct XSPRITE {
int16_t data1; // Data 1
int16_t data2; // Data 2
int16_t data3; // Data 3
int16_t target; // target sprite
int16_t target_i; // target sprite
int16_t burnSource;
uint16_t txID; // TX ID
uint16_t rxID; // RX ID

View file

@ -575,7 +575,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, XSPRITE& w, XSPRIT
("targetX", w.targetX, def->targetX)
("targetY", w.targetY, def->targetY)
("targetZ", w.targetZ, def->targetZ)
("target", w.target, def->target)
("target", w.target_i, def->target_i)
("sysdata1", w.sysData1, def->sysData1)
("sysdata2", w.sysData2, def->sysData2)
("scale", w.scale, def->scale)

View file

@ -338,7 +338,7 @@ spritetype* nnExtSpawnDude(XSPRITE* pXSource, spritetype* pSprite, short nType,
bool burning = IsBurningDude(pDude);
if (burning) {
pXDude->burnTime = 10;
pXDude->target = -1;
pXDude->target_i = -1;
}
if ((burning || (pSource->flags & kModernTypeFlag3)) && !pXDude->dudeFlag4)
@ -711,7 +711,7 @@ void nnExtInitModernStuff(bool bSaveLoad) {
pXSprite->Proximity = pXSprite->Push = pXSprite->Vector = pXSprite->triggerOn = false;
pXSprite->state = pXSprite->restState = 0;
pXSprite->targetX = pXSprite->targetY = pXSprite->targetZ = pXSprite->target = pXSprite->sysData2 = -1;
pXSprite->targetX = pXSprite->targetY = pXSprite->targetZ = pXSprite->target_i = pXSprite->sysData2 = -1;
changespritestat(pSprite->index, kStatModernCondition);
int oldStat = pSprite->cstat; pSprite->cstat = 0x30;
@ -2731,13 +2731,13 @@ void useTeleportTarget(XSPRITE* pXSource, spritetype* pSprite) {
if (pSprite->statnum == kStatDude && IsDudeSprite(pSprite) && !IsPlayerSprite(pSprite)) {
XSPRITE* pXDude = &xsprite[pSprite->extra];
int x = pXDude->targetX; int y = pXDude->targetY; int z = pXDude->targetZ;
int target = pXDude->target;
int target = pXDude->target_i;
aiInitSprite(pSprite);
if (target >= 0) {
pXDude->targetX = x; pXDude->targetY = y; pXDude->targetZ = z;
pXDude->target = target; aiActivateDude(&bloodActors[pXDude->reference]);
pXDude->target_i = target; aiActivateDude(&bloodActors[pXDude->reference]);
}
}
@ -3765,9 +3765,9 @@ bool condCheckDude(XSPRITE* pXCond, int cmpOp, bool PUSH) {
switch (cond) {
default: break;
case 0: // dude have any targets?
if (!spriRangeIsFine(pXSpr->target)) return false;
else if (!IsDudeSprite(&sprite[pXSpr->target]) && sprite[pXSpr->target].type != kMarkerPath) return false;
else if (PUSH) condPush(pXCond, OBJ_SPRITE, pXSpr->target);
if (!spriRangeIsFine(pXSpr->target_i)) return false;
else if (!IsDudeSprite(&sprite[pXSpr->target_i]) && sprite[pXSpr->target_i].type != kMarkerPath) return false;
else if (PUSH) condPush(pXCond, OBJ_SPRITE, pXSpr->target_i);
return true;
case 1: return aiFightDudeIsAffected(pXSpr); // dude affected by ai fight?
case 2: // distance to the target in a range?
@ -3775,10 +3775,10 @@ bool condCheckDude(XSPRITE* pXCond, int cmpOp, bool PUSH) {
case 4: // is the target visible with periphery?
{
if (!spriRangeIsFine(pXSpr->target))
if (!spriRangeIsFine(pXSpr->target_i))
condError(pXCond, "Dude #%d have no target!", objIndex);
spritetype* pTrgt = &sprite[pXSpr->target];
spritetype* pTrgt = &sprite[pXSpr->target_i];
DUDEINFO* pInfo = getDudeInfo(pSpr->type);
int eyeAboveZ = pInfo->eyeHeight * pSpr->yrepeat << 2;
int dx = pTrgt->x - pSpr->x; int dy = pTrgt->y - pSpr->y;
@ -3798,7 +3798,7 @@ bool condCheckDude(XSPRITE* pXCond, int cmpOp, bool PUSH) {
}
if (var <= 0) return false;
else if (PUSH) condPush(pXCond, OBJ_SPRITE, pXSpr->target);
else if (PUSH) condPush(pXCond, OBJ_SPRITE, pXSpr->target_i);
return true;
}
@ -3809,21 +3809,21 @@ bool condCheckDude(XSPRITE* pXCond, int cmpOp, bool PUSH) {
case 9: return (pXSpr->unused1 & kDudeFlagStealth);
case 10: // check if the marker is busy with another dude
case 11: // check if the marker is reached
if (!pXSpr->dudeFlag4 || !spriRangeIsFine(pXSpr->target) || sprite[pXSpr->target].type != kMarkerPath) return false;
if (!pXSpr->dudeFlag4 || !spriRangeIsFine(pXSpr->target_i) || sprite[pXSpr->target_i].type != kMarkerPath) return false;
switch (cond) {
case 10:
var = aiPatrolMarkerBusy(pSpr->index, pXSpr->target);
var = aiPatrolMarkerBusy(pSpr->index, pXSpr->target_i);
if (!spriRangeIsFine(var)) return false;
else if (PUSH) condPush(pXCond, OBJ_SPRITE, var);
break;
case 11:
if (!aiPatrolMarkerReached(pSpr, pXSpr)) return false;
else if (PUSH) condPush(pXCond, OBJ_SPRITE, pXSpr->target);
else if (PUSH) condPush(pXCond, OBJ_SPRITE, pXSpr->target_i);
break;
}
return true;
case 12: // compare spot progress value in %
if (!pXSpr->dudeFlag4 || !spriRangeIsFine(pXSpr->target) || sprite[pXSpr->target].type != kMarkerPath) var = 0;
if (!pXSpr->dudeFlag4 || !spriRangeIsFine(pXSpr->target_i) || sprite[pXSpr->target_i].type != kMarkerPath) var = 0;
else if (!(pXSpr->unused1 & kDudeFlagStealth) || pXSpr->data3 < 0 || pXSpr->data3 > kMaxPatrolSpotValue) var = 0;
else var = (kPercFull * pXSpr->data3) / kMaxPatrolSpotValue;
return condCmp(var, arg1, arg2, cmpOp);
@ -3986,7 +3986,7 @@ bool condCheckSprite(XSPRITE* pXCond, int cmpOp, bool PUSH) {
spritetype* pDude = &sprite[nSprite];
if (IsDudeSprite(pDude) && xspriRangeIsFine(pDude->extra)) {
XSPRITE* pXDude = &xsprite[pDude->extra];
if (pXDude->health <= 0 || pXDude->target != pSpr->index) continue;
if (pXDude->health <= 0 || pXDude->target_i != pSpr->index) continue;
else if (PUSH) condPush(pXCond, OBJ_SPRITE, nSprite);
return true;
}
@ -4066,7 +4066,7 @@ bool condCheckSprite(XSPRITE* pXCond, int cmpOp, bool PUSH) {
continue;
XSPRITE* pXFlare = &xsprite[pFlare->extra];
if (!spriRangeIsFine(pXFlare->target) || pXFlare->target != objIndex) continue;
if (!spriRangeIsFine(pXFlare->target_i) || pXFlare->target_i != objIndex) continue;
else if (PUSH) condPush(pXCond, OBJ_SPRITE, nSprite);
return true;
}
@ -4312,14 +4312,14 @@ spritetype* aiFightGetTargetInRange(spritetype* pSprite, int minDist, int maxDis
int dist = aiFightGetTargetDist(pSprite, pDudeInfo, pTarget);
if (dist < minDist || dist > maxDist) continue;
else if (pXSprite->target == pTarget->index) return pTarget;
else if (pXSprite->target_i == pTarget->index) return pTarget;
else if (!IsDudeSprite(pTarget) || pTarget->index == pSprite->index || IsPlayerSprite(pTarget)) continue;
else if (IsBurningDude(pTarget) || !IsKillableDude(pTarget) || pTarget->owner == pSprite->index) continue;
else if ((teamMode == 1 && aiFightIsMateOf(pXSprite, pXTarget)) || aiFightMatesHaveSameTarget(pXSprite, pTarget, 1)) continue;
else if (data == 666 || pXTarget->data1 == data) {
if (pXSprite->target > 0) {
cTarget = &sprite[pXSprite->target];
if (pXSprite->target_i > 0) {
cTarget = &sprite[pXSprite->target_i];
int fineDist1 = aiFightGetFineTargetDist(pSprite, cTarget);
int fineDist2 = aiFightGetFineTargetDist(pSprite, pTarget);
if (fineDist1 < fineDist2)
@ -4334,9 +4334,9 @@ spritetype* aiFightGetTargetInRange(spritetype* pSprite, int minDist, int maxDis
spritetype* aiFightTargetIsPlayer(XSPRITE* pXSprite) {
if (pXSprite->target >= 0) {
if (IsPlayerSprite(&sprite[pXSprite->target]))
return &sprite[pXSprite->target];
if (pXSprite->target_i >= 0) {
if (IsPlayerSprite(&sprite[pXSprite->target_i]))
return &sprite[pXSprite->target_i];
}
return NULL;
@ -4351,9 +4351,9 @@ spritetype* aiFightGetMateTargets(XSPRITE* pXSprite) {
continue;
pXMate = &xsprite[pMate->extra];
if (pXMate->target > -1) {
if (!IsPlayerSprite(&sprite[pXMate->target]))
return &sprite[pXMate->target];
if (pXMate->target_i > -1) {
if (!IsPlayerSprite(&sprite[pXMate->target_i]))
return &sprite[pXMate->target_i];
}
}
@ -4375,7 +4375,7 @@ bool aiFightMatesHaveSameTarget(XSPRITE* pXLeader, spritetype* pTarget, int allo
continue;
pXMate = &xsprite[pMate->extra];
if (pXMate->target == pTarget->index && allow-- <= 0)
if (pXMate->target_i == pTarget->index && allow-- <= 0)
return true;
}
@ -4426,7 +4426,7 @@ void aiFightFreeTargets(int nSprite) {
while ((nTarget = it.NextIndex()) >= 0)
{
if (!IsDudeSprite(&sprite[nTarget]) || sprite[nTarget].extra < 0) continue;
else if (xsprite[sprite[nTarget].extra].target == nSprite)
else if (xsprite[sprite[nTarget].extra].target_i == nSprite)
aiSetTarget(&xsprite[sprite[nTarget].extra], sprite[nTarget].x, sprite[nTarget].y, sprite[nTarget].z);
}
@ -4502,7 +4502,7 @@ void aiFightAlarmDudesInSight(spritetype* pSprite, int max) {
continue;
pXDude = &xsprite[pDude->extra];
if (aiFightDudeCanSeeTarget(pXSprite, pDudeInfo, pDude)) {
if (pXDude->target != -1 || pXDude->rxID > 0)
if (pXDude->target_i != -1 || pXDude->rxID > 0)
continue;
aiSetTarget(pXDude, pDude->x, pDude->y, pDude->z);
@ -5904,8 +5904,8 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) {
}
int maxAlarmDudes = 8 + Random(8);
if (pXSprite->target > -1 && sprite[pXSprite->target].extra > -1 && pPlayer == NULL) {
pTarget = &sprite[pXSprite->target]; pXTarget = &xsprite[pTarget->extra];
if (pXSprite->target_i > -1 && sprite[pXSprite->target_i].extra > -1 && pPlayer == NULL) {
pTarget = &sprite[pXSprite->target_i]; pXTarget = &xsprite[pTarget->extra];
if (aiFightUnitCanFly(pSprite) && aiFightIsMeleeUnit(pTarget) && !aiFightUnitCanFly(pTarget))
pSprite->flags |= 0x0002;
@ -5946,10 +5946,10 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) {
startHp = (pXMate->sysData2 > 0) ? ClipRange(pXMate->sysData2 << 4, 1, 65535) : getDudeInfo(pMate->type)->startHealth << 4;
if (pXMate->health < (unsigned)startHp) actHealDude(&bloodActors[pXMate->reference], receiveHp, startHp);
if (pXMate->target > -1 && sprite[pXMate->target].extra >= 0) {
pTarget = &sprite[pXMate->target];
if (pXMate->target_i > -1 && sprite[pXMate->target_i].extra >= 0) {
pTarget = &sprite[pXMate->target_i];
// force mate stop attack dude, if he does
if (pXMate->target == pSprite->index) {
if (pXMate->target_i == pSprite->index) {
aiSetTarget(pXMate, pMate->x, pMate->y, pMate->z);
} else if (!aiFightIsMateOf(pXSprite, &xsprite[pTarget->extra])) {
// force dude to attack same target that mate have
@ -5963,7 +5963,7 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) {
}
// force dude stop attack mate, if target was not changed previously
if (pXSprite->target == pMate->index)
if (pXSprite->target_i == pMate->index)
aiSetTarget(pXSprite, pSprite->x, pSprite->y, pSprite->z);
@ -5974,19 +5974,19 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) {
}
int mDist = 3; if (aiFightIsMeleeUnit(pSprite)) mDist = 2;
if (pXSprite->target >= 0 && aiFightGetTargetDist(pSprite, pDudeInfo, &sprite[pXSprite->target]) < mDist) {
if (pXSprite->target_i >= 0 && aiFightGetTargetDist(pSprite, pDudeInfo, &sprite[pXSprite->target_i]) < mDist) {
if (!isActive(pSprite->index)) aiActivateDude(&bloodActors[pXSprite->reference]);
return;
}
// lets try to look for target that fits better by distance
else if ((PlayClock & 256) != 0 && (pXSprite->target < 0 || aiFightGetTargetDist(pSprite, pDudeInfo, pTarget) >= mDist)) {
else if ((PlayClock & 256) != 0 && (pXSprite->target_i < 0 || aiFightGetTargetDist(pSprite, pDudeInfo, pTarget) >= mDist)) {
pTarget = aiFightGetTargetInRange(pSprite, 0, mDist, pXSource->data1, pXSource->data2);
if (pTarget != NULL) {
pXTarget = &xsprite[pTarget->extra];
// Make prev target not aim in dude
if (pXSprite->target > -1) {
spritetype* prvTarget = &sprite[pXSprite->target];
if (pXSprite->target_i > -1) {
spritetype* prvTarget = &sprite[pXSprite->target_i];
aiSetTarget(&xsprite[prvTarget->extra], prvTarget->x, prvTarget->y, prvTarget->z);
if (!isActive(pTarget->index))
aiActivateDude(&bloodActors[pXTarget->reference]);
@ -5998,7 +5998,7 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) {
aiActivateDude(&bloodActors[pXSprite->reference]);
// ...and change target of target to dude to force it fight
if (pXSource->data3 > 0 && pXTarget->target != pSprite->index) {
if (pXSource->data3 > 0 && pXTarget->target_i != pSprite->index) {
aiSetTarget(pXTarget, pSprite->index);
if (!isActive(pTarget->index))
aiActivateDude(&bloodActors[pXTarget->reference]);
@ -6009,7 +6009,7 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) {
}
}
if ((pXSprite->target < 0 || pPlayer != NULL) && (PlayClock & 32) != 0) {
if ((pXSprite->target_i < 0 || pPlayer != NULL) && (PlayClock & 32) != 0) {
// try find first target that dude can see
int nSprite;
StatIterator it(kStatDude);
@ -6017,7 +6017,7 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) {
{
pTarget = &sprite[nSprite]; pXTarget = &xsprite[pTarget->extra];
if (pXTarget->target == pSprite->index) {
if (pXTarget->target_i == pSprite->index) {
aiSetTarget(pXSprite, pTarget->index);
return;
}
@ -6040,7 +6040,7 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) {
aiActivateDude(&bloodActors[pXSprite->reference]);
// ...and change target of target to dude to force it fight
if (pXSource->data3 > 0 && pXTarget->target != pSprite->index) {
if (pXSource->data3 > 0 && pXTarget->target_i != pSprite->index) {
aiSetTarget(pXTarget, pSprite->index);
if (pPlayer == NULL && !isActive(pTarget->index))
aiActivateDude(&bloodActors[pXTarget->reference]);
@ -6057,12 +6057,12 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) {
}
// got no target - let's ask mates if they have targets
if ((pXSprite->target < 0 || pPlayer != NULL) && pXSource->data2 == 1 && (PlayClock & 64) != 0) {
if ((pXSprite->target_i < 0 || pPlayer != NULL) && pXSource->data2 == 1 && (PlayClock & 64) != 0) {
spritetype* pMateTarget = NULL;
if ((pMateTarget = aiFightGetMateTargets(pXSprite)) != NULL && pMateTarget->extra > 0) {
XSPRITE* pXMateTarget = &xsprite[pMateTarget->extra];
if (aiFightDudeCanSeeTarget(pXSprite, pDudeInfo, pMateTarget)) {
if (pXMateTarget->target < 0) {
if (pXMateTarget->target_i < 0) {
aiSetTarget(pXMateTarget, pSprite->index);
if (IsDudeSprite(pMateTarget) && !isActive(pMateTarget->index))
aiActivateDude(&bloodActors[pXMateTarget->reference]);
@ -6074,9 +6074,9 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) {
return;
// try walk in mate direction in case if not see the target
} else if (pXMateTarget->target >= 0 && aiFightDudeCanSeeTarget(pXSprite, pDudeInfo, &sprite[pXMateTarget->target])) {
spritetype* pMate = &sprite[pXMateTarget->target];
pXSprite->target = pMateTarget->index;
} else if (pXMateTarget->target_i >= 0 && aiFightDudeCanSeeTarget(pXSprite, pDudeInfo, &sprite[pXMateTarget->target_i])) {
spritetype* pMate = &sprite[pXMateTarget->target_i];
pXSprite->target_i = pMateTarget->index;
pXSprite->targetX = pMate->x;
pXSprite->targetY = pMate->y;
pXSprite->targetZ = pMate->z;
@ -6483,27 +6483,27 @@ void nnExtAiSetDirection(spritetype* pSprite, XSPRITE* pXSprite, int a3) {
if (vc < 0)
v8 = -341;
if (nnExtCanMove(pSprite, pXSprite->target, pSprite->ang + vc, vsi))
if (nnExtCanMove(pSprite, pXSprite->target_i, pSprite->ang + vc, vsi))
pXSprite->goalAng = pSprite->ang + vc;
else if (nnExtCanMove(pSprite, pXSprite->target, pSprite->ang + vc / 2, vsi))
else if (nnExtCanMove(pSprite, pXSprite->target_i, pSprite->ang + vc / 2, vsi))
pXSprite->goalAng = pSprite->ang + vc / 2;
else if (nnExtCanMove(pSprite, pXSprite->target, pSprite->ang - vc / 2, vsi))
else if (nnExtCanMove(pSprite, pXSprite->target_i, pSprite->ang - vc / 2, vsi))
pXSprite->goalAng = pSprite->ang - vc / 2;
else if (nnExtCanMove(pSprite, pXSprite->target, pSprite->ang + v8, vsi))
else if (nnExtCanMove(pSprite, pXSprite->target_i, pSprite->ang + v8, vsi))
pXSprite->goalAng = pSprite->ang + v8;
else if (nnExtCanMove(pSprite, pXSprite->target, pSprite->ang, vsi))
else if (nnExtCanMove(pSprite, pXSprite->target_i, pSprite->ang, vsi))
pXSprite->goalAng = pSprite->ang;
else if (nnExtCanMove(pSprite, pXSprite->target, pSprite->ang - v8, vsi))
else if (nnExtCanMove(pSprite, pXSprite->target_i, pSprite->ang - v8, vsi))
pXSprite->goalAng = pSprite->ang - v8;
else
pXSprite->goalAng = pSprite->ang + 341;
if (pXSprite->dodgeDir) {
if (!nnExtCanMove(pSprite, pXSprite->target, pSprite->ang + pXSprite->dodgeDir * 512, 512))
if (!nnExtCanMove(pSprite, pXSprite->target_i, pSprite->ang + pXSprite->dodgeDir * 512, 512))
{
pXSprite->dodgeDir = -pXSprite->dodgeDir;
if (!nnExtCanMove(pSprite, pXSprite->target, pSprite->ang + pXSprite->dodgeDir * 512, 512))
if (!nnExtCanMove(pSprite, pXSprite->target_i, pSprite->ang + pXSprite->dodgeDir * 512, 512))
pXSprite->dodgeDir = 0;
}
@ -6519,9 +6519,9 @@ void aiPatrolState(spritetype* pSprite, int state) {
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
XSPRITE* pXSprite = &xsprite[pSprite->extra];
assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
spritetype* pMarker = &sprite[pXSprite->target];
spritetype* pMarker = &sprite[pXSprite->target_i];
XSPRITE* pXMarker = &xsprite[pMarker->extra];
assert(pMarker->type == kMarkerPath);
@ -6612,7 +6612,7 @@ int aiPatrolMarkerBusy(int nExcept, int nMarker) {
continue;
XSPRITE* pXDude = &xsprite[sprite[i].extra];
if (pXDude->health > 0 && pXDude->target >= 0 && sprite[pXDude->target].type == kMarkerPath && pXDude->target == nMarker)
if (pXDude->health > 0 && pXDude->target_i >= 0 && sprite[pXDude->target_i].type == kMarkerPath && pXDude->target_i == nMarker)
return sprite[i].index;
}
@ -6625,9 +6625,9 @@ bool aiPatrolMarkerReached(spritetype* pSprite, XSPRITE* pXSprite) {
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO_EXTRA* pExtra = &gDudeInfoExtra[pSprite->type - kDudeBase];
if (spriRangeIsFine(pXSprite->target) && sprite[pXSprite->target].type == kMarkerPath) {
if (spriRangeIsFine(pXSprite->target_i) && sprite[pXSprite->target_i].type == kMarkerPath) {
spritetype* pMarker = &sprite[pXSprite->target];
spritetype* pMarker = &sprite[pXSprite->target_i];
short okDist = ClipLow(pMarker->clipdist << 1, 4);
int oX = abs(pMarker->x - pSprite->x) >> 4;
int oY = abs(pMarker->y - pSprite->y) >> 4;
@ -6705,7 +6705,7 @@ void aiPatrolSetMarker(spritetype* pSprite, XSPRITE* pXSprite) {
int path = -1; int firstFinePath = -1; int prev = -1, next, i, dist, zt1, zb1, zt2, zb2, closest = 200000;
// select closest marker that dude can see
if (pXSprite->target <= 0) {
if (pXSprite->target_i <= 0) {
for (i = headspritestat[kStatPathMarker]; i != -1; i = nextspritestat[i]) {
@ -6725,7 +6725,7 @@ void aiPatrolSetMarker(spritetype* pSprite, XSPRITE* pXSprite) {
}
// set next marker
} else if (sprite[pXSprite->target].type == kMarkerPath && xspriRangeIsFine(sprite[pXSprite->target].extra)) {
} else if (sprite[pXSprite->target_i].type == kMarkerPath && xspriRangeIsFine(sprite[pXSprite->target_i].extra)) {
// idea: which one of next (allowed) markers are closer to the potential target?
// idea: -3 select random next marker that dude can see in radius of reached marker
@ -6734,7 +6734,7 @@ void aiPatrolSetMarker(spritetype* pSprite, XSPRITE* pXSprite) {
// another marker which belongs that node?
int breakChance = 0;
pCur = &sprite[pXSprite->target];
pCur = &sprite[pXSprite->target_i];
pXCur = &xsprite[pCur->extra];
if (pXSprite->targetX >= 0)
{
@ -6751,7 +6751,7 @@ void aiPatrolSetMarker(spritetype* pSprite, XSPRITE* pXSprite) {
back = (pXSprite->unused2 == kPatrolMoveBackward); next = (back) ? pXCur->data1 : pXCur->data2;
for (i = headspritestat[kStatPathMarker]; i != -1; i = nextspritestat[i]) {
if (sprite[i].index == pXSprite->target || !xspriRangeIsFine(sprite[i].extra)) continue;
if (sprite[i].index == pXSprite->target_i || !xspriRangeIsFine(sprite[i].extra)) continue;
else if (pXSprite->targetX >= 0 && sprite[i].index == pPrev->index && node) {
if (pXCur->data2 == pXPrev->data1)
continue;
@ -6786,7 +6786,7 @@ void aiPatrolSetMarker(spritetype* pSprite, XSPRITE* pXSprite) {
if (!spriRangeIsFine(path))
return;
pXSprite->target = path;
pXSprite->target_i = path;
pXSprite->targetX = prev; // keep previous marker index here, use actual sprite coords when selecting direction
sprite[path].owner = pSprite->index;
@ -6803,9 +6803,9 @@ void aiPatrolStop(spritetype* pSprite, int target, bool alarm) {
if (pXSprite->health <= 0)
return;
if (pXSprite->target >= 0 && sprite[pXSprite->target].type == kMarkerPath) {
if (target < 0) pSprite->ang = sprite[pXSprite->target].ang & 2047;
pXSprite->target = -1;
if (pXSprite->target_i >= 0 && sprite[pXSprite->target_i].type == kMarkerPath) {
if (target < 0) pSprite->ang = sprite[pXSprite->target_i].ang & 2047;
pXSprite->target_i = -1;
}
bool patrol = pXSprite->dudeFlag4; pXSprite->dudeFlag4 = 0;
@ -6868,7 +6868,7 @@ void aiPatrolMove(DBloodActor* actor) {
auto pXSprite = &actor->x();
auto pSprite = &actor->s();
if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax) || !spriRangeIsFine(pXSprite->target))
if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax) || !spriRangeIsFine(pXSprite->target_i))
return;
@ -6878,7 +6878,7 @@ void aiPatrolMove(DBloodActor* actor) {
case kDudeCultistTommyProne: dudeIdx = kDudeCultistTommy - kDudeBase; break;
}
spritetype* pTarget = &sprite[pXSprite->target];
spritetype* pTarget = &sprite[pXSprite->target_i];
XSPRITE* pXTarget = &xsprite[pTarget->extra];
DUDEINFO* pDudeInfo = &dudeInfo[dudeIdx];
DUDEINFO_EXTRA* pExtra = &gDudeInfoExtra[dudeIdx];
@ -6975,8 +6975,8 @@ void aiPatrolAlarmLite(spritetype* pSprite, XSPRITE* pXTarget) {
}
if (aiInPatrolState(pXDude->aiState)) aiPatrolStop(pDude, pXDude->target);
if (pXDude->target >= 0 || pXDude->target == pXSprite->target)
if (aiInPatrolState(pXDude->aiState)) aiPatrolStop(pDude, pXDude->target_i);
if (pXDude->target_i >= 0 || pXDude->target_i == pXSprite->target_i)
continue;
aiSetTarget(pXDude, pXTarget->reference);
@ -7026,11 +7026,11 @@ void aiPatrolAlarmFull(spritetype* pSprite, XSPRITE* pXTarget, bool chain) {
if (//(nDist1 < hdist || nDist2 < hdist) ||
((nDist1 < sdist && cansee(x1, y1, z1, sect1, x2, y2, z2, sect2)) || (nDist2 < sdist && cansee(x1, y1, z1, sect1, x3, y3, z3, sect3)))) {
if (aiInPatrolState(pXDude->aiState)) aiPatrolStop(pDude, pXDude->target);
if (pXDude->target >= 0 || pXDude->target == pXSprite->target)
if (aiInPatrolState(pXDude->aiState)) aiPatrolStop(pDude, pXDude->target_i);
if (pXDude->target_i >= 0 || pXDude->target_i == pXSprite->target_i)
continue;
if (spriRangeIsFine(pXSprite->target)) aiSetTarget(pXDude, pXSprite->target);
if (spriRangeIsFine(pXSprite->target_i)) aiSetTarget(pXDude, pXSprite->target_i);
else aiSetTarget(pXDude, pSprite->x, pSprite->y, pSprite->z);
aiActivateDude(&bloodActors[pXDude->reference]);
@ -7422,7 +7422,7 @@ void aiPatrolFlagsMgr(spritetype* pSource, XSPRITE* pXSource, spritetype* pDest,
if (aiInPatrolState(pXDest->aiState))
return;
pXDest->target = -1; // reset the target
pXDest->target_i = -1; // reset the target
pXDest->stateTimer = 0;
@ -7452,7 +7452,7 @@ void aiPatrolThink(DBloodActor* actor) {
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
int nTarget, stateTimer, nMarker = pXSprite->target;
int nTarget, stateTimer, nMarker = pXSprite->target_i;
if ((nTarget = aiPatrolSearchTargets(pSprite, pXSprite)) != -1) {
aiPatrolStop(pSprite, nTarget, pXSprite->dudeAmbush);
return;

View file

@ -2040,7 +2040,7 @@ int playerDamageSprite(DBloodActor* source, PLAYER *pPlayer, DAMAGE_TYPE nDamage
nDeathSeqID = 16;
nKneelingPlayer = nPlayerKneelClient;
powerupActivate(pPlayer, kPwUpDeliriumShroom);
pXSprite->target = nSource;
pXSprite->target_i = nSource;
evPost(pSprite->index, 3, 15, kCallbackFinishHim);
}
else

View file

@ -223,7 +223,7 @@ void LifeLeechOperate(spritetype *pSprite, XSPRITE *pXSprite, EVENT event)
}
case kCmdSpriteProximity:
{
int nTarget = pXSprite->target;
int nTarget = pXSprite->target_i;
if (nTarget >= 0 && nTarget < kMaxSprites)
{
if (!pXSprite->stateTimer)
@ -471,7 +471,7 @@ void OperateSprite(int nSprite, XSPRITE *pXSprite, EVENT event)
case kDudeBurningBeast: {
pXSpawn->health = getDudeInfo(pXSprite->data1)->startHealth << 4;
pXSpawn->burnTime = 10;
pXSpawn->target = -1;
pXSpawn->target_i = -1;
aiActivateDude(&bloodActors[pXSpawn->reference]);
break;
default:

View file

@ -1693,7 +1693,7 @@ void FireLifeLeech(int nTrigger, PLAYER *pPlayer)
if (pMissile)
{
XSPRITE *pXSprite = &xsprite[pMissile->extra];
pXSprite->target = pPlayer->aimTarget;
pXSprite->target_i = pPlayer->aimTarget;
pMissile->ang = (nTrigger==2) ? 1024 : 0;
}
if (checkAmmo2(pPlayer, 8, 1))