- Removed event.causedBy for demo playback compatibility

- Fixed kThingArmedRemote in triggers.cpp (OperateSprite())
- Fixed kTrapFlame in triggers.cpp (OperateSprite())

# Conflicts:
#	source/blood/src/actor.cpp
#	source/blood/src/player.h
This commit is contained in:
NoOneBlood 2020-01-12 00:07:05 +03:00 committed by Christoph Oelckers
parent 4123a9e14e
commit 2b36e53706
11 changed files with 297 additions and 316 deletions

View file

@ -3235,7 +3235,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType,
gPlayer[p].fraggerId = -1; gPlayer[p].fraggerId = -1;
} }
if (pSprite->type != kDudeCultistBeast) if (pSprite->type != kDudeCultistBeast)
trTriggerSprite(pSprite->index, pXSprite, kCmdOff, nKillerSprite); trTriggerSprite(pSprite->index, pXSprite, kCmdOff);
pSprite->flags |= 7; pSprite->flags |= 7;
if (VanillaMode()) { if (VanillaMode()) {
@ -3747,7 +3747,7 @@ int actDamageSprite(int nSource, spritetype *pSprite, DAMAGE_TYPE damageType, in
break; break;
} }
trTriggerSprite(pSprite->index, pXSprite, kCmdOff, nSource); trTriggerSprite(pSprite->index, pXSprite, kCmdOff);
switch (pSprite->type) { switch (pSprite->type) {
case kThingObjectGib: case kThingObjectGib:
@ -4501,7 +4501,7 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite)
if (spriRangeIsFine(nHSprite) && xspriRangeIsFine(sprite[nHSprite].extra)) { if (spriRangeIsFine(nHSprite) && xspriRangeIsFine(sprite[nHSprite].extra)) {
XSPRITE* pXHSprite = &xsprite[sprite[nHSprite].extra]; XSPRITE* pXHSprite = &xsprite[sprite[nHSprite].extra];
if (pXHSprite->Touch && !pXHSprite->isTriggered && (!pXHSprite->DudeLockout || IsPlayerSprite(pSprite))) if (pXHSprite->Touch && !pXHSprite->isTriggered && (!pXHSprite->DudeLockout || IsPlayerSprite(pSprite)))
trTriggerSprite(nHSprite, pXHSprite, kCmdSpriteTouch, nSprite); trTriggerSprite(nHSprite, pXHSprite, kCmdSpriteTouch);
} }
// Touch walls // Touch walls
@ -4511,7 +4511,7 @@ void ProcessTouchObjects(spritetype *pSprite, int nXSprite)
if (wallRangeIsFine(nHWall) && xwallRangeIsFine(wall[nHWall].extra)) { if (wallRangeIsFine(nHWall) && xwallRangeIsFine(wall[nHWall].extra)) {
XWALL* pXHWall = &xwall[wall[nHWall].extra]; XWALL* pXHWall = &xwall[wall[nHWall].extra];
if (pXHWall->triggerTouch && !pXHWall->isTriggered && (!pXHWall->dudeLockout || IsPlayerSprite(pSprite))) if (pXHWall->triggerTouch && !pXHWall->isTriggered && (!pXHWall->dudeLockout || IsPlayerSprite(pSprite)))
trTriggerWall(nHWall, pXHWall, kCmdWallTouch, nSprite); trTriggerWall(nHWall, pXHWall, kCmdWallTouch);
} }
} }
@ -4798,10 +4798,10 @@ void MoveDude(spritetype *pSprite)
} }
if (!gModernMap && pHitXSprite && pHitXSprite->Touch && !pHitXSprite->state && !pHitXSprite->isTriggered) if (!gModernMap && pHitXSprite && pHitXSprite->Touch && !pHitXSprite->state && !pHitXSprite->isTriggered)
trTriggerSprite(nHitSprite, pHitXSprite, kCmdSpriteTouch, nSprite); trTriggerSprite(nHitSprite, pHitXSprite, kCmdSpriteTouch);
if (pDudeInfo->lockOut && pHitXSprite && pHitXSprite->Push && !pHitXSprite->key && !pHitXSprite->DudeLockout && !pHitXSprite->state && !pHitXSprite->busy && !pPlayer) if (pDudeInfo->lockOut && pHitXSprite && pHitXSprite->Push && !pHitXSprite->key && !pHitXSprite->DudeLockout && !pHitXSprite->state && !pHitXSprite->busy && !pPlayer)
trTriggerSprite(nHitSprite, pHitXSprite, kCmdSpritePush, nSprite); trTriggerSprite(nHitSprite, pHitXSprite, kCmdSpritePush);
break; break;
} }
@ -4813,7 +4813,7 @@ void MoveDude(spritetype *pSprite)
if (pHitWall->extra > 0) if (pHitWall->extra > 0)
pHitXWall = &xwall[pHitWall->extra]; pHitXWall = &xwall[pHitWall->extra];
if (pDudeInfo->lockOut && pHitXWall && pHitXWall->triggerPush && !pHitXWall->key && !pHitXWall->dudeLockout && !pHitXWall->state && !pHitXWall->busy && !pPlayer) if (pDudeInfo->lockOut && pHitXWall && pHitXWall->triggerPush && !pHitXWall->key && !pHitXWall->dudeLockout && !pHitXWall->state && !pHitXWall->busy && !pPlayer)
trTriggerWall(nHitWall, pHitXWall, kCmdWallPush, nSprite); trTriggerWall(nHitWall, pHitXWall, kCmdWallPush);
if (pHitWall->nextsector != -1) if (pHitWall->nextsector != -1)
{ {
sectortype *pHitSector = &sector[pHitWall->nextsector]; sectortype *pHitSector = &sector[pHitWall->nextsector];
@ -4821,7 +4821,7 @@ void MoveDude(spritetype *pSprite)
if (pHitSector->extra > 0) if (pHitSector->extra > 0)
pHitXSector = &xsector[pHitSector->extra]; pHitXSector = &xsector[pHitSector->extra];
if (pDudeInfo->lockOut && pHitXSector && pHitXSector->Wallpush && !pHitXSector->Key && !pHitXSector->dudeLockout && !pHitXSector->state && !pHitXSector->busy && !pPlayer) if (pDudeInfo->lockOut && pHitXSector && pHitXSector->Wallpush && !pHitXSector->Key && !pHitXSector->dudeLockout && !pHitXSector->state && !pHitXSector->busy && !pPlayer)
trTriggerSector(pHitWall->nextsector, pHitXSector, kCmdSectorPush, nSprite); trTriggerSector(pHitWall->nextsector, pHitXSector, kCmdSectorPush);
if (top < pHitSector->ceilingz || bottom > pHitSector->floorz) if (top < pHitSector->ceilingz || bottom > pHitSector->floorz)
{ {
// ??? // ???
@ -4847,7 +4847,7 @@ void MoveDude(spritetype *pSprite)
else else
pXSector = NULL; pXSector = NULL;
if (pXSector && pXSector->Exit && (pPlayer || !pXSector->dudeLockout)) if (pXSector && pXSector->Exit && (pPlayer || !pXSector->dudeLockout))
trTriggerSector(pSprite->sectnum, pXSector, kCmdSectorExit, nSprite); trTriggerSector(pSprite->sectnum, pXSector, kCmdSectorExit);
ChangeSpriteSect(nSprite, nSector); ChangeSpriteSect(nSprite, nSector);
nXSector = sector[nSector].extra; nXSector = sector[nSector].extra;
@ -4856,7 +4856,7 @@ void MoveDude(spritetype *pSprite)
if (sector[nSector].type == kSectorTeleport) if (sector[nSector].type == kSectorTeleport)
pXSector->data = pPlayer ? nSprite : -1; pXSector->data = pPlayer ? nSprite : -1;
trTriggerSector(nSector, pXSector, kCmdSectorEnter, nSprite); trTriggerSector(nSector, pXSector, kCmdSectorEnter);
} }
nSector = pSprite->sectnum; nSector = pSprite->sectnum;
@ -5359,7 +5359,7 @@ int MoveMissile(spritetype *pSprite)
XWALL *pXWall = &xwall[pWall->extra]; XWALL *pXWall = &xwall[pWall->extra];
if (pXWall->triggerVector) if (pXWall->triggerVector)
{ {
trTriggerWall(gHitInfo.hitwall, pXWall, kCmdWallImpact, nSprite); trTriggerWall(gHitInfo.hitwall, pXWall, kCmdWallImpact);
if (!(pWall->cstat&64)) if (!(pWall->cstat&64))
{ {
vdi = -1; vdi = -1;
@ -5428,7 +5428,7 @@ void actExplodeSprite(spritetype *pSprite)
return; return;
sfxKill3DSound(pSprite, -1, -1); sfxKill3DSound(pSprite, -1, -1);
evKill(pSprite->index, 3); evKill(pSprite->index, 3);
int nType = kExplosionStandard; int nType;
switch (pSprite->type) switch (pSprite->type)
{ {
case kMissileFireballNapam: case kMissileFireballNapam:
@ -5623,7 +5623,7 @@ void actProcessSprites(void)
if ((sprite[nAffected].flags & 32) || xsprite[sprite[nAffected].extra].health <= 0) continue; if ((sprite[nAffected].flags & 32) || xsprite[sprite[nAffected].extra].health <= 0) continue;
else if (CheckProximity(&sprite[nAffected], x, y, z, sectnum, 96)) { else if (CheckProximity(&sprite[nAffected], x, y, z, sectnum, 96)) {
trTriggerSprite(index, pXProxSpr, kCmdSpriteProximity, nAffected); trTriggerSprite(index, pXProxSpr, kCmdSpriteProximity);
break; break;
} }
} }
@ -5632,7 +5632,7 @@ void actProcessSprites(void)
for (int a = connecthead; a >= 0; a = connectpoint2[a]) { for (int a = connecthead; a >= 0; a = connectpoint2[a]) {
if (gPlayer[a].pXSprite->health > 0 && CheckProximity(gPlayer[a].pSprite, x, y, z, sectnum, 96)) { if (gPlayer[a].pXSprite->health > 0 && CheckProximity(gPlayer[a].pSprite, x, y, z, sectnum, 96)) {
trTriggerSprite(index, pXProxSpr, kCmdSpriteProximity, gPlayer[a].pSprite->index); trTriggerSprite(index, pXProxSpr, kCmdSpriteProximity);
break; break;
} }
} }
@ -5657,7 +5657,7 @@ void actProcessSprites(void)
for (int a = connecthead; a >= 0; a = connectpoint2[a]) { for (int a = connecthead; a >= 0; a = connectpoint2[a]) {
spritetype* pPlaySprite = gPlayer[a].pSprite; spritetype* pPlaySprite = gPlayer[a].pSprite;
if (gPlayer[a].pXSprite->health > 0 && cansee(x, y, z, sectnum, pPlaySprite->x, pPlaySprite->y, pPlaySprite->z, pPlaySprite->sectnum)) { if (gPlayer[a].pXSprite->health > 0 && cansee(x, y, z, sectnum, pPlaySprite->x, pPlaySprite->y, pPlaySprite->z, pPlaySprite->sectnum)) {
trTriggerSprite(index, pXSightSpr, kCmdSpriteSight, pPlaySprite->index); trTriggerSprite(index, pXSightSpr, kCmdSpriteSight);
break; break;
} }
} }
@ -5803,7 +5803,7 @@ void actProcessSprites(void)
break; break;
} }
if (pSprite->owner == -1) actPropagateSpriteOwner(pSprite, pSprite2); if (pSprite->owner == -1) actPropagateSpriteOwner(pSprite, pSprite2);
trTriggerSprite(nSprite, pXSprite, kCmdSpriteProximity, pSprite2->index); trTriggerSprite(nSprite, pXSprite, kCmdSpriteProximity);
} }
} }
} }
@ -5879,7 +5879,7 @@ void actProcessSprites(void)
{ {
XSPRITE *pXSprite = &xsprite[nXSprite]; XSPRITE *pXSprite = &xsprite[nXSprite];
if (pXSprite->Impact) if (pXSprite->Impact)
trTriggerSprite(nSprite, pXSprite, kCmdOff, -1); trTriggerSprite(nSprite, pXSprite, kCmdOff);
switch (pSprite->type) { switch (pSprite->type) {
case kThingDripWater: case kThingDripWater:
case kThingDripBlood: case kThingDripBlood:
@ -5986,7 +5986,7 @@ void actProcessSprites(void)
if (nWall == -1) if (nWall == -1)
break; break;
XWALL *pXWall = &xwall[wall[nWall].extra]; XWALL *pXWall = &xwall[wall[nWall].extra];
trTriggerWall(nWall, pXWall, kCmdWallImpact, nSprite); trTriggerWall(nWall, pXWall, kCmdWallImpact);
} }
for (int nSprite2 = headspritestat[kStatDude]; nSprite2 >= 0; nSprite2 = nextspritestat[nSprite2]) for (int nSprite2 = headspritestat[kStatDude]; nSprite2 >= 0; nSprite2 = nextspritestat[nSprite2])
@ -6169,7 +6169,7 @@ void actProcessSprites(void)
pXIncarnation->triggerOff = false; pXIncarnation->triggerOff = false;
// trigger dude death before transform // trigger dude death before transform
trTriggerSprite(nSprite, pXSprite, kCmdOff, pSprite->owner); trTriggerSprite(nSprite, pXSprite, kCmdOff);
pSprite->type = pIncarnation->type; pSprite->type = pIncarnation->type;
pSprite->flags = pIncarnation->flags; pSprite->flags = pIncarnation->flags;
@ -6257,7 +6257,7 @@ void actProcessSprites(void)
} else { } else {
if (pXSprite->sysData1 == kGenDudeTransformStatus) pXSprite->sysData1 = 0; if (pXSprite->sysData1 == kGenDudeTransformStatus) pXSprite->sysData1 = 0;
// just trigger dude death // just trigger dude death
trTriggerSprite(nSprite, pXSprite, kCmdOff, pSprite->owner); trTriggerSprite(nSprite, pXSprite, kCmdOff);
} }
} }
} }
@ -6285,7 +6285,7 @@ void actProcessSprites(void)
XSPRITE *pXSprite2 = &xsprite[pSprite2->extra]; XSPRITE *pXSprite2 = &xsprite[pSprite2->extra];
if ((unsigned int)pXSprite2->health > 0 && IsPlayerSprite(pSprite2)) { if ((unsigned int)pXSprite2->health > 0 && IsPlayerSprite(pSprite2)) {
if (CheckProximity(pSprite2, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, 128)) if (CheckProximity(pSprite2, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum, 128))
trTriggerSprite(nSprite, pXSprite, kCmdSpriteProximity, pSprite2->index); trTriggerSprite(nSprite, pXSprite, kCmdSpriteProximity);
} }
} }
} }
@ -6961,7 +6961,7 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
{ {
XWALL *pXWall = &xwall[nXWall]; XWALL *pXWall = &xwall[nXWall];
if (pXWall->triggerVector) if (pXWall->triggerVector)
trTriggerWall(nWall, pXWall, kCmdWallImpact, nShooter); trTriggerWall(nWall, pXWall, kCmdWallImpact);
} }
break; break;
} }
@ -6983,7 +6983,7 @@ void actFireVector(spritetype *pShooter, int a2, int a3, int a4, int a5, int a6,
{ {
XSPRITE *pXSprite = &xsprite[nXSprite]; XSPRITE *pXSprite = &xsprite[nXSprite];
if (pXSprite->Vector) if (pXSprite->Vector)
trTriggerSprite(nSprite, pXSprite, kCmdSpriteImpact, nShooter); trTriggerSprite(nSprite, pXSprite, kCmdSpriteImpact);
} }
if (pSprite->statnum == kStatThing) if (pSprite->statnum == kStatThing)
{ {
@ -7857,8 +7857,8 @@ void debrisMove(int listIndex) {
changespritestat(nSprite, kStatThing); changespritestat(nSprite, kStatThing);
if (pXDebris->state == 1) trTriggerSprite(pSprite->xvel, pXDebris, kCmdOff, -1); if (pXDebris->state == 1) trTriggerSprite(pSprite->xvel, pXDebris, kCmdOff);
else trTriggerSprite(pSprite->xvel, pXDebris, kCmdOn, -1); else trTriggerSprite(pSprite->xvel, pXDebris, kCmdOn);
} }
} }

