- started cleanup of evPost calls by renaming the internal functions.

This just renames things - no changes in functionality.
This commit is contained in:
Christoph Oelckers 2021-08-26 22:02:55 +02:00
parent 2a1f31581c
commit fbe2373972
13 changed files with 119 additions and 104 deletions

View file

@ -6656,14 +6656,13 @@ DBloodActor* actFireThing(DBloodActor* actor, int a2, int a3, int a4, int thingT
void actBuildMissile(DBloodActor* spawned, DBloodActor* actor)
{
auto pMissile = &spawned->s();
int nMissile = pMissile->index;
switch (pMissile->type)
{
case kMissileLifeLeechRegular:
evPost(nMissile, 3, 0, kCallbackFXFlameLick);
evPost(spawned, 0, kCallbackFXFlameLick);
break;
case kMissileTeslaAlt:
evPost(nMissile, 3, 0, kCallbackFXTeslaAlt);
evPost(spawned, 0, kCallbackFXTeslaAlt);
break;
case kMissilePukeGreen:
seqSpawn(29, spawned, -1);

View file

@ -56,7 +56,7 @@ void sub_71A90(int, DBloodActor* actor)
int nTarget = pTarget->index;
int nOwner = pSprite->owner;
if (pXTarget->burnTime == 0)
evPost(nTarget, 3, 0, kCallbackFXFlameLick);
evPost(actor->GetTarget(), 0, kCallbackFXFlameLick);
actBurnSprite(nOwner, pXTarget, 40);
if (Chance(0x6000))
aiNewState(actor, &tcherno13A9D4);

View file

@ -1890,7 +1890,7 @@ void dudeLeechOperate(DBloodActor* actor, const EVENT& event)
{
missile->SetOwner(actor);
pXSprite->stateTimer = 1;
evPost(pSprite->index, 3, t2, kCallbackLeechStateTimer);
evPost(actor, t2, kCallbackLeechStateTimer);
pXSprite->data3 = ClipLow(pXSprite->data3 - 1, 0);
}
pSprite->ang = angBak;

View file

@ -77,7 +77,8 @@ void FlareBurst(DBloodActor* actor, int) // 2
int nRadius = 0x55555;
for (int i = 0; i < 8; i++)
{
spritetype *pSpawn = &actSpawnSprite(actor, 5)->s();
auto spawnedactor = actSpawnSprite(actor, 5);
spritetype *pSpawn = &spawnedactor->s();
pSpawn->picnum = 2424;
pSpawn->shade = -128;
pSpawn->xrepeat = pSpawn->yrepeat = 32;
@ -97,7 +98,7 @@ void FlareBurst(DBloodActor* actor, int) // 2
xvel[pSpawn->index] += dx;
yvel[pSpawn->index] += dy;
zvel[pSpawn->index] += dz;
evPost(pSpawn->index, 3, 960, kCallbackRemove);
evPost(spawnedactor, 960, kCallbackRemove);
}
evPost(actor, 0, kCallbackRemove);
}
@ -369,7 +370,7 @@ void CounterCheck(DBloodActor*, int nSector) // 12
}
if (nCount < nReq) {
evPost(nSector, 6, 5, kCallbackCounterCheck);
evPostSector(nSector, 5, kCallbackCounterCheck);
return;
} else {
//pXSector->waitTimeA = 0; //do not reset necessary objects counter to zero
@ -519,7 +520,7 @@ void returnFlagToBase(DBloodActor* actor, int) // 17
break;
}
}
evPost(pSprite->index, 3, 0, kCallbackRemove);
evPost(actor, 0, kCallbackRemove);
}
void fxPodBloodSpray(DBloodActor* actor, int) // 18

View file

