- removed pX... parameter from from trTriggerSector.

This commit is contained in:
Christoph Oelckers 2021-11-19 18:27:50 +01:00
parent ccd6af6272
commit f06697ed29
7 changed files with 21 additions and 19 deletions

View file

@ -4907,7 +4907,7 @@ void MoveDude(DBloodActor* actor)
XSECTOR* pHitXSector = pHitSector->hasX()? &pHitSector->xs() : nullptr;
if (pDudeInfo->lockOut && pHitXSector && pHitXSector->Wallpush && !pHitXSector->Key && !pHitXSector->dudeLockout && !pHitXSector->state && !pHitXSector->busy && !pPlayer)
trTriggerSector(pHitWall->nextsector, pHitXSector, kCmdSectorPush);
trTriggerSector(pHitSector, kCmdSectorPush);
if (top < pHitSector->ceilingz || bottom > pHitSector->floorz)
{
@ -4935,14 +4935,14 @@ void MoveDude(DBloodActor* actor)
XSECTOR* pXOldSector = pOldSector->hasX()? &pOldSector->xs() : nullptr;
if (pXOldSector && pXOldSector->Exit && (pPlayer || !pXOldSector->dudeLockout))
trTriggerSector(pSprite->sectnum, pXOldSector, kCmdSectorExit);
trTriggerSector(pOldSector, kCmdSectorExit);
ChangeActorSect(actor, nSector);
if (pXSector && pXSector->Enter && (pPlayer || !pXSector->dudeLockout))
{
if (pSector->type == kSectorTeleport)
pXSector->actordata = actor;
trTriggerSector(nSector, pXSector, kCmdSectorEnter);
trTriggerSector(pSector, kCmdSectorEnter);
}
nSector = pSprite->sectnum;

View file

@ -351,11 +351,14 @@ void EnemyBubble(DBloodActor* actor, int) // 11
void CounterCheck(DBloodActor*, int nSector) // 12
{
if (!validSectorIndex(nSector)) return;
if (sector[nSector].type != kSectorCounter) return;
if (sector[nSector].extra <= 0) return;
auto pSector = &sector[nSector];
if (pSector->type != kSectorCounter) return;
if (pSector->extra <= 0) return;
XSECTOR *pXSector = &xsector[sector[nSector].extra];
int nReq = pXSector->waitTimeA; int nType = pXSector->data; int nCount = 0;
XSECTOR *pXSector = &xsector[pSector->extra];
int nReq = pXSector->waitTimeA;
int nType = pXSector->data;
int nCount = 0;
if (!nType || !nReq) return;
BloodSectIterator it(nSector);
@ -369,7 +372,7 @@ void CounterCheck(DBloodActor*, int nSector) // 12
return;
} else {
//pXSector->waitTimeA = 0; //do not reset necessary objects counter to zero
trTriggerSector(nSector, pXSector, kCmdOn);
trTriggerSector(pSector, kCmdOn);
pXSector->locked = 1; //lock sector, so it can be opened again later
}
}

View file

@ -48,7 +48,6 @@ static std::multiset<EVENT> queue;
static int GetBucketChannel(const RXBUCKET* pBucket)
{
int nXIndex;
switch (pBucket->type)
{
case SS_SECTOR:

View file

@ -457,8 +457,7 @@ void nnExtTriggerObject(int objType, int objIndex, DBloodActor* objActor, int co
switch (objType)
{
case OBJ_SECTOR:
if (!xsectRangeIsFine(sector[objIndex].extra)) break;
trTriggerSector(objIndex, &xsector[sector[objIndex].extra], command);
trTriggerSector(&sector[objIndex], command);
break;
case OBJ_WALL:
trTriggerWall(&wall[objIndex], command);
@ -3038,7 +3037,7 @@ void useTeleportTarget(DBloodActor* sourceactor, DBloodActor* actor)
{
if (pXSector->Enter && (pPlayer || (isDude && !pXSector->dudeLockout)))
trTriggerSector(pSource->sectnum, pXSector, kCmdSectorEnter);
trTriggerSector(pSource->sector(), kCmdSectorEnter);
if (pXSector->Underwater)
{

View file

@ -1518,7 +1518,7 @@ void ProcessInput(PLAYER *pPlayer)
sndStartSample(snd, 255, 2, 0);
}
if (!key || pPlayer->hasKey[key])
trTriggerSector(a2, pXSector, kCmdSpritePush);
trTriggerSector(&sector[a2], kCmdSpritePush);
else if (pPlayer == gMe)
{
viewSetMessage(GStrings("TXTB_KEY"));
@ -2050,7 +2050,7 @@ int playerDamageSprite(DBloodActor* source, PLAYER *pPlayer, DAMAGE_TYPE nDamage
{
powerupClear(pPlayer);
if (nXSector > 0 && xsector[nXSector].Exit)
trTriggerSector(pSprite->sectnum, &xsector[nXSector], kCmdSectorExit);
trTriggerSector(pSprite->sector(), kCmdSectorExit);
pSprite->flags |= 7;
for (int p = connecthead; p >= 0; p = connectpoint2[p])
{

View file

@ -1717,20 +1717,21 @@ void LinkWall(int nWall, XWALL *pXWall, EVENT event)
SetWallState(nWall, pXWall, FixedToInt(nBusy));
}
void trTriggerSector(unsigned int nSector, XSECTOR *pXSector, int command) {
assert(nSector < (unsigned int)numsectors);
void trTriggerSector(sectortype* pSector, int command)
{
auto pXSector = &pSector->xs();
if (!pXSector->locked && !pXSector->isTriggered) {
if (pXSector->triggerOnce)
pXSector->isTriggered = 1;
if (pXSector->decoupled && pXSector->txID > 0)
evSendSector(nSector,pXSector->txID, (COMMAND_ID)pXSector->command);
evSendSector(sectnum(pSector),pXSector->txID, (COMMAND_ID)pXSector->command);
else {
EVENT event;
event.cmd = command;
OperateSector(nSector, pXSector, event);
OperateSector(sectnum(pSector), pXSector, event);
}
}

View file

@ -53,7 +53,7 @@ struct BUSY {
extern BUSY gBusy[kMaxBusyCount];
extern int gBusyCount;
void trTriggerSector(unsigned int nSector, XSECTOR *pXSector, int command);
void trTriggerSector(sectortype *pSector, int command);
void trMessageSector(unsigned int nSector, EVENT event);
void trTriggerWall(walltype*, int command);
void trMessageWall(unsigned int nWall, EVENT event);