- trMessage* functions.

# Conflicts:
#	source/games/blood/src/eventq.cpp
This commit is contained in:
Christoph Oelckers 2021-11-23 20:58:30 +01:00
parent 45a8654fc2
commit 7bffcad49f
5 changed files with 41 additions and 35 deletions

View file

@ -484,11 +484,11 @@ void evSend(const EventObject& eob, int rxId, COMMAND_ID command)
{
if (eo.isSector())
{
trMessageSector(sectnum(eo.sector()), event);
trMessageSector(eo.sector(), event);
}
else if (eo.isWall())
{
trMessageWall(wallnum(eo.wall()), event);
trMessageWall(eo.wall(), event);
}
else if (eo.isActor())
{
@ -646,8 +646,8 @@ void evProcess(unsigned int time)
else
{
if (event.target.isActor()) trMessageSprite(event.target.actor(), event);
else if (event.target.isSector()) trMessageSector(sectnum(event.target.sector()), event);
else if (event.target.isWall()) trMessageWall(wallnum(event.target.wall()), event);
else if (event.target.isSector()) trMessageSector(event.target.sector(), event);
else if (event.target.isWall()) trMessageWall(event.target.wall(), event);
}
}
}

View file

@ -4718,7 +4718,7 @@ void modernTypeSendCommand(DBloodActor* actor, int destChannel, COMMAND_ID comma
//
//---------------------------------------------------------------------------
void modernTypeTrigger(int destObjType, int destObjIndex, DBloodActor* destactor, const EVENT& event)
void modernTypeTrigger(int destObjType, sectortype* destSect, walltype* destWall, DBloodActor* destactor, const EVENT& event)
{
if (!event.isActor()) return;
auto pActor = event.getActor();
@ -4726,12 +4726,15 @@ void modernTypeTrigger(int destObjType, int destObjIndex, DBloodActor* destactor
spritetype* pSource = &pActor->s();
XSPRITE* pXSource = &pActor->x();
int destObjIndex = -1;
switch (destObjType) {
case OBJ_SECTOR:
if (!sector[destObjIndex].hasX()) return;
if (!destSect || !destSect->hasX()) return;
destObjIndex = sectnum(destSect);
break;
case OBJ_WALL:
if (!wall[destObjIndex].hasX()) return;
if (!destWall || !destWall->hasX()) return;
destObjIndex = wallnum(destWall);
break;
case OBJ_SPRITE:
{

View file

@ -331,7 +331,7 @@ void seqTxSendCmdAll(DBloodActor* pXSource, DBloodActor* nIndex, COMMAND_ID cmd,
void trPlayerCtrlLink(DBloodActor* pXSource, PLAYER* pPlayer, bool checkCondition);
void trPlayerCtrlStopScene(PLAYER* pPlayer);
// ------------------------------------------------------------------------- //
void modernTypeTrigger(int type, int nDest, DBloodActor* actor, const EVENT& event);
void modernTypeTrigger(int type, sectortype*sect, walltype* wal, DBloodActor* actor, const EVENT& event);
bool modernTypeOperateSector(int nSector, sectortype* pSector, XSECTOR* pXSector, const EVENT& event);
bool modernTypeOperateSprite(DBloodActor*, const EVENT& event);
bool modernTypeOperateWall(int nWall, walltype* pWall, XWALL* pXWall, EVENT event);

View file

@ -1512,16 +1512,17 @@ void OperatePath(unsigned int nSector, XSECTOR *pXSector, EVENT event)
}
}
void OperateSector(unsigned int nSector, XSECTOR *pXSector, EVENT event)
void OperateSector(sectortype* pSector, EVENT event)
{
assert(nSector < (unsigned int)numsectors);
sectortype *pSector = &sector[nSector];
if (!pSector->hasX()) return;
auto pXSector = &pSector->xs();
#ifdef NOONE_EXTENSIONS
if (gModernMap && modernTypeOperateSector(nSector, pSector, pXSector, event))
if (gModernMap && modernTypeOperateSector(sectnum(pSector), pSector, pXSector, event))
return;
#endif
int nSector = sectnum(pSector);
switch (event.cmd) {
case kCmdLock:
pXSector->locked = 1;
@ -1727,7 +1728,7 @@ void trTriggerSector(sectortype* pSector, int command)
else {
EVENT event;
event.cmd = command;
OperateSector(sectnum(pSector), pXSector, event);
OperateSector(pSector, event);
}
}
@ -1775,47 +1776,47 @@ void trTriggerSprite(DBloodActor* actor, int command)
}
}
void trMessageSector(unsigned int nSector, EVENT event)
void trMessageSector(sectortype* pSector, EVENT event)
{
assert(validSectorIndex(nSector));
assert(sector[nSector].hasX());
XSECTOR *pXSector = &sector[nSector].xs();
if (!pXSector->locked || event.cmd == kCmdUnlock || event.cmd == kCmdToggleLock) {
switch (event.cmd) {
if (!pSector->hasX()) return;
XSECTOR *pXSector = &pSector->xs();
if (!pXSector->locked || event.cmd == kCmdUnlock || event.cmd == kCmdToggleLock)
{
switch (event.cmd)
{
case kCmdLink:
LinkSector(nSector, pXSector, event);
LinkSector(sectnum(pSector), pXSector, event);
break;
#ifdef NOONE_EXTENSIONS
case kCmdModernUse:
modernTypeTrigger(6, nSector, nullptr, event);
modernTypeTrigger(OBJ_SECTOR, pSector, nullptr, nullptr, event);
break;
#endif
default:
OperateSector(nSector, pXSector, event);
OperateSector(pSector, event);
break;
}
}
}
void trMessageWall(unsigned int nWall, EVENT event)
void trMessageWall(walltype* pWall, const EVENT& event)
{
assert(validWallIndex(nWall));
auto pWall = &wall[nWall];
assert(pWall->hasX());
XWALL *pXWall = &pWall->xw();
if (!pXWall->locked || event.cmd == kCmdUnlock || event.cmd == kCmdToggleLock) {
if (!pXWall->locked || event.cmd == kCmdUnlock || event.cmd == kCmdToggleLock)
{
switch (event.cmd) {
case kCmdLink:
LinkWall(nWall, pXWall, event);
LinkWall(wallnum(pWall), pXWall, event);
break;
#ifdef NOONE_EXTENSIONS
case kCmdModernUse:
modernTypeTrigger(0, nWall, nullptr, event);
modernTypeTrigger(OBJ_WALL, nullptr, pWall, nullptr, event);
break;
#endif
default:
OperateWall(&wall[nWall], event);
OperateWall(pWall, event);
break;
}
}
@ -1827,14 +1828,16 @@ void trMessageSprite(DBloodActor* actor, EVENT event)
auto pXSprite = &actor->x();
if (pSprite->statnum != kStatFree) {
if (!pXSprite->locked || event.cmd == kCmdUnlock || event.cmd == kCmdToggleLock) {
switch (event.cmd) {
if (!pXSprite->locked || event.cmd == kCmdUnlock || event.cmd == kCmdToggleLock)
{
switch (event.cmd)
{
case kCmdLink:
LinkSprite(actor, event);
break;
#ifdef NOONE_EXTENSIONS
case kCmdModernUse:
modernTypeTrigger(OBJ_SPRITE, 0, actor, event);
modernTypeTrigger(OBJ_SPRITE, 0, 0, actor, event);
break;
#endif
default:

View file

@ -54,9 +54,9 @@ extern BUSY gBusy[kMaxBusyCount];
extern int gBusyCount;
void trTriggerSector(sectortype *pSector, int command);
void trMessageSector(unsigned int nSector, EVENT event);
void trMessageSector(sectortype* pSector, EVENT event);
void trTriggerWall(walltype*, int command);
void trMessageWall(unsigned int nWall, EVENT event);
void trMessageWall(walltype* pWall, const EVENT& event);
void trTriggerSprite(DBloodActor* actor, int command);
void trMessageSprite(DBloodActor* actor, EVENT event);
void trProcessBusy(void);