- fixed map-spawned actor indexing in Blood.

This is needed for error reporting and the secret hint system.
This commit is contained in:
Christoph Oelckers 2021-10-24 09:11:43 +02:00
parent d101a2b51f
commit 7ebe492e94
3 changed files with 4 additions and 1 deletions

View file

@ -37,7 +37,7 @@ public:
int& xvel() { return Blood::xvel[index]; }
int& yvel() { return Blood::yvel[index]; }
int& zvel() { return Blood::zvel[index]; }
int GetIndex() { return s().index; } // this is for error printing only!
int GetIndex() { return s().time; } // For error printing only! This is only identical with the sprite index for items spawned at map start.
GENDUDEEXTRA& genDudeExtra() { return Blood::gGenDudeExtra[index]; }
POINT3D& basePoint() { return Blood::baseSprite[index]; }

View file

@ -848,6 +848,7 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, shor
}
}
initspritelists();
leveltimer = mapHeader.numsprites;
for (int i = 0; i < mapHeader.numsprites; i++)
{
RemoveSpriteStat(i);
@ -883,6 +884,7 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, shor
pSprite->detail = load.detail;
pSprite->shade = load.shade;
pSprite->blend = 0;
pSprite->time = i;
InsertSpriteSect(i, sprite[i].sectnum);
InsertSpriteStat(i, sprite[i].statnum);

View file

@ -394,6 +394,7 @@ void evSend(DBloodActor* actor, int nIndex, int nType, int rxId, COMMAND_ID comm
else viewSetSystemMessage("Invalid Total-Secrets command by xobject #%d (object type %d)", nIndex, nType);
break;
case kChannelSecretFound:
if (actor != nullptr) nIndex = actor->GetIndex(); // the hint system needs the sprite index.
if (SECRET_Trigger(nIndex + 65536 * nType)) // if the hint system knows this secret it's a retrigger - skip that.
{
if (command >= kCmdNumberic)