mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
- formatting only.
This commit is contained in:
parent
57c3571555
commit
baf4bb0785
2 changed files with 111 additions and 41 deletions
|
@ -3810,8 +3810,14 @@ bool condCheckGame(XSPRITE* pXCond, EVENT event, int cmpOp, bool PUSH) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool condCheckMixed(XSPRITE* pXCond, EVENT event, int cmpOp, bool PUSH) {
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool condCheckMixed(XSPRITE* pXCond, EVENT event, int cmpOp, bool PUSH)
|
||||
{
|
||||
//int var = -1;
|
||||
int cond = pXCond->data1 - kCondMixedBase; int arg1 = pXCond->data2;
|
||||
int arg2 = pXCond->data3; int arg3 = pXCond->data4;
|
||||
|
@ -5053,7 +5059,12 @@ bool aiFightIsMateOf(XSPRITE* pXDude, XSPRITE* pXSprite) {
|
|||
return (pXDude->rxID == pXSprite->rxID);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// this function tells if there any dude found for kModernDudeTargetChanger
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool aiFightGetDudesForBattle(XSPRITE* pXSprite) {
|
||||
|
||||
for (int i = bucketHead[pXSprite->txID]; i < bucketHead[pXSprite->txID + 1]; i++) {
|
||||
|
@ -5076,6 +5087,12 @@ bool aiFightGetDudesForBattle(XSPRITE* pXSprite) {
|
|||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void aiFightAlarmDudesInSight(spritetype* pSprite, int max) {
|
||||
spritetype* pDude = NULL; XSPRITE* pXDude = NULL;
|
||||
XSPRITE* pXSprite = &xsprite[pSprite->extra];
|
||||
|
@ -5100,6 +5117,12 @@ void aiFightAlarmDudesInSight(spritetype* pSprite, int max) {
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool aiFightUnitCanFly(spritetype* pDude) {
|
||||
return (IsDudeSprite(pDude) && gDudeInfoExtra[pDude->type - kDudeBase].flying);
|
||||
}
|
||||
|
@ -5109,6 +5132,12 @@ bool aiFightIsMeleeUnit(spritetype* pDude) {
|
|||
else return (IsDudeSprite(pDude) && gDudeInfoExtra[pDude->type - kDudeBase].melee);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int aiFightGetTargetDist(spritetype* pSprite, DUDEINFO* pDudeInfo, spritetype* pTarget) {
|
||||
int x = pTarget->x; int y = pTarget->y;
|
||||
int dx = x - pSprite->x; int dy = y - pSprite->y;
|
||||
|
@ -5130,6 +5159,12 @@ int aiFightGetTargetDist(spritetype* pSprite, DUDEINFO* pDudeInfo, spritetype* p
|
|||
return 12;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int aiFightGetFineTargetDist(spritetype* pSprite, spritetype* pTarget) {
|
||||
int x = pTarget->x; int y = pTarget->y;
|
||||
int dx = x - pSprite->x; int dy = y - pSprite->y;
|
||||
|
@ -5138,15 +5173,28 @@ int aiFightGetFineTargetDist(spritetype* pSprite, spritetype* pTarget) {
|
|||
return dist;
|
||||
}
|
||||
|
||||
int sectorInMotion(int nSector) {
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
for (int i = 0; i < kMaxBusyCount; i++) {
|
||||
int sectorInMotion(int nSector)
|
||||
{
|
||||
|
||||
for (int i = 0; i < kMaxBusyCount; i++)
|
||||
{
|
||||
if (gBusy->index == nSector) return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void sectorKillSounds(int nSector) {
|
||||
for (int nSprite = headspritesect[nSector]; nSprite >= 0; nSprite = nextspritesect[nSprite]) {
|
||||
if (sprite[nSprite].type != kSoundSector) continue;
|
||||
|
@ -5154,8 +5202,14 @@ void sectorKillSounds(int nSector) {
|
|||
}
|
||||
}
|
||||
|
||||
void sectorPauseMotion(int nSector) {
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void sectorPauseMotion(int nSector)
|
||||
{
|
||||
if (!xsectRangeIsFine(sector[nSector].extra)) return;
|
||||
XSECTOR* pXSector = &xsector[sector[nSector].extra];
|
||||
pXSector->unused1 = 1;
|
||||
|
@ -5165,14 +5219,15 @@ void sectorPauseMotion(int nSector) {
|
|||
sectorKillSounds(nSector);
|
||||
if ((pXSector->busy == 0 && !pXSector->state) || (pXSector->busy == 65536 && pXSector->state))
|
||||
SectorEndSound(nSector, xsector[sector[nSector].extra].state);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void sectorContinueMotion(int nSector, EVENT event) {
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void sectorContinueMotion(int nSector, EVENT event)
|
||||
{
|
||||
if (!xsectRangeIsFine(sector[nSector].extra)) return;
|
||||
else if (gBusyCount >= kMaxBusyCount) {
|
||||
else if (gBusyCount >= kMaxBusyCount)
|
||||
{
|
||||
Printf(PRINT_HIGH, "Failed to continue motion for sector #%d. Max (%d) busy objects count reached!", nSector, kMaxBusyCount);
|
||||
return;
|
||||
}
|
||||
|
@ -5180,45 +5235,52 @@ void sectorContinueMotion(int nSector, EVENT event) {
|
|||
XSECTOR* pXSector = &xsector[sector[nSector].extra];
|
||||
pXSector->unused1 = 0;
|
||||
|
||||
int busyTimeA = pXSector->busyTimeA; int waitTimeA = pXSector->waitTimeA;
|
||||
int busyTimeB = pXSector->busyTimeB; int waitTimeB = pXSector->waitTimeB;
|
||||
if (sector[nSector].type == kSectorPath) {
|
||||
int busyTimeA = pXSector->busyTimeA;
|
||||
int waitTimeA = pXSector->waitTimeA;
|
||||
int busyTimeB = pXSector->busyTimeB;
|
||||
int waitTimeB = pXSector->waitTimeB;
|
||||
if (sector[nSector].type == kSectorPath)
|
||||
{
|
||||
if (!spriRangeIsFine(pXSector->marker0)) return;
|
||||
busyTimeA = busyTimeB = xsprite[sprite[pXSector->marker0].extra].busyTime;
|
||||
waitTimeA = waitTimeB = xsprite[sprite[pXSector->marker0].extra].waitTime;
|
||||
}
|
||||
|
||||
if (!pXSector->interruptable && event.cmd != kCmdSectorMotionContinue
|
||||
&& ((!pXSector->state && pXSector->busy) || (pXSector->state && pXSector->busy != 65536))) {
|
||||
|
||||
&& ((!pXSector->state && pXSector->busy) || (pXSector->state && pXSector->busy != 65536)))
|
||||
{
|
||||
event.cmd = kCmdSectorMotionContinue;
|
||||
|
||||
} else if (event.cmd == kCmdToggle) {
|
||||
|
||||
}
|
||||
else if (event.cmd == kCmdToggle)
|
||||
{
|
||||
event.cmd = (pXSector->state) ? kCmdOn : kCmdOff;
|
||||
|
||||
}
|
||||
|
||||
//viewSetSystemMessage("%d / %d", pXSector->busy, pXSector->state);
|
||||
|
||||
int nDelta = 1;
|
||||
switch (event.cmd) {
|
||||
switch (event.cmd)
|
||||
{
|
||||
case kCmdOff:
|
||||
if (pXSector->busy == 0) {
|
||||
if (pXSector->busy == 0)
|
||||
{
|
||||
if (pXSector->reTriggerB && waitTimeB) evPostSector(nSector, (waitTimeB * 120) / 10, kCmdOff);
|
||||
return;
|
||||
}
|
||||
pXSector->state = 1;
|
||||
nDelta = 65536 / ClipLow((busyTimeB * 120) / 10, 1);
|
||||
break;
|
||||
|
||||
case kCmdOn:
|
||||
if (pXSector->busy == 65536) {
|
||||
if (pXSector->busy == 65536)
|
||||
{
|
||||
if (pXSector->reTriggerA && waitTimeA) evPostSector(nSector, (waitTimeA * 120) / 10, kCmdOn);
|
||||
return;
|
||||
}
|
||||
pXSector->state = 0;
|
||||
nDelta = 65536 / ClipLow((busyTimeA * 120) / 10, 1);
|
||||
break;
|
||||
|
||||
case kCmdSectorMotionContinue:
|
||||
nDelta = 65536 / ClipLow((((pXSector->state) ? busyTimeB : busyTimeA) * 120) / 10, 1);
|
||||
break;
|
||||
|
@ -5226,7 +5288,8 @@ void sectorContinueMotion(int nSector, EVENT event) {
|
|||
|
||||
//bool crush = pXSector->Crush;
|
||||
int busyFunc = BUSYID_0;
|
||||
switch (sector[nSector].type) {
|
||||
switch (sector[nSector].type)
|
||||
{
|
||||
case kSectorZMotion:
|
||||
busyFunc = BUSYID_2;
|
||||
break;
|
||||
|
@ -5259,15 +5322,15 @@ void sectorContinueMotion(int nSector, EVENT event) {
|
|||
gBusy[gBusyCount].busy = pXSector->busy;
|
||||
gBusy[gBusyCount].type = (BUSYID)busyFunc;
|
||||
gBusyCount++;
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
bool modernTypeOperateSector(int nSector, sectortype* pSector, XSECTOR* pXSector, EVENT event) {
|
||||
|
||||
if (event.cmd >= kCmdLock && event.cmd <= kCmdToggleLock) {
|
||||
|
||||
switch (event.cmd) {
|
||||
bool modernTypeOperateSector(int nSector, sectortype* pSector, XSECTOR* pXSector, const EVENT& event)
|
||||
{
|
||||
if (event.cmd >= kCmdLock && event.cmd <= kCmdToggleLock)
|
||||
{
|
||||
switch (event.cmd)
|
||||
{
|
||||
case kCmdLock:
|
||||
pXSector->locked = 1;
|
||||
break;
|
||||
|
@ -5279,20 +5342,22 @@ bool modernTypeOperateSector(int nSector, sectortype* pSector, XSECTOR* pXSector
|
|||
break;
|
||||
}
|
||||
|
||||
switch (pSector->type) {
|
||||
switch (pSector->type)
|
||||
{
|
||||
case kSectorCounter:
|
||||
if (pXSector->locked != 1) break;
|
||||
SetSectorState(nSector, pXSector, 0);
|
||||
evPostSector(nSector, 0, kCallbackCounterCheck);
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
// continue motion of the paused sector
|
||||
} else if (pXSector->unused1) {
|
||||
|
||||
switch (event.cmd) {
|
||||
}
|
||||
else if (pXSector->unused1)
|
||||
{
|
||||
switch (event.cmd)
|
||||
{
|
||||
case kCmdOff:
|
||||
case kCmdOn:
|
||||
case kCmdToggle:
|
||||
|
@ -5302,17 +5367,16 @@ bool modernTypeOperateSector(int nSector, sectortype* pSector, XSECTOR* pXSector
|
|||
}
|
||||
|
||||
// pause motion of the sector
|
||||
} else if (event.cmd == kCmdSectorMotionPause) {
|
||||
|
||||
}
|
||||
else if (event.cmd == kCmdSectorMotionPause)
|
||||
{
|
||||
sectorPauseMotion(nSector);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void useCustomDudeSpawn(DBloodActor* pSource, DBloodActor* pSprite)
|
||||
{
|
||||
genDudeSpawn(pSource, pSprite, pSprite->s().clipdist << 1);
|
||||
|
@ -5324,6 +5388,12 @@ void useDudeSpawn(XSPRITE* pXSource, spritetype* pSprite) {
|
|||
nnExtSpawnDude(&bloodActors[pXSource->reference], &bloodActors[pSprite->index], pXSource->data1, pSprite->clipdist << 1, 0);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite, EVENT event) {
|
||||
|
||||
auto actor = &bloodActors[pSprite->index];
|
||||
|
|
|
@ -345,7 +345,7 @@ void trPlayerCtrlLink(DBloodActor* pXSource, PLAYER* pPlayer, bool checkConditio
|
|||
void trPlayerCtrlStopScene(PLAYER* pPlayer);
|
||||
// ------------------------------------------------------------------------- //
|
||||
void modernTypeTrigger(int type, int nDest, DBloodActor* actor, const EVENT& event);
|
||||
bool modernTypeOperateSector(int nSector, sectortype* pSector, XSECTOR* pXSector, EVENT event);
|
||||
bool modernTypeOperateSector(int nSector, sectortype* pSector, XSECTOR* pXSector, const EVENT& event);
|
||||
bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite, EVENT event);
|
||||
bool modernTypeOperateWall(int nWall, walltype* pWall, XWALL* pXWall, EVENT event);
|
||||
void modernTypeSendCommand(DBloodActor* nSprite, int channel, COMMAND_ID command);
|
||||
|
|
Loading…
Reference in a new issue