@ -518,7 +518,7 @@ void evSend(int nIndex, int nType, int rxId, COMMAND_ID command)
//
//---------------------------------------------------------------------------
void evPost(int nIndex, int nType, unsigned int nDelta, COMMAND_ID command)
void evPost_(int nIndex, int nType, unsigned int nDelta, COMMAND_ID command)
{
assert(command != kCmdCallback);
if (command == kCmdState) command = evGetSourceState(nType, nIndex) ? kCmdOn : kCmdOff;
@ -527,7 +527,7 @@ void evPost(int nIndex, int nType, unsigned int nDelta, COMMAND_ID command)
queue.insert(evn);
}
void evPost(int nIndex, int nType, unsigned int nDelta, CALLBACK_ID callback)
void evPost_(int nIndex, int nType, unsigned int nDelta, CALLBACK_ID callback)
{
EVENT evn = { (int16_t)nIndex, (int8_t)nType, kCmdCallback, (int16_t)callback, PlayClock + (int)nDelta };
queue.insert(evn);
@ -536,12 +536,22 @@ void evPost(int nIndex, int nType, unsigned int nDelta, CALLBACK_ID callback)
void evPost(DBloodActor* actor, unsigned int nDelta, COMMAND_ID command)
{
evPost(actor->s().index, 3, nDelta, command);
evPost_(actor->s().index, OBJ_SPRITE, nDelta, command);
}
void evPost(DBloodActor* actor, unsigned int nDelta, CALLBACK_ID callback)
{
evPost(actor->s().index, 3, nDelta, callback);
evPost_(actor->s().index, OBJ_SPRITE, nDelta, callback);
}
void evPostSector(int index, unsigned int nDelta, COMMAND_ID command)
{
evPost_(index, OBJ_SECTOR, nDelta, command);
}
void evPostSector(int index, unsigned int nDelta, CALLBACK_ID callback)
{
evPost_(index, OBJ_SECTOR, nDelta, callback);
}
//---------------------------------------------------------------------------

View file

@ -161,11 +161,14 @@ struct EVENT
void evInit(void);
void evSend(int nIndex, int nType, int rxId, COMMAND_ID command);
void evPost(int nIndex, int nType, unsigned int nDelta, COMMAND_ID command);
void evPost(int nIndex, int nType, unsigned int nDelta, CALLBACK_ID callback);
//void evPost(int nIndex, int nType, unsigned int nDelta, COMMAND_ID command);
//void evPost(int nIndex, int nType, unsigned int nDelta, CALLBACK_ID callback);
void evPost(DBloodActor*, unsigned int nDelta, COMMAND_ID command);
void evPost(DBloodActor*, unsigned int nDelta, CALLBACK_ID callback);
void evPostSector(int index, unsigned int nDelta, COMMAND_ID command);
void evPostSector(int index, unsigned int nDelta, CALLBACK_ID callback);
void evProcess(unsigned int nTime);
void evKill(int a1, int a2);
void evKill(int a1, int a2, CALLBACK_ID a3);

View file

@ -189,7 +189,7 @@ spritetype * CFX::fxSpawn(FX_ID nFx, int nSector, int x, int y, int z, unsigned
if (a6 == 0)
a6 = pFX->ate;
if (a6)
evPost((int)pSprite->index, 3, a6+Random2(a6>>1), kCallbackRemove);
evPost(actor, a6+Random2(a6>>1), kCallbackRemove);
return pSprite;
}
@ -275,11 +275,12 @@ void fxSpawnBlood(spritetype *pSprite, int )
spritetype *pBlood = gFX.fxSpawn(FX_27, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
if (pBlood)
{
auto bloodactor = &bloodActors[pBlood->index];
pBlood->ang = 1024;
xvel[pBlood->index] = Random2(0x6aaaa);
yvel[pBlood->index] = Random2(0x6aaaa);
zvel[pBlood->index] = -(int)Random(0x10aaaa)-100;
evPost(pBlood->index, 3, 8, kCallbackFXBloodSpurt);
bloodactor->xvel() = Random2(0x6aaaa);
bloodactor->yvel() = Random2(0x6aaaa);
bloodactor->zvel() = -(int)Random(0x10aaaa)-100;
evPost(bloodactor, 8, kCallbackFXBloodSpurt);
}
}
@ -299,11 +300,12 @@ void sub_746D4(spritetype *pSprite, int )
pSpawn = gFX.fxSpawn(FX_54, pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 0);
if (pSpawn)
{
auto spawnactor = &bloodActors[pSpawn->index];
pSpawn->ang = 1024;
xvel[pSpawn->index] = Random2(0x6aaaa);
yvel[pSpawn->index] = Random2(0x6aaaa);
zvel[pSpawn->index] = -(int)Random(0x10aaaa)-100;
evPost(pSpawn->index, 3, 8, kCallbackFXPodBloodSpray);
spawnactor->xvel() = Random2(0x6aaaa);
spawnactor->yvel() = Random2(0x6aaaa);
spawnactor->zvel() = -(int)Random(0x10aaaa)-100;
evPost(spawnactor, 8, kCallbackFXPodBloodSpray);
}
}

View file

@ -310,7 +310,7 @@ const char* GameInterface::GenericCheat(int player, int cheat)
case kCheatMcGee:
{
if (!gMe->pXSprite->burnTime)
evPost(gMe->nSprite, 3, 0, kCallbackFXFlameLick);
evPost(gMe->actor(), 0, kCallbackFXFlameLick);
actBurnSprite(gMe->pSprite->index, gMe->pXSprite, 2400);
return GStrings("TXTB_FIRED");
}
@ -323,7 +323,7 @@ const char* GameInterface::GenericCheat(int player, int cheat)
actHealDude(gMe->actor(), 200, 200);
gMe->armor[1] = VanillaMode() ? 200 : 3200;
if (!gMe->pXSprite->burnTime)
evPost(gMe->nSprite, 3, 0, kCallbackFXFlameLick);
evPost(gMe->actor(), 0, kCallbackFXFlameLick);
actBurnSprite(gMe->pSprite->index, gMe->pXSprite, 2400);
return GStrings("TXTB_RETARD");
}

View file