View file

@ -181,7 +181,7 @@ static void ThrowSeqCallback(int, int nXSprite)
if (v4) if (v4)
xsprite[pMissile->extra].Impact = 1; xsprite[pMissile->extra].Impact = 1;
else else
evPost(pMissile->index, 3, 120*(1+Random(2)), kCmdOn, nSprite); evPost(pMissile->index, 3, 120*(1+Random(2)), kCmdOn);
} }
static void sub_68170(int, int nXSprite) static void sub_68170(int, int nXSprite)
@ -194,7 +194,7 @@ static void sub_68170(int, int nXSprite)
nMissile = kThingArmedTNTBundle; nMissile = kThingArmedTNTBundle;
sfxPlay3DSound(pSprite, 455, -1, 0); sfxPlay3DSound(pSprite, 455, -1, 0);
spritetype *pMissile = actFireThing(pSprite, 0, 0, gDudeSlope[nXSprite]-9460, nMissile, 0x133333); spritetype *pMissile = actFireThing(pSprite, 0, 0, gDudeSlope[nXSprite]-9460, nMissile, 0x133333);
evPost(pMissile->index, 3, 120*(2+Random(2)), kCmdOn, nSprite); evPost(pMissile->index, 3, 120*(2+Random(2)), kCmdOn);
} }
static void sub_68230(int, int nXSprite) static void sub_68230(int, int nXSprite)

