- changed evPostSector to receive a sector pointer instead of index.

This commit is contained in:
Christoph Oelckers 2021-11-23 17:21:07 +01:00
parent 292f100114
commit 37f4843953
5 changed files with 19 additions and 15 deletions

View file

@ -368,7 +368,7 @@ void CounterCheck(DBloodActor*, int nSector) // 12
}
if (nCount < nReq) {
evPostSector(nSector, 5, kCallbackCounterCheck);
evPostSector(pSector, 5, kCallbackCounterCheck);
return;
} else {
//pXSector->waitTimeA = 0; //do not reset necessary objects counter to zero

View file

@ -527,14 +527,14 @@ void evPostActor(DBloodActor* actor, unsigned int nDelta, CALLBACK_ID callback)
evPost_(actor, 0, SS_SPRITE, nDelta, callback);
}
void evPostSector(int index, unsigned int nDelta, COMMAND_ID command)
void evPostSector(sectortype* sect, unsigned int nDelta, COMMAND_ID command)
{
evPost_(nullptr, index, SS_SECTOR, nDelta, command);
evPost_(nullptr, sectnum(sect), SS_SECTOR, nDelta, command);
}
void evPostSector(int index, unsigned int nDelta, CALLBACK_ID callback)
void evPostSector(sectortype* sect, unsigned int nDelta, CALLBACK_ID callback)
{
evPost_(nullptr, index, SS_SECTOR, nDelta, callback);
evPost_(nullptr, sectnum(sect), SS_SECTOR, nDelta, callback);
}
void evPostWall(int index, unsigned int nDelta, COMMAND_ID command)

View file

@ -204,8 +204,10 @@ void evInit(void);
void evPostActor(DBloodActor*, unsigned int nDelta, COMMAND_ID command);
void evPostActor(DBloodActor*, unsigned int nDelta, CALLBACK_ID callback);
void evPostSector(int index, unsigned int nDelta, COMMAND_ID command);
void evPostSector(int index, unsigned int nDelta, CALLBACK_ID callback);
void evPostSector(sectortype* index, unsigned int nDelta, COMMAND_ID command);
void evPostSector(sectortype* index, unsigned int nDelta, CALLBACK_ID callback);
void evPostWall(int index, unsigned int nDelta, COMMAND_ID command);
void evProcess(unsigned int nTime);
void evKillActor(DBloodActor*);

View file

@ -5360,7 +5360,7 @@ void sectorContinueMotion(int nSector, EVENT event)
case kCmdOff:
if (pXSector->busy == 0)
{
if (pXSector->reTriggerB && waitTimeB) evPostSector(nSector, (waitTimeB * 120) / 10, kCmdOff);
if (pXSector->reTriggerB && waitTimeB) evPostSector(pSector, (waitTimeB * 120) / 10, kCmdOff);
return;
}
pXSector->state = 1;
@ -5370,7 +5370,7 @@ void sectorContinueMotion(int nSector, EVENT event)
case kCmdOn:
if (pXSector->busy == 65536)
{
if (pXSector->reTriggerA && waitTimeA) evPostSector(nSector, (waitTimeA * 120) / 10, kCmdOn);
if (pXSector->reTriggerA && waitTimeA) evPostSector(pSector, (waitTimeA * 120) / 10, kCmdOn);
return;
}
pXSector->state = 0;
@ -5448,7 +5448,7 @@ bool modernTypeOperateSector(int nSector, sectortype* pSector, XSECTOR* pXSector
case kSectorCounter:
if (pXSector->locked != 1) break;
SetSectorState(nSector, pXSector, 0);
evPostSector(nSector, 0, kCallbackCounterCheck);
evPostSector(pSector, 0, kCallbackCounterCheck);
break;
}
return true;

View file

@ -97,6 +97,7 @@ bool SetWallState(walltype* pWall, int nState)
bool SetSectorState(int nSector, XSECTOR *pXSector, int nState)
{
auto pSector = &sector[nSector];
if ((pXSector->busy&0xffff) == 0 && pXSector->state == nState)
return 0;
pXSector->busy = IntToFixed(nState);
@ -112,7 +113,7 @@ bool SetSectorState(int nSector, XSECTOR *pXSector, int nState)
pXSector->stopOff = 0;
}
else if (pXSector->reTriggerA)
evPostSector(nSector, (pXSector->waitTimeA * 120) / 10, kCmdOff);
evPostSector(pSector, (pXSector->waitTimeA * 120) / 10, kCmdOff);
}
else
{
@ -124,7 +125,7 @@ bool SetSectorState(int nSector, XSECTOR *pXSector, int nState)
pXSector->stopOff = 0;
}
else if (pXSector->reTriggerB)
evPostSector(nSector, (pXSector->waitTimeB * 120) / 10, kCmdOn);
evPostSector(pSector, (pXSector->waitTimeB * 120) / 10, kCmdOn);
}
return 1;
}
@ -1349,7 +1350,7 @@ int PathBusy(unsigned int nSector, unsigned int a2)
pXSector->busy = a2;
if ((a2&0xffff) == 0)
{
evPostSector(nSector, (120*pXSprite2->waitTime)/10, kCmdOn);
evPostSector(pSector, (120*pXSprite2->waitTime)/10, kCmdOn);
pXSector->state = 0;
pXSector->busy = 0;
if (pXSprite1->data4)
@ -1616,6 +1617,7 @@ void OperateSector(unsigned int nSector, XSECTOR *pXSector, EVENT event)
void InitPath(unsigned int nSector, XSECTOR *pXSector)
{
sectortype* pSector = &sector[nSector];
DBloodActor* actor = nullptr;
spritetype *pSprite = nullptr;
XSPRITE *pXSprite;
@ -1643,7 +1645,7 @@ void InitPath(unsigned int nSector, XSECTOR *pXSector)
pXSector->basePath = pXSector->marker0 = actor;
if (pXSector->state)
evPostSector(nSector, 0, kCmdOn);
evPostSector(pSector, 0, kCmdOn);
}
void LinkSector(int nSector, XSECTOR *pXSector, EVENT event)
@ -2041,7 +2043,7 @@ void trInit(void)
else
#endif
pXSector->triggerOnce = 1;
evPostSector(i, 0, kCallbackCounterCheck);
evPostSector(pSector, 0, kCallbackCounterCheck);
break;
case kSectorZMotion:
case kSectorZMotionSprite: