mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 22:51:50 +00:00
- modernTypeTrigger
This commit is contained in:
parent
ea8166871a
commit
a449d97b86
3 changed files with 22 additions and 15 deletions
|
@ -4678,11 +4678,15 @@ void modernTypeSendCommand(DBloodActor* actor, int destChannel, COMMAND_ID comma
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// this function used by various new modern types.
|
||||
void modernTypeTrigger(int destObjType, int destObjIndex, EVENT event) {
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void modernTypeTrigger(int destObjType, int destObjIndex, DBloodActor* destactor, const EVENT& event)
|
||||
{
|
||||
if (event.type != OBJ_SPRITE || !event.actor || !event.actor->hasX()) return;
|
||||
auto destactor = destObjType == OBJ_SPRITE? &bloodActors[destObjIndex] : nullptr;
|
||||
spritetype* pSource = &event.actor->s();
|
||||
XSPRITE* pXSource = &event.actor->x();
|
||||
|
||||
|
@ -4694,16 +4698,19 @@ void modernTypeTrigger(int destObjType, int destObjIndex, EVENT event) {
|
|||
if (!xwallRangeIsFine(wall[destObjIndex].extra)) return;
|
||||
break;
|
||||
case OBJ_SPRITE:
|
||||
if (!xspriRangeIsFine(sprite[destObjIndex].extra)) return;
|
||||
else if (sprite[destObjIndex].flags & kHitagFree) return;
|
||||
{
|
||||
if (!destactor) return;
|
||||
auto pSpr = &destactor->s();
|
||||
if (pSpr->flags & kHitagFree) return;
|
||||
|
||||
// allow redirect events received from some modern types.
|
||||
// example: it allows to spawn FX effect if event was received from kModernEffectGen
|
||||
// on many TX channels instead of just one.
|
||||
switch (sprite[destObjIndex].type) {
|
||||
switch (pSpr->type)
|
||||
{
|
||||
case kModernRandomTX:
|
||||
case kModernSequentialTX:
|
||||
spritetype* pSpr = &sprite[destObjIndex]; XSPRITE* pXSpr = &xsprite[pSpr->extra];
|
||||
XSPRITE* pXSpr = &destactor->x();
|
||||
if (pXSpr->command != kCmdLink || pXSpr->locked) break; // no redirect mode detected
|
||||
switch (pSpr->type)
|
||||
{
|
||||
|
@ -4790,7 +4797,7 @@ void modernTypeTrigger(int destObjType, int destObjIndex, EVENT event) {
|
|||
// change target of dudes and make it fight
|
||||
case kModernDudeTargetChanger:
|
||||
if (destObjType != OBJ_SPRITE) break;
|
||||
useTargetChanger(pXSource, &sprite[destObjIndex]);
|
||||
useTargetChanger(pXSource, &destactor->s());
|
||||
break;
|
||||
// change picture and palette of TX ID object
|
||||
case kModernObjPicnumChanger:
|
||||
|
@ -4803,22 +4810,22 @@ void modernTypeTrigger(int destObjType, int destObjIndex, EVENT event) {
|
|||
// updated vanilla sound gen that now allows to play sounds on TX ID sprites
|
||||
case kGenModernSound:
|
||||
if (destObjType != OBJ_SPRITE) break;
|
||||
useSoundGen(pXSource, &sprite[destObjIndex]);
|
||||
useSoundGen(pXSource, &destactor->s());
|
||||
break;
|
||||
// updated ecto skull gen that allows to fire missile from TX ID sprites
|
||||
case kGenModernMissileUniversal:
|
||||
if (destObjType != OBJ_SPRITE) break;
|
||||
useUniMissileGen(pXSource, &sprite[destObjIndex]);
|
||||
useUniMissileGen(pXSource, &destactor->s());
|
||||
break;
|
||||
// spawn enemies on TX ID sprites
|
||||
case kMarkerDudeSpawn:
|
||||
if (destObjType != OBJ_SPRITE) break;
|
||||
useDudeSpawn(pXSource, &sprite[destObjIndex]);
|
||||
useDudeSpawn(pXSource, &destactor->s());
|
||||
break;
|
||||
// spawn custom dude on TX ID sprites
|
||||
case kModernCustomDudeSpawn:
|
||||
if (destObjType != OBJ_SPRITE) break;
|
||||
useCustomDudeSpawn(&bloodActors[pXSource->reference], &bloodActors[destObjIndex]);
|
||||
useCustomDudeSpawn(event.actor, destactor);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -349,7 +349,7 @@ void seqTxSendCmdAll(XSPRITE* pXSource, int nIndex, COMMAND_ID cmd, bool modernS
|
|||
void trPlayerCtrlLink(DBloodActor* pXSource, PLAYER* pPlayer, bool checkCondition);
|
||||
void trPlayerCtrlStopScene(PLAYER* pPlayer);
|
||||
// ------------------------------------------------------------------------- //
|
||||
void modernTypeTrigger(int type, int nDest, EVENT event);
|
||||
void modernTypeTrigger(int type, int nDest, DBloodActor* actor, const EVENT& event);
|
||||
bool modernTypeOperateSector(int nSector, sectortype* pSector, XSECTOR* pXSector, EVENT event);
|
||||
bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite, EVENT event);
|
||||
bool modernTypeOperateWall(int nWall, walltype* pWall, XWALL* pXWall, EVENT event);
|
||||
|
|
|
@ -1798,7 +1798,7 @@ void trMessageSector(unsigned int nSector, EVENT event) {
|
|||
break;
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
case kCmdModernUse:
|
||||
modernTypeTrigger(6, nSector, event);
|
||||
modernTypeTrigger(6, nSector, nullptr, event);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
@ -1820,7 +1820,7 @@ void trMessageWall(unsigned int nWall, EVENT event) {
|
|||
break;
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
case kCmdModernUse:
|
||||
modernTypeTrigger(0, nWall, event);
|
||||
modernTypeTrigger(0, nWall, nullptr, event);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
@ -1841,7 +1841,7 @@ void trMessageSprite(unsigned int nSprite, EVENT event) {
|
|||
break;
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
case kCmdModernUse:
|
||||
modernTypeTrigger(3, nSprite, event);
|
||||
modernTypeTrigger(3, 0, &bloodActors[nSprite], event);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue