- a few target_i removed.

# Conflicts:
#	source/games/blood/src/ai.cpp
This commit is contained in:
Christoph Oelckers 2021-09-01 21:52:54 +02:00
parent dc5d32f510
commit 3454fc397e
3 changed files with 16 additions and 9 deletions

View file

@ -1975,8 +1975,10 @@ void aiInitSprite(DBloodActor* actor)
// make dude follow the markers
bool uwater = spriteIsUnderwater(actor);
if (pXSprite->target_i <= 0 || sprite[pXSprite->target_i].type != kMarkerPath) {
pXSprite->target_i = -1; aiPatrolSetMarker(pSprite, pXSprite);
if (pXSprite->target_i <= 0 || sprite[pXSprite->target_i].type != kMarkerPath)
{
actor->SetTarget(nullptr);
aiPatrolSetMarker(pSprite, pXSprite);
}
if (stateTimer > 0) {

View file

@ -2480,7 +2480,7 @@ bool genDudePrepare(DBloodActor* actor, int propId)
bool oldStatus = pExtra->canWalk;
pExtra->canWalk = !!getSequence(i);
if (oldStatus != pExtra->canWalk) {
if (!spriRangeIsFine(pXSprite->target_i))
if (actor->GetTarget() == nullptr)
{
if (spriteIsUnderwater(actor, false)) aiGenDudeNewState(actor, &genDudeIdleW);
else aiGenDudeNewState(actor, &genDudeIdleL);

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_i = -1;
pDudeActor->SetTarget(nullptr);
}
if ((burning || (pSource->flags & kModernTypeFlag3)) && !pXDude->dudeFlag4)
@ -511,7 +511,9 @@ void nnExtInitModernStuff(bool bSaveLoad) {
for (int i = 0; i < kMaxXSprites; i++) {
if (xsprite[i].reference < 0) continue;
XSPRITE* pXSprite = &xsprite[i]; spritetype* pSprite = &sprite[pXSprite->reference];
auto actor = &bloodActors[i];
XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s();
switch (pSprite->type) {
case kModernRandomTX:
@ -711,7 +713,8 @@ 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_i = pXSprite->sysData2 = -1;
pXSprite->targetX = pXSprite->targetY = pXSprite->targetZ = pXSprite->sysData2 = -1;
actor->SetTarget(nullptr);
changespritestat(pSprite->index, kStatModernCondition);
int oldStat = pSprite->cstat; pSprite->cstat = 0x30;
@ -2739,13 +2742,15 @@ 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_i;
auto target = actor->GetTarget();
aiInitSprite(actor);
if (target >= 0) {
if (target != nullptr)
{
pXDude->targetX = x; pXDude->targetY = y; pXDude->targetZ = z;
pXDude->target_i = target; aiActivateDude(&bloodActors[pXDude->reference]);
actor->SetTarget(target);
aiActivateDude(&bloodActors[pXDude->reference]);
}
}