@ -1544,7 +1544,7 @@ void debrisBubble(int nSprite)
}
if (Chance(0x2000))
evPost(nSprite, 3, 0, kCallbackEnemeyBubble);
evPost_(nSprite, 3, 0, kCallbackEnemeyBubble);
}
void debrisMove(int listIndex)
@ -1666,10 +1666,10 @@ void debrisMove(int listIndex)
if (!spriteIsUnderwater(actor)) {
evKill(pSprite->index, 3, kCallbackEnemeyBubble);
} else {
evPost(pSprite->index, 3, 0, kCallbackEnemeyBubble);
evPost_(pSprite->index, 3, 0, kCallbackEnemeyBubble);
for (int i = 2; i <= 5; i++) {
if (Chance(0x5000 * i))
evPost(pSprite->index, 3, Random(5), kCallbackEnemeyBubble);
evPost_(pSprite->index, 3, Random(5), kCallbackEnemeyBubble);
}
}
break;
@ -2259,7 +2259,7 @@ void useObjResizer(XSPRITE* pXSource, short objType, int objIndex) {
gGenDudeExtra[objIndex].updReq[kGenDudePropertyAttack] = true;
gGenDudeExtra[objIndex].updReq[kGenDudePropertyMass] = true;
gGenDudeExtra[objIndex].updReq[kGenDudePropertyDmgScale] = true;
evPost(objIndex, 3, kGenDudeUpdTimeRate, kCallbackGenDudeUpdate);
evPost_(objIndex, 3, kGenDudeUpdTimeRate, kCallbackGenDudeUpdate);
}
@ -2806,7 +2806,7 @@ void useEffectGen(XSPRITE* pXSource, spritetype* pSprite) {
fxId = gEffectGenCallbacks[fxId - kEffectGenCallbackBase];
evKill(pSprite->index, OBJ_SPRITE, (CALLBACK_ID)fxId);
evPost(pSprite->index, OBJ_SPRITE, 0, (CALLBACK_ID)fxId);
evPost_(pSprite->index, OBJ_SPRITE, 0, (CALLBACK_ID)fxId);
}
@ -3082,7 +3082,7 @@ void damageSprites(XSPRITE* pXSource, spritetype* pSprite)
if (pXSprite->burnTime > 0) break;
actBurnSprite(pSource->index, pXSprite, ClipLow(dmg >> 1, 128));
evKill(pSprite->index, OBJ_SPRITE, kCallbackFXFlameLick);
evPost(pSprite->index, OBJ_SPRITE, 0, kCallbackFXFlameLick); // show flames
evPost_(pSprite->index, OBJ_SPRITE, 0, kCallbackFXFlameLick); // show flames
break;
case kDmgElectric:
forceRecoil = true; // show tesla recoil animation
@ -3234,7 +3234,7 @@ void useSeqSpawnerGen(XSPRITE* pXSource, int objType, int index) {
}
// should be: the more is seqs, the shorter is timer
evPost(nSprite, OBJ_SPRITE, 1000, kCallbackRemove);
evPost_(nSprite, OBJ_SPRITE, 1000, kCallbackRemove);
}
} else {
@ -4165,7 +4165,7 @@ char modernTypeSetSpriteState(int nSprite, XSPRITE* pXSprite, int nState) {
evKill(nSprite, 3);
if (pXSprite->restState != nState && pXSprite->waitTime > 0)
evPost(nSprite, 3, (pXSprite->waitTime * 120) / 10, pXSprite->restState ? kCmdOn : kCmdOff);
evPost_(nSprite, 3, (pXSprite->waitTime * 120) / 10, pXSprite->restState ? kCmdOn : kCmdOff);
if (pXSprite->txID != 0 && ((pXSprite->triggerOn && pXSprite->state) || (pXSprite->triggerOff && !pXSprite->state)))
modernTypeSendCommand(nSprite, pXSprite->txID, (COMMAND_ID)pXSprite->command);
@ -4649,7 +4649,7 @@ void sectorContinueMotion(int nSector, EVENT event) {
switch (event.cmd) {
case kCmdOff:
if (pXSector->busy == 0) {
if (pXSector->reTriggerB && waitTimeB) evPost(nSector, OBJ_SECTOR, (waitTimeB * 120) / 10, kCmdOff);
if (pXSector->reTriggerB && waitTimeB) evPost_(nSector, OBJ_SECTOR, (waitTimeB * 120) / 10, kCmdOff);
return;
}
pXSector->state = 1;
@ -4657,7 +4657,7 @@ void sectorContinueMotion(int nSector, EVENT event) {
break;
case kCmdOn:
if (pXSector->busy == 65536) {
if (pXSector->reTriggerA && waitTimeA) evPost(nSector, OBJ_SECTOR, (waitTimeA * 120) / 10, kCmdOn);
if (pXSector->reTriggerA && waitTimeA) evPost_(nSector, OBJ_SECTOR, (waitTimeA * 120) / 10, kCmdOn);
return;
}
pXSector->state = 0;
@ -4727,7 +4727,7 @@ bool modernTypeOperateSector(int nSector, sectortype* pSector, XSECTOR* pXSector
case kSectorCounter:
if (pXSector->locked != 1) break;
SetSectorState(nSector, pXSector, 0);
evPost(nSector, 6, 0, kCallbackCounterCheck);
evPost_(nSector, 6, 0, kCallbackCounterCheck);
break;
}
@ -4835,8 +4835,8 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite
else aiPatrolFlagsMgr(&sprite[event.index], &xsprite[sprite[event.index].extra], pSprite, pXSprite, false, true); // initialize patrol dude with possible new flags
break;
default:
if (!pXSprite->state) evPost(nSprite, OBJ_SPRITE, 0, kCmdOn);
else evPost(nSprite, OBJ_SPRITE, 0, kCmdOff);
if (!pXSprite->state) evPost_(nSprite, OBJ_SPRITE, 0, kCmdOn);
else evPost_(nSprite, OBJ_SPRITE, 0, kCmdOff);
break;
}
@ -4904,11 +4904,11 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite
}
if (pXSprite->busyTime > 0)
evPost(nSprite, 3, pXSprite->busyTime, kCmdRepeat);
evPost_(nSprite, 3, pXSprite->busyTime, kCmdRepeat);
break;
default:
if (pXSprite->state == 0) evPost(nSprite, 3, 0, kCmdOn);
else evPost(nSprite, 3, 0, kCmdOff);
if (pXSprite->state == 0) evPost_(nSprite, 3, 0, kCmdOn);
else evPost_(nSprite, 3, 0, kCmdOff);
break;
}
return true;
@ -4952,11 +4952,11 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite
else useEffectGen(pXSprite, NULL);
if (pXSprite->busyTime > 0)
evPost(nSprite, 3, ClipLow((int(pXSprite->busyTime) + Random2(pXSprite->data1)) * 120 / 10, 0), kCmdRepeat);
evPost_(nSprite, 3, ClipLow((int(pXSprite->busyTime) + Random2(pXSprite->data1)) * 120 / 10, 0), kCmdRepeat);
break;
default:
if (pXSprite->state == 0) evPost(nSprite, 3, 0, kCmdOn);
else evPost(nSprite, 3, 0, kCmdOff);
if (pXSprite->state == 0) evPost_(nSprite, 3, 0, kCmdOn);
else evPost_(nSprite, 3, 0, kCmdOff);
break;
}
return true;
@ -4974,11 +4974,11 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite
if (pXSprite->txID > 0) modernTypeSendCommand(nSprite, pXSprite->txID, (COMMAND_ID)pXSprite->command);
else useSectorWindGen(pXSprite, NULL);
if (pXSprite->busyTime > 0) evPost(nSprite, 3, pXSprite->busyTime, kCmdRepeat);
if (pXSprite->busyTime > 0) evPost_(nSprite, 3, pXSprite->busyTime, kCmdRepeat);
break;
default:
if (pXSprite->state == 0) evPost(nSprite, 3, 0, kCmdOn);
else evPost(nSprite, 3, 0, kCmdOff);
if (pXSprite->state == 0) evPost_(nSprite, 3, 0, kCmdOn);
else evPost_(nSprite, 3, 0, kCmdOff);
break;
}
return true;
@ -5001,17 +5001,17 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite
case kCmdRepeat:
if (pXSprite->txID <= 0 || !aiFightGetDudesForBattle(pXSprite)) {
aiFightFreeAllTargets(pXSprite);
evPost(nSprite, 3, 0, kCmdOff);
evPost_(nSprite, 3, 0, kCmdOff);
break;
} else {
modernTypeSendCommand(nSprite, pXSprite->txID, (COMMAND_ID)pXSprite->command);
}
if (pXSprite->busyTime > 0) evPost(nSprite, 3, pXSprite->busyTime, kCmdRepeat);
if (pXSprite->busyTime > 0) evPost_(nSprite, 3, pXSprite->busyTime, kCmdRepeat);
break;
default:
if (pXSprite->state == 0) evPost(nSprite, 3, 0, kCmdOn);
else evPost(nSprite, 3, 0, kCmdOff);
if (pXSprite->state == 0) evPost_(nSprite, 3, 0, kCmdOn);
else evPost_(nSprite, 3, 0, kCmdOff);
break;
}
pXSprite->dropMsg = uint8_t(pXSprite->data4);
@ -5028,16 +5028,16 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite
case kCmdRepeat:
// force OFF after *all* TX objects reach the goal value
if (pSprite->flags == kModernTypeFlag0 && incDecGoalValueIsReached(pXSprite)) {
evPost(nSprite, 3, 0, kCmdOff);
evPost_(nSprite, 3, 0, kCmdOff);
break;
}
modernTypeSendCommand(nSprite, pXSprite->txID, (COMMAND_ID)pXSprite->command);
if (pXSprite->busyTime > 0) evPost(nSprite, 3, pXSprite->busyTime, kCmdRepeat);
if (pXSprite->busyTime > 0) evPost_(nSprite, 3, pXSprite->busyTime, kCmdRepeat);
break;
default:
if (pXSprite->state == 0) evPost(nSprite, 3, 0, kCmdOn);
else evPost(nSprite, 3, 0, kCmdOff);
if (pXSprite->state == 0) evPost_(nSprite, 3, 0, kCmdOn);
else evPost_(nSprite, 3, 0, kCmdOff);
break;
}
return true;
@ -5054,11 +5054,11 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite
case kCmdRepeat:
useRandomItemGen(pSprite, pXSprite);
if (pXSprite->busyTime > 0)
evPost(nSprite, 3, (120 * pXSprite->busyTime) / 10, kCmdRepeat);
evPost_(nSprite, 3, (120 * pXSprite->busyTime) / 10, kCmdRepeat);
break;
default:
if (pXSprite->state == 0) evPost(nSprite, 3, 0, kCmdOn);
else evPost(nSprite, 3, 0, kCmdOff);
if (pXSprite->state == 0) evPost_(nSprite, 3, 0, kCmdOn);
else evPost_(nSprite, 3, 0, kCmdOff);
break;
}
return true;
@ -5068,7 +5068,7 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite
case kCmdSpriteProximity:
if (pXSprite->state) break;
sfxPlay3DSound(pSprite, 452, 0, 0);
evPost(nSprite, 3, 30, kCmdOff);
evPost_(nSprite, 3, 30, kCmdOff);
pXSprite->state = 1;
fallthrough__;
case kCmdOn:
@ -5196,11 +5196,11 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite
else useSoundGen(pXSprite, pSprite);
if (pXSprite->busyTime > 0)
evPost(nSprite, 3, (120 * pXSprite->busyTime) / 10, kCmdRepeat);
evPost_(nSprite, 3, (120 * pXSprite->busyTime) / 10, kCmdRepeat);
break;
default:
if (pXSprite->state == 0) evPost(nSprite, 3, 0, kCmdOn);
else evPost(nSprite, 3, 0, kCmdOff);
if (pXSprite->state == 0) evPost_(nSprite, 3, 0, kCmdOn);
else evPost_(nSprite, 3, 0, kCmdOff);
break;
}
return true;
@ -5218,12 +5218,12 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite
else useUniMissileGen(pXSprite, pSprite);
if (pXSprite->busyTime > 0)
evPost(nSprite, 3, (120 * pXSprite->busyTime) / 10, kCmdRepeat);
evPost_(nSprite, 3, (120 * pXSprite->busyTime) / 10, kCmdRepeat);
break;
default:
if (pXSprite->state == 0) evPost(nSprite, 3, 0, kCmdOn);
else evPost(nSprite, 3, 0, kCmdOff);
if (pXSprite->state == 0) evPost_(nSprite, 3, 0, kCmdOn);
else evPost_(nSprite, 3, 0, kCmdOff);
break;
}
return true;
@ -5409,7 +5409,7 @@ int useCondition(spritetype* pSource, XSPRITE* pXSource, EVENT event) {
pXSource->restState = 1;
evKill(pSource->index, OBJ_SPRITE);
evPost(pSource->index, OBJ_SPRITE, (pXSource->waitTime * 120) / 10, kCmdRepeat);
evPost_(pSource->index, OBJ_SPRITE, (pXSource->waitTime * 120) / 10, kCmdRepeat);
return -1;
}
@ -5575,7 +5575,7 @@ void useUniMissileGen(XSPRITE* pXSource, spritetype* pSprite) {
// add bursting for missiles
if (pMissile->type != kMissileFlareAlt && pXSource->data4 > 0)
evPost(pMissile->index, 3, ClipHigh(pXSource->data4, 500), kCallbackMissileBurst);
evPost_(pMissile->index, 3, ClipHigh(pXSource->data4, 500), kCallbackMissileBurst);
}
@ -6432,7 +6432,7 @@ bool setDataValueOfObject(int objType, int objIndex, int dataIndex, int value) {
case kDudeModernCustomBurning:
gGenDudeExtra[objIndex].updReq[kGenDudePropertyWeapon] = true;
gGenDudeExtra[objIndex].updReq[kGenDudePropertyDmgScale] = true;
evPost(objIndex, 3, kGenDudeUpdTimeRate, kCallbackGenDudeUpdate);
evPost_(objIndex, 3, kGenDudeUpdTimeRate, kCallbackGenDudeUpdate);
break;
}
return true;
@ -6446,7 +6446,7 @@ bool setDataValueOfObject(int objType, int objIndex, int dataIndex, int value) {
gGenDudeExtra[objIndex].updReq[kGenDudePropertyDmgScale] = true;
gGenDudeExtra[objIndex].updReq[kGenDudePropertyStates] = true;
gGenDudeExtra[objIndex].updReq[kGenDudePropertyAttack] = true;
evPost(objIndex, 3, kGenDudeUpdTimeRate, kCallbackGenDudeUpdate);
evPost_(objIndex, 3, kGenDudeUpdTimeRate, kCallbackGenDudeUpdate);
break;
}
return true;
@ -7851,7 +7851,7 @@ void callbackUniMissileBurst(DBloodActor* actor, int) // 22
pBurst->cstat = pSprite->cstat;
if ((pBurst->cstat & CSTAT_SPRITE_BLOCK)) {
pBurst->cstat &= ~CSTAT_SPRITE_BLOCK; // we don't want missiles impact each other
evPost(pBurst->index, 3, 100, kCallbackMissileSpriteBlock); // so set blocking flag a bit later
evPost_(pBurst->index, 3, 100, kCallbackMissileSpriteBlock); // so set blocking flag a bit later
}
pBurst->pal = pSprite->pal;
@ -7877,7 +7877,7 @@ void callbackUniMissileBurst(DBloodActor* actor, int) // 22
xvel[pBurst->index] += dx;
yvel[pBurst->index] += dy;
zvel[pBurst->index] += dz;
evPost(pBurst->index, 3, 960, kCallbackRemove);
evPost_(pBurst->index, 3, 960, kCallbackRemove);
}
evPost(actor, 0, kCallbackRemove);
}