View file

@ -400,7 +400,7 @@ static void ThrowThing(int nXIndex, bool impact) {
if (impact == true && dist <= 7680) xsprite[pThing->extra].Impact = true; if (impact == true && dist <= 7680) xsprite[pThing->extra].Impact = true;
else { else {
xsprite[pThing->extra].Impact = false; xsprite[pThing->extra].Impact = false;
evPost(pThing->xvel, 3, 120 * Random(2) + 120, kCmdOn, pXSprite->reference); evPost(pThing->xvel, 3, 120 * Random(2) + 120, kCmdOn);
} }
} }

View file

@ -361,7 +361,7 @@ void CounterCheck(int nSector) // 12
return; return;
} else { } else {
//pXSector->waitTimeA = 0; //do not reset necessary objects counter to zero //pXSector->waitTimeA = 0; //do not reset necessary objects counter to zero
trTriggerSector(nSector, pXSector, kCmdOn, -1); trTriggerSector(nSector, pXSector, kCmdOn);
pXSector->locked = 1; //lock sector, so it can be opened again later pXSector->locked = 1; //lock sector, so it can be opened again later
} }
} }
@ -489,13 +489,13 @@ void returnFlagToBase(int nSprite) // 17
XSPRITE* pXOwner = &xsprite[pOwner->extra]; XSPRITE* pXOwner = &xsprite[pOwner->extra];
switch (pSprite->type) { switch (pSprite->type) {
case kItemFlagA: case kItemFlagA:
trTriggerSprite(pOwner->index, pXOwner, kCmdOn, pOwner->index); trTriggerSprite(pOwner->index, pXOwner, kCmdOn);
sndStartSample(8003, 255, 2, 0); sndStartSample(8003, 255, 2, 0);
gBlueFlagDropped = false; gBlueFlagDropped = false;
viewSetMessage("Blue Flag returned to base."); viewSetMessage("Blue Flag returned to base.");
break; break;
case kItemFlagB: case kItemFlagB:
trTriggerSprite(pOwner->index, pXOwner, kCmdOn, pOwner->index); trTriggerSprite(pOwner->index, pXOwner, kCmdOn);
sndStartSample(8002, 255, 2, 0); sndStartSample(8002, 255, 2, 0);
gRedFlagDropped = false; gRedFlagDropped = false;
viewSetMessage("Red Flag returned to base."); viewSetMessage("Red Flag returned to base.");

View file

@ -351,7 +351,7 @@ char evGetSourceState(int nType, int nIndex)
return 0; return 0;
} }
void evSend(int nIndex, int nType, int rxId, COMMAND_ID command, short causedBy) void evSend(int nIndex, int nType, int rxId, COMMAND_ID command)
{ {
@ -370,7 +370,6 @@ void evSend(int nIndex, int nType, int rxId, COMMAND_ID command, short causedBy)
event.index = nIndex; event.index = nIndex;
event.type = nType; event.type = nType;
event.cmd = command; event.cmd = command;
event.causedBy = causedBy;
switch (rxId) { switch (rxId) {
case kChannelTextOver: case kChannelTextOver:
@ -452,9 +451,6 @@ void evSend(int nIndex, int nType, int rxId, COMMAND_ID command, short causedBy)
if ((pPlayer = getPlayerById(i)) != NULL) if ((pPlayer = getPlayerById(i)) != NULL)
trMessageSprite(pPlayer->nSprite, event); trMessageSprite(pPlayer->nSprite, event);
} }
// send command on sprite which create the event sequence
} else if (rxId == kChannelEventCauser && spriRangeIsFine(event.causedBy)) {
trMessageSprite(event.causedBy, event);
} }
} }
@ -488,7 +484,7 @@ void evSend(int nIndex, int nType, int rxId, COMMAND_ID command, short causedBy)
} }
} }
void evPost(int nIndex, int nType, unsigned int nDelta, COMMAND_ID command, short causedBy) { void evPost(int nIndex, int nType, unsigned int nDelta, COMMAND_ID command) {
dassert(command != kCmdCallback); dassert(command != kCmdCallback);
if (command == kCmdState) command = evGetSourceState(nType, nIndex) ? kCmdOn : kCmdOff; if (command == kCmdState) command = evGetSourceState(nType, nIndex) ? kCmdOn : kCmdOff;
else if (command == kCmdNotState) command = evGetSourceState(nType, nIndex) ? kCmdOff : kCmdOn; else if (command == kCmdNotState) command = evGetSourceState(nType, nIndex) ? kCmdOff : kCmdOn;
@ -496,17 +492,15 @@ void evPost(int nIndex, int nType, unsigned int nDelta, COMMAND_ID command, shor
evn.index = nIndex; evn.index = nIndex;
evn.type = nType; evn.type = nType;
evn.cmd = command; evn.cmd = command;
evn.causedBy = causedBy;
eventQ.PQueue->Insert((int)gFrameClock+nDelta, evn); eventQ.PQueue->Insert((int)gFrameClock+nDelta, evn);
} }
void evPost(int nIndex, int nType, unsigned int nDelta, CALLBACK_ID callback, short causedBy) { void evPost(int nIndex, int nType, unsigned int nDelta, CALLBACK_ID callback) {
EVENT evn = {}; EVENT evn = {};
evn.index = nIndex; evn.index = nIndex;
evn.type = nType; evn.type = nType;
evn.cmd = kCmdCallback; evn.cmd = kCmdCallback;
evn.funcID = callback; evn.funcID = callback;
evn.causedBy = causedBy;
eventQ.PQueue->Insert((int)gFrameClock+nDelta, evn); eventQ.PQueue->Insert((int)gFrameClock+nDelta, evn);
} }

View file

@ -129,14 +129,13 @@ struct EVENT {
unsigned int type: 3; // type unsigned int type: 3; // type
unsigned int cmd: 8; // cmd unsigned int cmd: 8; // cmd
unsigned int funcID: 8; // callback unsigned int funcID: 8; // callback
signed int causedBy: 14; // by NoOne: spritenum of object which initiated this event (-1 == initiated by the game)
}; };
void evInit(void); void evInit(void);
char evGetSourceState(int nType, int nIndex); char evGetSourceState(int nType, int nIndex);
void evSend(int nIndex, int nType, int rxId, COMMAND_ID command, short causedBy); void evSend(int nIndex, int nType, int rxId, COMMAND_ID command);
void evPost(int nIndex, int nType, unsigned int nDelta, COMMAND_ID command, short causedBy); void evPost(int nIndex, int nType, unsigned int nDelta, COMMAND_ID command);
void evPost(int nIndex, int nType, unsigned int nDelta, CALLBACK_ID callback, short causedBy = -1); void evPost(int nIndex, int nType, unsigned int nDelta, CALLBACK_ID callback);
void evProcess(unsigned int nTime); void evProcess(unsigned int nTime);
void evKill(int a1, int a2); void evKill(int a1, int a2);
void evKill(int a1, int a2, CALLBACK_ID a3); void evKill(int a1, int a2, CALLBACK_ID a3);

View file

@ -991,7 +991,7 @@ void playerResetPosture(PLAYER* pPlayer) {
void playerResetQavScene(PLAYER* pPlayer) { void playerResetQavScene(PLAYER* pPlayer) {
QAVSCENE* pQavScene = &gPlayerCtrl[pPlayer->nPlayer].qavScene; QAVSCENE* pQavScene = &gPlayerCtrl[pPlayer->nPlayer].qavScene;
pQavScene->index = pQavScene->causedBy = pPlayer->sceneQav = -1; pQavScene->index = pQavScene->dummy = pPlayer->sceneQav = -1;
pQavScene->qavResrc = NULL; pQavScene->qavResrc = NULL;
} }
@ -1062,7 +1062,7 @@ char PickupItem(PLAYER *pPlayer, spritetype *pItem) {
if ((pPlayer->hasFlag & 1) == 0 && pXItem->state) { if ((pPlayer->hasFlag & 1) == 0 && pXItem->state) {
pPlayer->hasFlag |= 1; pPlayer->hasFlag |= 1;
pPlayer->used2[0] = pItem->index; pPlayer->used2[0] = pItem->index;
trTriggerSprite(pItem->index, pXItem, kCmdOff, pPlayer->nSprite); trTriggerSprite(pItem->index, pXItem, kCmdOff);
sprintf(buffer, "%s stole Blue Flag", gProfile[pPlayer->nPlayer].name); sprintf(buffer, "%s stole Blue Flag", gProfile[pPlayer->nPlayer].name);
sndStartSample(8007, 255, 2, 0); sndStartSample(8007, 255, 2, 0);
viewSetMessage(buffer); viewSetMessage(buffer);
@ -1074,7 +1074,7 @@ char PickupItem(PLAYER *pPlayer, spritetype *pItem) {
if ((pPlayer->hasFlag & 1) != 0 && !pXItem->state) { if ((pPlayer->hasFlag & 1) != 0 && !pXItem->state) {
pPlayer->hasFlag &= ~1; pPlayer->hasFlag &= ~1;
pPlayer->used2[0] = -1; pPlayer->used2[0] = -1;
trTriggerSprite(pItem->index, pXItem, kCmdOn, pPlayer->nSprite); trTriggerSprite(pItem->index, pXItem, kCmdOn);
sprintf(buffer, "%s returned Blue Flag", gProfile[pPlayer->nPlayer].name); sprintf(buffer, "%s returned Blue Flag", gProfile[pPlayer->nPlayer].name);
sndStartSample(8003, 255, 2, 0); sndStartSample(8003, 255, 2, 0);
viewSetMessage(buffer); viewSetMessage(buffer);
@ -1085,7 +1085,7 @@ char PickupItem(PLAYER *pPlayer, spritetype *pItem) {
pPlayer->used2[1] = -1; pPlayer->used2[1] = -1;
dword_21EFB0[pPlayer->teamId] += 10; dword_21EFB0[pPlayer->teamId] += 10;
dword_21EFD0[pPlayer->teamId] += 240; dword_21EFD0[pPlayer->teamId] += 240;
evSend(0, 0, 81, kCmdOn, pPlayer->nSprite); evSend(0, 0, 81, kCmdOn);
sprintf(buffer, "%s captured Red Flag!", gProfile[pPlayer->nPlayer].name); sprintf(buffer, "%s captured Red Flag!", gProfile[pPlayer->nPlayer].name);
sndStartSample(8001, 255, 2, 0); sndStartSample(8001, 255, 2, 0);
viewSetMessage(buffer); viewSetMessage(buffer);
@ -1106,7 +1106,7 @@ char PickupItem(PLAYER *pPlayer, spritetype *pItem) {
if ((pPlayer->hasFlag & 2) == 0 && pXItem->state) { if ((pPlayer->hasFlag & 2) == 0 && pXItem->state) {
pPlayer->hasFlag |= 2; pPlayer->hasFlag |= 2;
pPlayer->used2[1] = pItem->index; pPlayer->used2[1] = pItem->index;
trTriggerSprite(pItem->index, pXItem, kCmdOff, pPlayer->nSprite); trTriggerSprite(pItem->index, pXItem, kCmdOff);
sprintf(buffer, "%s stole Red Flag", gProfile[pPlayer->nPlayer].name); sprintf(buffer, "%s stole Red Flag", gProfile[pPlayer->nPlayer].name);
sndStartSample(8006, 255, 2, 0); sndStartSample(8006, 255, 2, 0);
viewSetMessage(buffer); viewSetMessage(buffer);
@ -1118,7 +1118,7 @@ char PickupItem(PLAYER *pPlayer, spritetype *pItem) {
{ {
pPlayer->hasFlag &= ~2; pPlayer->hasFlag &= ~2;
pPlayer->used2[1] = -1; pPlayer->used2[1] = -1;
trTriggerSprite(pItem->index, pXItem, kCmdOn, pPlayer->nSprite); trTriggerSprite(pItem->index, pXItem, kCmdOn);
sprintf(buffer, "%s returned Red Flag", gProfile[pPlayer->nPlayer].name); sprintf(buffer, "%s returned Red Flag", gProfile[pPlayer->nPlayer].name);
sndStartSample(8002, 255, 2, 0); sndStartSample(8002, 255, 2, 0);
viewSetMessage(buffer); viewSetMessage(buffer);
@ -1129,7 +1129,7 @@ char PickupItem(PLAYER *pPlayer, spritetype *pItem) {
pPlayer->used2[0] = -1; pPlayer->used2[0] = -1;
dword_21EFB0[pPlayer->teamId] += 10; dword_21EFB0[pPlayer->teamId] += 10;
dword_21EFD0[pPlayer->teamId] += 240; dword_21EFD0[pPlayer->teamId] += 240;
evSend(0, 0, 80, kCmdOn, pPlayer->nSprite); evSend(0, 0, 80, kCmdOn);
sprintf(buffer, "%s captured Blue Flag!", gProfile[pPlayer->nPlayer].name); sprintf(buffer, "%s captured Blue Flag!", gProfile[pPlayer->nPlayer].name);
sndStartSample(8000, 255, 2, 0); sndStartSample(8000, 255, 2, 0);
viewSetMessage(buffer); viewSetMessage(buffer);
@ -1305,7 +1305,7 @@ void PickUp(PLAYER *pPlayer, spritetype *pSprite)
else if (pSprite->extra > 0) { else if (pSprite->extra > 0) {
XSPRITE *pXSprite = &xsprite[pSprite->extra]; XSPRITE *pXSprite = &xsprite[pSprite->extra];
if (pXSprite->Pickup) if (pXSprite->Pickup)
trTriggerSprite(pSprite->index, pXSprite, kCmdSpritePickup, pPlayer->nSprite); trTriggerSprite(pSprite->index, pXSprite, kCmdSpritePickup);
} }
if (!actCheckRespawn(pSprite)) if (!actCheckRespawn(pSprite))
@ -1400,7 +1400,7 @@ int ActionScan(PLAYER *pPlayer, int *a2, int *a3)
zvel[*a2] += mulscale16(z, t2); zvel[*a2] += mulscale16(z, t2);
} }
if (pXSprite->Push && !pXSprite->state && !pXSprite->isTriggered) if (pXSprite->Push && !pXSprite->state && !pXSprite->isTriggered)
trTriggerSprite(*a2, pXSprite, kCmdSpritePush, pPlayer->nSprite); trTriggerSprite(*a2, pXSprite, kCmdSpritePush);
} }
break; break;
case 0: case 0:
@ -1607,7 +1607,7 @@ void ProcessInput(PLAYER *pPlayer)
sndStartSample(3062, 255, 2, 0); sndStartSample(3062, 255, 2, 0);
} }
if (!key || pPlayer->hasKey[key]) if (!key || pPlayer->hasKey[key])
trTriggerSector(a2, pXSector, kCmdSpritePush, nSprite); trTriggerSector(a2, pXSector, kCmdSpritePush);
else if (pPlayer == gMe) else if (pPlayer == gMe)
{ {
viewSetMessage(GStrings("TXTB_KEY")); viewSetMessage(GStrings("TXTB_KEY"));
@ -1625,7 +1625,7 @@ void ProcessInput(PLAYER *pPlayer)
sndStartSample(3062, 255, 2, 0); sndStartSample(3062, 255, 2, 0);
} }
if (!key || pPlayer->hasKey[key]) if (!key || pPlayer->hasKey[key])
trTriggerWall(a2, pXWall, kCmdWallPush, pPlayer->nSprite); trTriggerWall(a2, pXWall, kCmdWallPush);
else if (pPlayer == gMe) else if (pPlayer == gMe)
{ {
viewSetMessage(GStrings("TXTB_KEY")); viewSetMessage(GStrings("TXTB_KEY"));
@ -1640,7 +1640,7 @@ void ProcessInput(PLAYER *pPlayer)
if (pXSprite->locked && pPlayer == gMe && pXSprite->lockMsg) if (pXSprite->locked && pPlayer == gMe && pXSprite->lockMsg)
trTextOver(pXSprite->lockMsg); trTextOver(pXSprite->lockMsg);
if (!key || pPlayer->hasKey[key]) if (!key || pPlayer->hasKey[key])
trTriggerSprite(a2, pXSprite, kCmdSpritePush, pPlayer->nSprite); trTriggerSprite(a2, pXSprite, kCmdSpritePush);
else if (pPlayer == gMe) else if (pPlayer == gMe)
{ {
viewSetMessage(GStrings("TXTB_KEY")); viewSetMessage(GStrings("TXTB_KEY"));
@ -2012,16 +2012,16 @@ void FragPlayer(PLAYER *pPlayer, int nSprite)
if (nTeam1 == 0) if (nTeam1 == 0)
{ {
if (nTeam1 != nTeam2) if (nTeam1 != nTeam2)
evSend(0, 0, 15, kCmdToggle, pKiller->nSprite); evSend(0, 0, 15, kCmdToggle);
else else
evSend(0, 0, 16, kCmdToggle, pKiller->nSprite); evSend(0, 0, 16, kCmdToggle);
} }
else else
{ {
if (nTeam1 == nTeam2) if (nTeam1 == nTeam2)
evSend(0, 0, 16, kCmdToggle, pKiller->nSprite); evSend(0, 0, 16, kCmdToggle);
else else
evSend(0, 0, 15, kCmdToggle, pKiller->nSprite); evSend(0, 0, 15, kCmdToggle);
} }
} }
} }
@ -2203,7 +2203,7 @@ int playerDamageSprite(int nSource, PLAYER *pPlayer, DAMAGE_TYPE nDamageType, in
{ {
powerupClear(pPlayer); powerupClear(pPlayer);
if (nXSector > 0 && xsector[nXSector].Exit) if (nXSector > 0 && xsector[nXSector].Exit)
trTriggerSector(pSprite->sectnum, &xsector[nXSector], kCmdSectorExit, nSprite); trTriggerSector(pSprite->sectnum, &xsector[nXSector], kCmdSectorExit);
pSprite->flags |= 7; pSprite->flags |= 7;
for (int p = connecthead; p >= 0; p = connectpoint2[p]) for (int p = connecthead; p >= 0; p = connectpoint2[p])
{ {
@ -2211,7 +2211,7 @@ int playerDamageSprite(int nSource, PLAYER *pPlayer, DAMAGE_TYPE nDamageType, in
gPlayer[p].fraggerId = -1; gPlayer[p].fraggerId = -1;
} }
FragPlayer(pPlayer, nSource); FragPlayer(pPlayer, nSource);
trTriggerSprite(nSprite, pXSprite, kCmdOff, nSource); trTriggerSprite(nSprite, pXSprite, kCmdOff);
} }
dassert(gSysRes.Lookup(pDudeInfo->seqStartID + nDeathSeqID, "SEQ") != NULL); dassert(gSysRes.Lookup(pDudeInfo->seqStartID + nDeathSeqID, "SEQ") != NULL);
seqSpawn(pDudeInfo->seqStartID+nDeathSeqID, 3, nXSprite, nKneelingPlayer); seqSpawn(pDudeInfo->seqStartID+nDeathSeqID, 3, nXSprite, nKneelingPlayer);

View file

@ -202,8 +202,6 @@ struct PLAYER
POSTURE pPosture[kModeMax][kPostureMax]; POSTURE pPosture[kModeMax][kPostureMax];
}; };
struct PROFILE struct PROFILE
{ {
int nAutoAim; int nAutoAim;
@ -226,21 +224,15 @@ struct POWERUPINFO
int maxTime; int maxTime;
}; };
#define kQavSceneStackSize 16
// by NoOne: this one stores qavs anims that can be played by trigger // by NoOne: this one stores qavs anims that can be played by trigger
struct QAVSCENE struct QAVSCENE {
{ short index = -1; // index of sprite which triggered qav scene
short index = -1; // index of sprite which triggered qav scene
QAV * qavResrc = NULL; QAV * qavResrc = NULL;
short causedBy = -1; short dummy = -1;
// TO-DO: Stack of animations which allows to pop and push (restoring previous animation instead of weapon once current animation is played)
}; };
// by NoOne: this one for controlling the player using triggers (movement speed, jumps and other stuff) // by NoOne: this one for controlling the player using triggers (movement speed, jumps and other stuff)
struct TRPLAYERCTRL struct TRPLAYERCTRL {
{
QAVSCENE qavScene; QAVSCENE qavScene;
}; };

File diff suppressed because it is too large Load diff

View file

@ -35,11 +35,11 @@ BEGIN_BLD_NS
#define kPlayerCtrlSigStart "<<<<TRPLAYERCTRL{" // save game TRPLAYERCTRL block start #define kPlayerCtrlSigStart "<<<<TRPLAYERCTRL{" // save game TRPLAYERCTRL block start
#define kPlayerCtrlSigEnd "}TRPLAYERCTRL>>>>" // save game TRPLAYERCTRL block end #define kPlayerCtrlSigEnd "}TRPLAYERCTRL>>>>" // save game TRPLAYERCTRL block end
void trTriggerSector(unsigned int nSector, XSECTOR *pXSector, int command, short causedBy); void trTriggerSector(unsigned int nSector, XSECTOR *pXSector, int command);
void trMessageSector(unsigned int nSector, EVENT event); void trMessageSector(unsigned int nSector, EVENT event);
void trTriggerWall(unsigned int nWall, XWALL *pXWall, int command, short causedBy); void trTriggerWall(unsigned int nWall, XWALL *pXWall, int command);
void trMessageWall(unsigned int nWall, EVENT event); void trMessageWall(unsigned int nWall, EVENT event);
void trTriggerSprite(unsigned int nSprite, XSPRITE *pXSprite, int command, short causedBy); void trTriggerSprite(unsigned int nSprite, XSPRITE *pXSprite, int command);
void trMessageSprite(unsigned int nSprite, EVENT event); void trMessageSprite(unsigned int nSprite, EVENT event);
void trProcessBusy(void); void trProcessBusy(void);
void trInit(void); void trInit(void);
@ -69,7 +69,7 @@ void freeTargets(int nSprite);
void freeAllTargets(XSPRITE* pXSource); void freeAllTargets(XSPRITE* pXSource);
bool affectedByTargetChg(XSPRITE* pXDude); bool affectedByTargetChg(XSPRITE* pXDude);
int getDataFieldOfObject(int objType, int objIndex, int dataIndex); int getDataFieldOfObject(int objType, int objIndex, int dataIndex);
bool setDataValueOfObject(int objType, int objIndex, int dataIndex, int value, int causedBy); bool setDataValueOfObject(int objType, int objIndex, int dataIndex, int value);
bool goalValueIsReached(XSPRITE* pXSprite); bool goalValueIsReached(XSPRITE* pXSprite);
bool getDudesForTargetChg(XSPRITE* pXSprite); bool getDudesForTargetChg(XSPRITE* pXSprite);
void stopWindOnSectors(XSPRITE* pXSource); void stopWindOnSectors(XSPRITE* pXSource);
@ -84,7 +84,7 @@ void TeleFrag(int nKiller, int nSector);
bool valueIsBetween(int val, int min, int max); bool valueIsBetween(int val, int min, int max);
void trPlayerCtrlLink(XSPRITE* pXSource, PLAYER* pPlayer); void trPlayerCtrlLink(XSPRITE* pXSource, PLAYER* pPlayer);
void trPlayerCtrlStartScene(XSPRITE* pXSource, PLAYER* pPlayer, int causedBy); void trPlayerCtrlStartScene(XSPRITE* pXSource, PLAYER* pPlayer);
void trPlayerCtrlStopScene(XSPRITE* pXSource, PLAYER* pPlayer); void trPlayerCtrlStopScene(XSPRITE* pXSource, PLAYER* pPlayer);
// ------------------------------------------------------- // -------------------------------------------------------

View file

@ -1005,7 +1005,7 @@ void ThrowCan(int, PLAYER *pPlayer)
if (pSprite) if (pSprite)
{ {
sfxPlay3DSound(pSprite, 441, 0, 0); sfxPlay3DSound(pSprite, 441, 0, 0);
evPost(pSprite->index, 3, pPlayer->fuseTime, kCmdOn, pPlayer->nSprite); evPost(pSprite->index, 3, pPlayer->fuseTime, kCmdOn);
int nXSprite = pSprite->extra; int nXSprite = pSprite->extra;
XSPRITE *pXSprite = &xsprite[nXSprite]; XSPRITE *pXSprite = &xsprite[nXSprite];
pXSprite->Impact = 1; pXSprite->Impact = 1;
@ -1020,7 +1020,7 @@ void DropCan(int, PLAYER *pPlayer)
spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedSpray, 0); spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedSpray, 0);
if (pSprite) if (pSprite)
{ {
evPost(pSprite->index, 3, pPlayer->fuseTime, kCmdOn, pPlayer->nSprite); evPost(pSprite->index, 3, pPlayer->fuseTime, kCmdOn);
UseAmmo(pPlayer, 6, gAmmoItemData[0].count); UseAmmo(pPlayer, 6, gAmmoItemData[0].count);
} }
} }
@ -1029,7 +1029,7 @@ void ExplodeCan(int, PLAYER *pPlayer)
{ {
sfxKill3DSound(pPlayer->pSprite, -1, 441); sfxKill3DSound(pPlayer->pSprite, -1, 441);
spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedSpray, 0); spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedSpray, 0);
evPost(pSprite->index, 3, 0, kCmdOn, pPlayer->nSprite); evPost(pSprite->index, 3, 0, kCmdOn);
UseAmmo(pPlayer, 6, gAmmoItemData[0].count); UseAmmo(pPlayer, 6, gAmmoItemData[0].count);
StartQAV(pPlayer, 15, -1); StartQAV(pPlayer, 15, -1);
pPlayer->curWeapon = 0; pPlayer->curWeapon = 0;
@ -1047,7 +1047,7 @@ void ThrowBundle(int, PLAYER *pPlayer)
if (pPlayer->fuseTime < 0) if (pPlayer->fuseTime < 0)
pXSprite->Impact = 1; pXSprite->Impact = 1;
else else
evPost(pSprite->index, 3, pPlayer->fuseTime, kCmdOn, pPlayer->nSprite); evPost(pSprite->index, 3, pPlayer->fuseTime, kCmdOn);
UseAmmo(pPlayer, 5, 1); UseAmmo(pPlayer, 5, 1);
pPlayer->throwPower = 0; pPlayer->throwPower = 0;
} }
@ -1056,7 +1056,7 @@ void DropBundle(int, PLAYER *pPlayer)
{ {
sfxKill3DSound(pPlayer->pSprite, 16, -1); sfxKill3DSound(pPlayer->pSprite, 16, -1);
spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedTNTBundle, 0); spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedTNTBundle, 0);
evPost(pSprite->index, 3, pPlayer->fuseTime, kCmdOn, pPlayer->nSprite); evPost(pSprite->index, 3, pPlayer->fuseTime, kCmdOn);
UseAmmo(pPlayer, 5, 1); UseAmmo(pPlayer, 5, 1);
} }
@ -1064,7 +1064,7 @@ void ExplodeBundle(int, PLAYER *pPlayer)
{ {
sfxKill3DSound(pPlayer->pSprite, 16, -1); sfxKill3DSound(pPlayer->pSprite, 16, -1);
spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedTNTBundle, 0); spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedTNTBundle, 0);
evPost(pSprite->index, 3, 0, kCmdOn, pPlayer->nSprite); evPost(pSprite->index, 3, 0, kCmdOn);
UseAmmo(pPlayer, 5, 1); UseAmmo(pPlayer, 5, 1);
StartQAV(pPlayer, 24, -1, 0); StartQAV(pPlayer, 24, -1, 0);
pPlayer->curWeapon = 0; pPlayer->curWeapon = 0;
@ -1076,7 +1076,7 @@ void ThrowProx(int, PLAYER *pPlayer)
int nSpeed = mulscale16(pPlayer->throwPower, 0x177777)+0x66666; int nSpeed = mulscale16(pPlayer->throwPower, 0x177777)+0x66666;
sfxPlay3DSound(pPlayer->pSprite, 455, 1, 0); sfxPlay3DSound(pPlayer->pSprite, 455, 1, 0);
spritetype *pSprite = playerFireThing(pPlayer, 0, -9460, kThingArmedProxBomb, nSpeed); spritetype *pSprite = playerFireThing(pPlayer, 0, -9460, kThingArmedProxBomb, nSpeed);
evPost(pSprite->index, 3, 240, kCmdOn, pPlayer->nSprite); evPost(pSprite->index, 3, 240, kCmdOn);
UseAmmo(pPlayer, 10, 1); UseAmmo(pPlayer, 10, 1);
pPlayer->throwPower = 0; pPlayer->throwPower = 0;
} }
@ -1084,7 +1084,7 @@ void ThrowProx(int, PLAYER *pPlayer)
void DropProx(int, PLAYER *pPlayer) void DropProx(int, PLAYER *pPlayer)
{ {
spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedProxBomb, 0); spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedProxBomb, 0);
evPost(pSprite->index, 3, 240, kCmdOn, pPlayer->nSprite); evPost(pSprite->index, 3, 240, kCmdOn);
UseAmmo(pPlayer, 10, 1); UseAmmo(pPlayer, 10, 1);
} }
@ -1111,7 +1111,7 @@ void DropRemote(int, PLAYER *pPlayer)
void FireRemote(int, PLAYER *pPlayer) void FireRemote(int, PLAYER *pPlayer)
{ {
evSend(0, 0, 90+(pPlayer->pSprite->type-kDudePlayer1), kCmdOn, pPlayer->nSprite); evSend(0, 0, 90+(pPlayer->pSprite->type-kDudePlayer1), kCmdOn);
} }
#define kMaxShotgunBarrels 4 #define kMaxShotgunBarrels 4
@ -1946,9 +1946,9 @@ void WeaponProcess(PLAYER *pPlayer) {
XSPRITE* pXSprite = &xsprite[sprite[nIndex].extra]; XSPRITE* pXSprite = &xsprite[sprite[nIndex].extra];
if (pXSprite->waitTime > 0 && --pXSprite->sysData1 <= 0) { if (pXSprite->waitTime > 0 && --pXSprite->sysData1 <= 0) {
if (pXSprite->txID > 0) if (pXSprite->txID > 0)
evSend(nIndex, 3, pXSprite->txID, (COMMAND_ID) pXSprite->command, pQavScene->causedBy); evSend(nIndex, 3, pXSprite->txID, (COMMAND_ID) pXSprite->command);
if (pXSprite->locked) trPlayerCtrlStopScene(pXSprite, pPlayer); if (pXSprite->locked) trPlayerCtrlStopScene(pXSprite, pPlayer);
else evPost(nIndex, 3, 0, (COMMAND_ID) (kCmdNumberic + 4), pQavScene->causedBy); else evPost(nIndex, 3, 0, (COMMAND_ID) (kCmdNumberic + 4));
} else { } else {
qavScenePlay(pPlayer); qavScenePlay(pPlayer);
pPlayer->weaponTimer = ClipLow(pPlayer->weaponTimer -= 4, 0); pPlayer->weaponTimer = ClipLow(pPlayer->weaponTimer -= 4, 0);