mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
- renamed evKill and added an actor pointer to EVENT struct.
This commit is contained in:
parent
1e1764eda6
commit
77c827e817
6 changed files with 34 additions and 33 deletions
|
@ -523,13 +523,13 @@ void evPost_(int nIndex, int nType, unsigned int nDelta, COMMAND_ID command)
|
|||
assert(command != kCmdCallback);
|
||||
if (command == kCmdState) command = evGetSourceState(nType, nIndex) ? kCmdOn : kCmdOff;
|
||||
else if (command == kCmdNotState) command = evGetSourceState(nType, nIndex) ? kCmdOff : kCmdOn;
|
||||
EVENT evn = { (int16_t)nIndex, (int8_t)nType, (int8_t)command, 0, PlayClock + (int)nDelta };
|
||||
EVENT evn = {nullptr, (int16_t)nIndex, (int8_t)nType, (int8_t)command, 0, PlayClock + (int)nDelta };
|
||||
queue.insert(evn);
|
||||
}
|
||||
|
||||
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 };
|
||||
EVENT evn = {nullptr, (int16_t)nIndex, (int8_t)nType, kCmdCallback, (int16_t)callback, PlayClock + (int)nDelta };
|
||||
queue.insert(evn);
|
||||
}
|
||||
|
||||
|
@ -560,7 +560,7 @@ void evPostSector(int index, unsigned int nDelta, CALLBACK_ID callback)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void evKill(int index, int type)
|
||||
void evKill_(int index, int type)
|
||||
{
|
||||
for (auto ev = queue.begin(); ev != queue.end();)
|
||||
{
|
||||
|
@ -569,7 +569,7 @@ void evKill(int index, int type)
|
|||
}
|
||||
}
|
||||
|
||||
void evKill(int index, int type, CALLBACK_ID cb)
|
||||
void evKill_(int index, int type, CALLBACK_ID cb)
|
||||
{
|
||||
for (auto ev = queue.begin(); ev != queue.end();)
|
||||
{
|
||||
|
@ -580,12 +580,12 @@ void evKill(int index, int type, CALLBACK_ID cb)
|
|||
|
||||
void evKill(DBloodActor* actor)
|
||||
{
|
||||
evKill(actor->s().index, 3);
|
||||
evKill_(actor->s().index, 3);
|
||||
}
|
||||
|
||||
void evKill(DBloodActor* actor, CALLBACK_ID cb)
|
||||
{
|
||||
evKill(actor->s().index, 3, cb);
|
||||
evKill_(actor->s().index, 3, cb);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -73,7 +73,8 @@ enum {
|
|||
|
||||
struct RXBUCKET
|
||||
{
|
||||
uint16_t index;
|
||||
DBloodActor* actor;
|
||||
int index;
|
||||
uint8_t type;
|
||||
};
|
||||
extern RXBUCKET rxBucket[];
|
||||
|
@ -147,6 +148,7 @@ inline bool channelRangeIsFine(int channel) {
|
|||
|
||||
struct EVENT
|
||||
{
|
||||
DBloodActor* actor;
|
||||
int16_t index;
|
||||
int8_t type;
|
||||
int8_t cmd;
|
||||
|
@ -170,8 +172,8 @@ 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);
|
||||
void evKill_(int a1, int a2);
|
||||
void evKill_(int a1, int a2, CALLBACK_ID a3);
|
||||
void evKill(DBloodActor*);
|
||||
void evKill(DBloodActor*, CALLBACK_ID a3);
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ void CFX::destroy(int nSprite)
|
|||
{
|
||||
if (nSprite < 0 || nSprite >= kMaxSprites)
|
||||
return;
|
||||
evKill(nSprite, 3);
|
||||
evKill_(nSprite, 3);
|
||||
if (sprite[nSprite].extra > 0)
|
||||
seqKill(3, sprite[nSprite].extra);
|
||||
DeleteSprite(nSprite);
|
||||
|
@ -355,5 +355,4 @@ void fxPrecache()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -1321,7 +1321,7 @@ void nnExtProcessSuperSprites() {
|
|||
pXDebris->goalAng = getangle(xvel[idx], yvel[idx]) & 2047;
|
||||
|
||||
int ang = pDebris->ang & 2047;
|
||||
if ((uwater = spriteIsUnderwater(debrisactor)) == false) evKill(idx, 3, kCallbackEnemeyBubble);
|
||||
if ((uwater = spriteIsUnderwater(debrisactor)) == false) evKill_(idx, 3, kCallbackEnemeyBubble);
|
||||
else if (Chance(0x1000 - mass)) {
|
||||
|
||||
if (zvel[idx] > 0x100) debrisBubble(idx);
|
||||
|
@ -1664,7 +1664,7 @@ void debrisMove(int listIndex)
|
|||
int pitch = (150000 - (actor->spriteMass.mass << 9)) + Random3(8192);
|
||||
sfxPlay3DSoundCP(pSprite, 720, -1, 0, pitch, 75 - Random(40));
|
||||
if (!spriteIsUnderwater(actor)) {
|
||||
evKill(pSprite->index, 3, kCallbackEnemeyBubble);
|
||||
evKill_(pSprite->index, 3, kCallbackEnemeyBubble);
|
||||
} else {
|
||||
evPost_(pSprite->index, 3, 0, kCallbackEnemeyBubble);
|
||||
for (int i = 2; i <= 5; i++) {
|
||||
|
@ -2805,7 +2805,7 @@ void useEffectGen(XSPRITE* pXSource, spritetype* pSprite) {
|
|||
if (fxId < kEffectGenCallbackBase + length) {
|
||||
|
||||
fxId = gEffectGenCallbacks[fxId - kEffectGenCallbackBase];
|
||||
evKill(pSprite->index, OBJ_SPRITE, (CALLBACK_ID)fxId);
|
||||
evKill_(pSprite->index, OBJ_SPRITE, (CALLBACK_ID)fxId);
|
||||
evPost_(pSprite->index, OBJ_SPRITE, 0, (CALLBACK_ID)fxId);
|
||||
|
||||
}
|
||||
|
@ -3082,14 +3082,14 @@ void damageSprites(XSPRITE* pXSource, spritetype* pSprite)
|
|||
case kDmgBurn:
|
||||
if (pXSprite->burnTime > 0) break;
|
||||
actBurnSprite(pSource->index, pXSprite, ClipLow(dmg >> 1, 128));
|
||||
evKill(pSprite->index, OBJ_SPRITE, kCallbackFXFlameLick);
|
||||
evKill_(pSprite->index, OBJ_SPRITE, kCallbackFXFlameLick);
|
||||
evPost_(pSprite->index, OBJ_SPRITE, 0, kCallbackFXFlameLick); // show flames
|
||||
break;
|
||||
case kDmgElectric:
|
||||
forceRecoil = true; // show tesla recoil animation
|
||||
break;
|
||||
case kDmgBullet:
|
||||
evKill(pSprite->index, OBJ_SPRITE, kCallbackFXBloodSpurt);
|
||||
evKill_(pSprite->index, OBJ_SPRITE, kCallbackFXBloodSpurt);
|
||||
for (int i = 1; i < 6; i++) {
|
||||
|
||||
if (Chance(0x16000 >> i))
|
||||
|
@ -4164,7 +4164,7 @@ char modernTypeSetSpriteState(int nSprite, XSPRITE* pXSprite, int nState) {
|
|||
pXSprite->busy = IntToFixed(nState);
|
||||
pXSprite->state = nState;
|
||||
|
||||
evKill(nSprite, 3);
|
||||
evKill_(nSprite, 3);
|
||||
if (pXSprite->restState != nState && pXSprite->waitTime > 0)
|
||||
evPost_(nSprite, 3, (pXSprite->waitTime * 120) / 10, pXSprite->restState ? kCmdOn : kCmdOff);
|
||||
|
||||
|
@ -4605,7 +4605,7 @@ void sectorPauseMotion(int nSector) {
|
|||
XSECTOR* pXSector = &xsector[sector[nSector].extra];
|
||||
pXSector->unused1 = 1;
|
||||
|
||||
evKill(nSector, OBJ_SECTOR);
|
||||
evKill_(nSector, OBJ_SECTOR);
|
||||
|
||||
sectorKillSounds(nSector);
|
||||
if ((pXSector->busy == 0 && !pXSector->state) || (pXSector->busy == 65536 && pXSector->state))
|
||||
|
@ -4890,7 +4890,7 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite
|
|||
if (pXSprite->state == 1) SetSpriteState(nSprite, pXSprite, 0);
|
||||
break;
|
||||
case kCmdOn:
|
||||
evKill(nSprite, 3); // queue overflow protect
|
||||
evKill_(nSprite, 3); // queue overflow protect
|
||||
if (pXSprite->state == 0) SetSpriteState(nSprite, pXSprite, 1);
|
||||
fallthrough__;
|
||||
case kCmdRepeat:
|
||||
|
@ -4943,7 +4943,7 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite
|
|||
if (pXSprite->state == 1) SetSpriteState(nSprite, pXSprite, 0);
|
||||
break;
|
||||
case kCmdOn:
|
||||
evKill(nSprite, 3); // queue overflow protect
|
||||
evKill_(nSprite, 3); // queue overflow protect
|
||||
if (pXSprite->state == 0) SetSpriteState(nSprite, pXSprite, 1);
|
||||
if (pSprite->type == kModernSeqSpawner) seqSpawnerOffSameTx(pXSprite);
|
||||
fallthrough__;
|
||||
|
@ -4968,7 +4968,7 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite
|
|||
if (pXSprite->state == 1) SetSpriteState(nSprite, pXSprite, 0);
|
||||
break;
|
||||
case kCmdOn:
|
||||
evKill(nSprite, 3); // queue overflow protect
|
||||
evKill_(nSprite, 3); // queue overflow protect
|
||||
if (pXSprite->state == 0) SetSpriteState(nSprite, pXSprite, 1);
|
||||
fallthrough__;
|
||||
case kCmdRepeat:
|
||||
|
@ -4996,7 +4996,7 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite
|
|||
if (pXSprite->state == 1) SetSpriteState(nSprite, pXSprite, 0);
|
||||
break;
|
||||
case kCmdOn:
|
||||
evKill(nSprite, 3); // queue overflow protect
|
||||
evKill_(nSprite, 3); // queue overflow protect
|
||||
if (pXSprite->state == 0) SetSpriteState(nSprite, pXSprite, 1);
|
||||
fallthrough__;
|
||||
case kCmdRepeat:
|
||||
|
@ -5023,7 +5023,7 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite
|
|||
if (pXSprite->state == 1) SetSpriteState(nSprite, pXSprite, 0);
|
||||
break;
|
||||
case kCmdOn:
|
||||
evKill(nSprite, 3); // queue overflow protect
|
||||
evKill_(nSprite, 3); // queue overflow protect
|
||||
if (pXSprite->state == 0) SetSpriteState(nSprite, pXSprite, 1);
|
||||
fallthrough__;
|
||||
case kCmdRepeat:
|
||||
|
@ -5049,7 +5049,7 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite
|
|||
if (pXSprite->state == 1) SetSpriteState(nSprite, pXSprite, 0);
|
||||
break;
|
||||
case kCmdOn:
|
||||
evKill(nSprite, 3); // queue overflow protect
|
||||
evKill_(nSprite, 3); // queue overflow protect
|
||||
if (pXSprite->state == 0) SetSpriteState(nSprite, pXSprite, 1);
|
||||
fallthrough__;
|
||||
case kCmdRepeat:
|
||||
|
@ -5189,7 +5189,7 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite
|
|||
if (pXSprite->state == 1) SetSpriteState(nSprite, pXSprite, 0);
|
||||
break;
|
||||
case kCmdOn:
|
||||
evKill(nSprite, 3); // queue overflow protect
|
||||
evKill_(nSprite, 3); // queue overflow protect
|
||||
if (pXSprite->state == 0) SetSpriteState(nSprite, pXSprite, 1);
|
||||
fallthrough__;
|
||||
case kCmdRepeat:
|
||||
|
@ -5211,7 +5211,7 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite
|
|||
if (pXSprite->state == 1) SetSpriteState(nSprite, pXSprite, 0);
|
||||
break;
|
||||
case kCmdOn:
|
||||
evKill(nSprite, 3); // queue overflow protect
|
||||
evKill_(nSprite, 3); // queue overflow protect
|
||||
if (pXSprite->state == 0) SetSpriteState(nSprite, pXSprite, 1);
|
||||
fallthrough__;
|
||||
case kCmdRepeat:
|
||||
|
@ -5409,7 +5409,7 @@ int useCondition(spritetype* pSource, XSPRITE* pXSource, EVENT event) {
|
|||
if (pXSource->waitTime > 0 && pXSource->state > 0) {
|
||||
|
||||
pXSource->restState = 1;
|
||||
evKill(pSource->index, OBJ_SPRITE);
|
||||
evKill_(pSource->index, OBJ_SPRITE);
|
||||
evPost_(pSource->index, OBJ_SPRITE, (pXSource->waitTime * 120) / 10, kCmdRepeat);
|
||||
return -1;
|
||||
|
||||
|
@ -7817,7 +7817,7 @@ void seqSpawnerOffSameTx(XSPRITE* pXSource) {
|
|||
if (pXSprite->reference != pXSource->reference && spriRangeIsFine(pXSprite->reference)) {
|
||||
if (sprite[pXSprite->reference].type != kModernSeqSpawner) continue;
|
||||
else if (pXSprite->txID == pXSource->txID && pXSprite->state == 1) {
|
||||
evKill(pXSprite->reference, OBJ_SPRITE);
|
||||
evKill_(pXSprite->reference, OBJ_SPRITE);
|
||||
pXSprite->state = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -661,7 +661,7 @@ void seqProcess(int nTicks)
|
|||
int nSprite = xsprite[index].reference;
|
||||
if (nSprite >= 0 && nSprite < kMaxSprites)
|
||||
{
|
||||
evKill(nSprite, SS_SPRITE);
|
||||
evKill_(nSprite, SS_SPRITE);
|
||||
if ((sprite[nSprite].hitag & kAttrRespawn) != 0 && (sprite[nSprite].inittype >= kDudeBase && sprite[nSprite].inittype < kDudeMax))
|
||||
evPost_(nSprite, 3, gGameOptions.nMonsterRespawnTime, kCallbackRespawn);
|
||||
else deletesprite(nSprite); // safe to not use actPostSprite here
|
||||
|
|
|
@ -58,7 +58,7 @@ char SetSpriteState(int nSprite, XSPRITE* pXSprite, int nState)
|
|||
return 0;
|
||||
pXSprite->busy = IntToFixed(nState);
|
||||
pXSprite->state = nState;
|
||||
evKill(nSprite, 3);
|
||||
evKill_(nSprite, 3);
|
||||
if ((sprite[nSprite].flags & kHitagRespawn) != 0 && sprite[nSprite].inittype >= kDudeBase && sprite[nSprite].inittype < kDudeMax)
|
||||
{
|
||||
pXSprite->respawnPending = 3;
|
||||
|
@ -85,7 +85,7 @@ char SetWallState(int nWall, XWALL *pXWall, int nState)
|
|||
return 0;
|
||||
pXWall->busy = IntToFixed(nState);
|
||||
pXWall->state = nState;
|
||||
evKill(nWall, 0);
|
||||
evKill_(nWall, 0);
|
||||
if (pXWall->restState != nState && pXWall->waitTime > 0)
|
||||
evPost_(nWall, 0, (pXWall->waitTime*120) / 10, pXWall->restState ? kCmdOn : kCmdOff);
|
||||
if (pXWall->txID)
|
||||
|
@ -104,7 +104,7 @@ char SetSectorState(int nSector, XSECTOR *pXSector, int nState)
|
|||
return 0;
|
||||
pXSector->busy = IntToFixed(nState);
|
||||
pXSector->state = nState;
|
||||
evKill(nSector, 6);
|
||||
evKill_(nSector, 6);
|
||||
if (nState == 1)
|
||||
{
|
||||
if (pXSector->command != kCmdLink && pXSector->triggerOn && pXSector->txID)
|
||||
|
@ -209,7 +209,7 @@ void LifeLeechOperate(spritetype *pSprite, XSPRITE *pXSprite, EVENT event)
|
|||
PLAYER *pPlayer = &gPlayer[nPlayer];
|
||||
if (pPlayer->pXSprite->health > 0)
|
||||
{
|
||||
evKill(pSprite->index, 3);
|
||||
evKill(actor);
|
||||
pPlayer->ammoCount[8] = ClipHigh(pPlayer->ammoCount[8]+pXSprite->data3, gAmmoInfo[8].max);
|
||||
pPlayer->hasWeapon[9] = 1;
|
||||
if (pPlayer->curWeapon != kWeapLifeLeech)
|
||||
|
|
Loading…
Reference in a new issue