View file

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

View file

@ -663,7 +663,7 @@ void seqProcess(int nTicks)
{
evKill(nSprite, SS_SPRITE);
if ((sprite[nSprite].hitag & kAttrRespawn) != 0 && (sprite[nSprite].inittype >= kDudeBase && sprite[nSprite].inittype < kDudeMax))
evPost(nSprite, 3, gGameOptions.nMonsterRespawnTime, kCallbackRespawn);
evPost_(nSprite, 3, gGameOptions.nMonsterRespawnTime, kCallbackRespawn);
else deletesprite(nSprite); // safe to not use actPostSprite here
}
}

View file

@ -62,11 +62,11 @@ char SetSpriteState(int nSprite, XSPRITE* pXSprite, int nState)
if ((sprite[nSprite].flags & kHitagRespawn) != 0 && sprite[nSprite].inittype >= kDudeBase && sprite[nSprite].inittype < kDudeMax)
{
pXSprite->respawnPending = 3;
evPost(nSprite, 3, gGameOptions.nMonsterRespawnTime, kCallbackRespawn);
evPost_(nSprite, 3, gGameOptions.nMonsterRespawnTime, kCallbackRespawn);
return 1;
}
if (pXSprite->restState != nState && pXSprite->waitTime > 0)
evPost(nSprite, 3, (pXSprite->waitTime * 120) / 10, pXSprite->restState ? kCmdOn : kCmdOff);
evPost_(nSprite, 3, (pXSprite->waitTime * 120) / 10, pXSprite->restState ? kCmdOn : kCmdOff);
if (pXSprite->txID)
{
if (pXSprite->command != kCmdLink && pXSprite->triggerOn && pXSprite->state)
@ -87,7 +87,7 @@ char SetWallState(int nWall, XWALL *pXWall, int nState)
pXWall->state = nState;
evKill(nWall, 0);
if (pXWall->restState != nState && pXWall->waitTime > 0)
evPost(nWall, 0, (pXWall->waitTime*120) / 10, pXWall->restState ? kCmdOn : kCmdOff);
evPost_(nWall, 0, (pXWall->waitTime*120) / 10, pXWall->restState ? kCmdOn : kCmdOff);
if (pXWall->txID)
{
if (pXWall->command != kCmdLink && pXWall->triggerOn && pXWall->state)
@ -115,7 +115,7 @@ char SetSectorState(int nSector, XSECTOR *pXSector, int nState)
pXSector->stopOff = 0;
}
else if (pXSector->reTriggerA)
evPost(nSector, 6, (pXSector->waitTimeA * 120) / 10, kCmdOff);
evPost_(nSector, 6, (pXSector->waitTimeA * 120) / 10, kCmdOff);
}
else
{
@ -127,7 +127,7 @@ char SetSectorState(int nSector, XSECTOR *pXSector, int nState)
pXSector->stopOff = 0;
}
else if (pXSector->reTriggerB)
evPost(nSector, 6, (pXSector->waitTimeB * 120) / 10, kCmdOn);
evPost_(nSector, 6, (pXSector->waitTimeB * 120) / 10, kCmdOn);
}
return 1;
}
@ -264,7 +264,7 @@ void LifeLeechOperate(spritetype *pSprite, XSPRITE *pXSprite, EVENT event)
{
missile->SetOwner(actor);
pXSprite->stateTimer = 1;
evPost(pSprite->index, 3, t2, kCallbackLeechStateTimer);
evPost_(pSprite->index, 3, t2, kCallbackLeechStateTimer);
pXSprite->data3 = ClipLow(pXSprite->data3-1, 0);
}
pSprite->ang = angBak;
@ -520,7 +520,7 @@ void OperateSprite(int nSprite, XSPRITE *pXSprite, EVENT event)
if (event.cmd != kCmdOn) actExplodeSprite(&bloodActors[pSprite->index]);
else {
sfxPlay3DSound(pSprite, 454, 0, 0);
evPost(nSprite, 3, 18, kCmdOff);
evPost_(nSprite, 3, 18, kCmdOff);
}
}
break;
@ -530,7 +530,7 @@ void OperateSprite(int nSprite, XSPRITE *pXSprite, EVENT event)
case kCmdSpriteProximity:
if (pXSprite->state) break;
sfxPlay3DSound(pSprite, 452, 0, 0);
evPost(nSprite, 3, 30, kCmdOff);
evPost_(nSprite, 3, 30, kCmdOff);
pXSprite->state = 1;
fallthrough__;
case kCmdOn:
@ -564,13 +564,13 @@ void OperateSprite(int nSprite, XSPRITE *pXSprite, EVENT event)
if (pXSprite->txID) evSend(nSprite, 3, pXSprite->txID, (COMMAND_ID)pXSprite->command);
if (pXSprite->busyTime > 0) {
int nRand = Random2(pXSprite->data1);
evPost(nSprite, 3, 120*(nRand+pXSprite->busyTime) / 10, kCmdRepeat);
evPost_(nSprite, 3, 120*(nRand+pXSprite->busyTime) / 10, kCmdRepeat);
}
break;
default:
if (!pXSprite->state) {
SetSpriteState(nSprite, pXSprite, 1);
evPost(nSprite, 3, 0, kCmdRepeat);
evPost_(nSprite, 3, 0, kCmdRepeat);
}
break;
}
@ -1365,7 +1365,7 @@ int PathBusy(unsigned int nSector, unsigned int a2)
pXSector->busy = a2;
if ((a2&0xffff) == 0)
{
evPost(nSector, 6, (120*pXSprite2->waitTime)/10, kCmdOn);
evPost_(nSector, 6, (120*pXSprite2->waitTime)/10, kCmdOn);
pXSector->state = 0;
pXSector->busy = 0;
if (pXSprite1->data4)
@ -1657,7 +1657,7 @@ void InitPath(unsigned int nSector, XSECTOR *pXSector)
pXSector->marker0 = nSprite;
basePath[nSector] = nSprite;
if (pXSector->state)
evPost(nSector, 6, 0, kCmdOn);
evPost_(nSector, 6, 0, kCmdOn);
}
void LinkSector(int nSector, XSECTOR *pXSector, EVENT event)
@ -2054,7 +2054,7 @@ void trInit(void)
else
#endif
pXSector->triggerOnce = 1;
evPost(i, 6, 0, kCallbackCounterCheck);
evPost_(i, 6, 0, kCallbackCounterCheck);
break;
case kSectorZMotion:
case kSectorZMotionSprite:
@ -2130,9 +2130,9 @@ void trInit(void)
case kModernRandom:
case kModernRandom2:
if (!gModernMap || pXSprite->state == pXSprite->restState) break;
evPost(i, 3, (120 * pXSprite->busyTime) / 10, kCmdRepeat);
evPost_(i, 3, (120 * pXSprite->busyTime) / 10, kCmdRepeat);
if (pXSprite->waitTime > 0)
evPost(i, 3, (pXSprite->waitTime * 120) / 10, pXSprite->restState ? kCmdOn : kCmdOff);
evPost_(i, 3, (pXSprite->waitTime * 120) / 10, pXSprite->restState ? kCmdOn : kCmdOff);
break;
case kModernSeqSpawner:
case kModernObjDataAccumulator:
@ -2140,9 +2140,9 @@ void trInit(void)
case kModernEffectSpawner:
case kModernWindGenerator:
if (pXSprite->state == pXSprite->restState) break;
evPost(i, 3, 0, kCmdRepeat);
evPost_(i, 3, 0, kCmdRepeat);
if (pXSprite->waitTime > 0)
evPost(i, 3, (pXSprite->waitTime * 120) / 10, pXSprite->restState ? kCmdOn : kCmdOff);
evPost_(i, 3, (pXSprite->waitTime * 120) / 10, pXSprite->restState ? kCmdOn : kCmdOff);
break;
#endif
case kGenTrigger:
@ -2206,7 +2206,7 @@ void InitGenerator(int nSprite)
break;
}
if (pXSprite->state != pXSprite->restState && pXSprite->busyTime > 0)
evPost(nSprite, 3, (120*(pXSprite->busyTime+Random2(pXSprite->data1)))/10, kCmdRepeat);
evPost_(nSprite, 3, (120*(pXSprite->busyTime+Random2(pXSprite->data1)))/10, kCmdRepeat);
}
void ActivateGenerator(int nSprite)
@ -2273,7 +2273,7 @@ void MGunFireSeqCallback(int, DBloodActor* actor)
{
pXSprite->data2--;
if (pXSprite->data2 == 0)
evPost(pXSprite->reference, 3, 1, kCmdOff);
evPost_(pXSprite->reference, 3, 1, kCmdOff);
}
int dx = CosScale16(pSprite->ang)+Random2(1000);
int dy = SinScale16(pSprite->ang)+Random2(1000);

View file

@ -1086,7 +1086,7 @@ void ThrowCan(int, PLAYER *pPlayer)
if (pSprite)
{
sfxPlay3DSound(pSprite, 441, 0, 0);
evPost(pSprite->index, 3, pPlayer->fuseTime, kCmdOn);
evPost_(pSprite->index, 3, pPlayer->fuseTime, kCmdOn);
int nXSprite = pSprite->extra;
XSPRITE *pXSprite = &xsprite[nXSprite];
pXSprite->Impact = 1;
@ -1101,7 +1101,7 @@ void DropCan(int, PLAYER *pPlayer)
spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedSpray, 0);
if (pSprite)
{
evPost(pSprite->index, 3, pPlayer->fuseTime, kCmdOn);
evPost_(pSprite->index, 3, pPlayer->fuseTime, kCmdOn);
UseAmmo(pPlayer, 6, gAmmoItemData[0].count);
}
}
@ -1110,7 +1110,7 @@ void ExplodeCan(int, PLAYER *pPlayer)
{
sfxKill3DSound(pPlayer->pSprite, -1, 441);
spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedSpray, 0);
evPost(pSprite->index, 3, 0, kCmdOn);
evPost_(pSprite->index, 3, 0, kCmdOn);
UseAmmo(pPlayer, 6, gAmmoItemData[0].count);
StartQAV(pPlayer, kQAVCANBOOM);
pPlayer->curWeapon = kWeapNone;
@ -1128,7 +1128,7 @@ void ThrowBundle(int, PLAYER *pPlayer)
if (pPlayer->fuseTime < 0)
pXSprite->Impact = 1;
else
evPost(pSprite->index, 3, pPlayer->fuseTime, kCmdOn);
evPost_(pSprite->index, 3, pPlayer->fuseTime, kCmdOn);
UseAmmo(pPlayer, 5, 1);
pPlayer->throwPower = 0;
}
@ -1137,7 +1137,7 @@ void DropBundle(int, PLAYER *pPlayer)
{
sfxKill3DSound(pPlayer->pSprite, 16, -1);
spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedTNTBundle, 0);
evPost(pSprite->index, 3, pPlayer->fuseTime, kCmdOn);
evPost_(pSprite->index, 3, pPlayer->fuseTime, kCmdOn);
UseAmmo(pPlayer, 5, 1);
}
@ -1145,7 +1145,7 @@ void ExplodeBundle(int, PLAYER *pPlayer)
{
sfxKill3DSound(pPlayer->pSprite, 16, -1);
spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedTNTBundle, 0);
evPost(pSprite->index, 3, 0, kCmdOn);
evPost_(pSprite->index, 3, 0, kCmdOn);
UseAmmo(pPlayer, 5, 1);
StartQAV(pPlayer, kQAVDYNEXPLO);
pPlayer->curWeapon = kWeapNone;
@ -1157,7 +1157,7 @@ void ThrowProx(int, PLAYER *pPlayer)
int nSpeed = MulScale(pPlayer->throwPower, 0x177777, 16)+0x66666;
sfxPlay3DSound(pPlayer->pSprite, 455, 1, 0);
spritetype *pSprite = playerFireThing(pPlayer, 0, -9460, kThingArmedProxBomb, nSpeed);
evPost(pSprite->index, 3, 240, kCmdOn);
evPost_(pSprite->index, 3, 240, kCmdOn);
UseAmmo(pPlayer, 10, 1);
pPlayer->throwPower = 0;
}
@ -1165,7 +1165,7 @@ void ThrowProx(int, PLAYER *pPlayer)
void DropProx(int, PLAYER *pPlayer)
{
spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedProxBomb, 0);
evPost(pSprite->index, 3, 240, kCmdOn);
evPost_(pSprite->index, 3, 240, kCmdOn);
UseAmmo(pPlayer, 10, 1);
}
@ -1577,7 +1577,7 @@ void DropVoodoo(int , PLAYER *pPlayer)
int nXSprite = pSprite->extra;
XSPRITE *pXSprite = &xsprite[nXSprite];
pXSprite->data1 = pPlayer->ammoCount[9];
evPost(pSprite->index, 3, 90, kCallbackDropVoodoo);
evPost_(pSprite->index, 3, 90, kCallbackDropVoodoo);
UseAmmo(pPlayer, 6, gAmmoItemData[0].count);
UseAmmo(pPlayer, 9, pPlayer->ammoCount[9]);
pPlayer->hasWeapon[10] = 0;
@ -1679,7 +1679,7 @@ void AltFireNapalm(int , PLAYER *pPlayer)
UseAmmo(pPlayer, 4, pXSprite->data4);
seqSpawn(22, 3, pMissile->extra, -1);
actBurnSprite(pPlayer->pSprite->index, pXSprite, 600);
evPost(pMissile->index, 3, 0, kCallbackFXFlameLick);
evPost_(pMissile->index, 3, 0, kCallbackFXFlameLick);
sfxPlay3DSound(pMissile, 480, 2, 0);
pPlayer->visibility = 30;
pPlayer->flashEffect = 1;
@ -1722,7 +1722,7 @@ void AltFireLifeLeech(int , PLAYER *pPlayer)
pXSprite->DudeLockout = 1;
pXSprite->data4 = ClipHigh(pPlayer->ammoCount[4], 12);
pXSprite->stateTimer = 1;
evPost(pMissile->index, 3, 120, kCallbackLeechStateTimer);
evPost_(pMissile->index, 3, 120, kCallbackLeechStateTimer);
if (gGameOptions.nGameType <= 1)
{
int nAmmo = pPlayer->ammoCount[8];