mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
- nnext sound functions.
This commit is contained in:
parent
b7c4e4b9fa
commit
d0376e5485
3 changed files with 30 additions and 33 deletions
|
@ -5240,9 +5240,9 @@ int sectorInMotion(int nSector)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void sectorKillSounds(int nSector)
|
||||
void sectorKillSounds(sectortype* pSector)
|
||||
{
|
||||
BloodSectIterator it(nSector);
|
||||
BloodSectIterator it(pSector);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
if (actor->s().type != kSoundSector) continue;
|
||||
|
@ -5256,18 +5256,17 @@ void sectorKillSounds(int nSector)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void sectorPauseMotion(int nSector)
|
||||
void sectorPauseMotion(sectortype* pSector)
|
||||
{
|
||||
auto pSector = §or[nSector];
|
||||
if (!pSector->hasX()) return;
|
||||
XSECTOR* pXSector = &pSector->xs();
|
||||
pXSector->unused1 = 1;
|
||||
|
||||
evKillSector(pSector);
|
||||
|
||||
sectorKillSounds(nSector);
|
||||
sectorKillSounds(pSector);
|
||||
if ((pXSector->busy == 0 && !pXSector->state) || (pXSector->busy == 65536 && pXSector->state))
|
||||
SectorEndSound(nSector, pXSector->state);
|
||||
SectorEndSound(pSector, pXSector->state);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -5276,13 +5275,12 @@ void sectorPauseMotion(int nSector)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void sectorContinueMotion(int nSector, EVENT event)
|
||||
void sectorContinueMotion(sectortype* pSector, EVENT event)
|
||||
{
|
||||
auto pSector = §or[nSector];
|
||||
if (!pSector->hasX()) return;
|
||||
else if (gBusyCount >= kMaxBusyCount)
|
||||
{
|
||||
Printf(PRINT_HIGH, "Failed to continue motion for sector #%d. Max (%d) busy objects count reached!", nSector, kMaxBusyCount);
|
||||
Printf(PRINT_HIGH, "Failed to continue motion for sector. Max (%d) busy objects count reached!", kMaxBusyCount);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5310,8 +5308,6 @@ void sectorContinueMotion(int nSector, EVENT event)
|
|||
event.cmd = (pXSector->state) ? kCmdOn : kCmdOff;
|
||||
}
|
||||
|
||||
//viewSetSystemMessage("%d / %d", pXSector->busy, pXSector->state);
|
||||
|
||||
int nDelta = 1;
|
||||
switch (event.cmd)
|
||||
{
|
||||
|
@ -5369,9 +5365,9 @@ void sectorContinueMotion(int nSector, EVENT event)
|
|||
break;
|
||||
}
|
||||
|
||||
SectorStartSound(nSector, pXSector->state);
|
||||
SectorStartSound(pSector, pXSector->state);
|
||||
nDelta = (pXSector->state) ? -nDelta : nDelta;
|
||||
gBusy[gBusyCount].index = nSector;
|
||||
gBusy[gBusyCount].index = sectnum(pSector);
|
||||
gBusy[gBusyCount].delta = nDelta;
|
||||
gBusy[gBusyCount].busy = pXSector->busy;
|
||||
gBusy[gBusyCount].type = (BUSYID)busyFunc;
|
||||
|
@ -5421,7 +5417,7 @@ bool modernTypeOperateSector(int nSector, sectortype* pSector, XSECTOR* pXSector
|
|||
case kCmdOn:
|
||||
case kCmdToggle:
|
||||
case kCmdSectorMotionContinue:
|
||||
sectorContinueMotion(nSector, event);
|
||||
sectorContinueMotion(pSector, event);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -5429,7 +5425,7 @@ bool modernTypeOperateSector(int nSector, sectortype* pSector, XSECTOR* pXSector
|
|||
}
|
||||
else if (event.cmd == kCmdSectorMotionPause)
|
||||
{
|
||||
sectorPauseMotion(nSector);
|
||||
sectorPauseMotion(pSector);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -707,9 +707,9 @@ void OperateWall(walltype* pWall, EVENT event) {
|
|||
|
||||
}
|
||||
|
||||
void SectorStartSound(int nSector, int nState)
|
||||
void SectorStartSound(sectortype* pSector, int nState)
|
||||
{
|
||||
BloodSectIterator it(nSector);
|
||||
BloodSectIterator it(pSector);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
spritetype *pSprite = &actor->s();
|
||||
|
@ -730,9 +730,9 @@ void SectorStartSound(int nSector, int nState)
|
|||
}
|
||||
}
|
||||
|
||||
void SectorEndSound(int nSector, int nState)
|
||||
void SectorEndSound(sectortype* pSector, int nState)
|
||||
{
|
||||
BloodSectIterator it(nSector);
|
||||
BloodSectIterator it(pSector);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
spritetype* pSprite = &actor->s();
|
||||
|
@ -1064,7 +1064,7 @@ int VCrushBusy(unsigned int nSector, unsigned int a2)
|
|||
if ((a2&0xffff) == 0)
|
||||
{
|
||||
SetSectorState(nSector, pXSector, FixedToInt(a2));
|
||||
SectorEndSound(nSector, FixedToInt(a2));
|
||||
SectorEndSound(pSector, FixedToInt(a2));
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
|
@ -1115,7 +1115,7 @@ int VSpriteBusy(unsigned int nSector, unsigned int a2)
|
|||
if ((a2&0xffff) == 0)
|
||||
{
|
||||
SetSectorState(nSector, pXSector, FixedToInt(a2));
|
||||
SectorEndSound(nSector, FixedToInt(a2));
|
||||
SectorEndSound(pSector, FixedToInt(a2));
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
|
@ -1212,7 +1212,7 @@ int VDoorBusy(unsigned int nSector, unsigned int a2)
|
|||
if ((a2&0xffff) == 0)
|
||||
{
|
||||
SetSectorState(nSector, pXSector, FixedToInt(a2));
|
||||
SectorEndSound(nSector, FixedToInt(a2));
|
||||
SectorEndSound(pSector, FixedToInt(a2));
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
|
@ -1240,7 +1240,7 @@ int HDoorBusy(unsigned int nSector, unsigned int a2)
|
|||
if ((a2&0xffff) == 0)
|
||||
{
|
||||
SetSectorState(nSector, pXSector, FixedToInt(a2));
|
||||
SectorEndSound(nSector, FixedToInt(a2));
|
||||
SectorEndSound(pSector, FixedToInt(a2));
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
|
@ -1267,7 +1267,7 @@ int RDoorBusy(unsigned int nSector, unsigned int a2)
|
|||
if ((a2&0xffff) == 0)
|
||||
{
|
||||
SetSectorState(nSector, pXSector, FixedToInt(a2));
|
||||
SectorEndSound(nSector, FixedToInt(a2));
|
||||
SectorEndSound(pSector, FixedToInt(a2));
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
|
@ -1300,7 +1300,7 @@ int StepRotateBusy(unsigned int nSector, unsigned int a2)
|
|||
if ((a2&0xffff) == 0)
|
||||
{
|
||||
SetSectorState(nSector, pXSector, FixedToInt(a2));
|
||||
SectorEndSound(nSector, FixedToInt(a2));
|
||||
SectorEndSound(pSector, FixedToInt(a2));
|
||||
pXSector->data = vbp&2047;
|
||||
return 3;
|
||||
}
|
||||
|
@ -1319,7 +1319,7 @@ int GenSectorBusy(unsigned int nSector, unsigned int a2)
|
|||
if ((a2&0xffff) == 0)
|
||||
{
|
||||
SetSectorState(nSector, pXSector, FixedToInt(a2));
|
||||
SectorEndSound(nSector, FixedToInt(a2));
|
||||
SectorEndSound(pSector, FixedToInt(a2));
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
|
@ -1359,16 +1359,17 @@ int PathBusy(unsigned int nSector, unsigned int a2)
|
|||
|
||||
void OperateDoor(unsigned int nSector, XSECTOR *pXSector, EVENT event, BUSYID busyWave)
|
||||
{
|
||||
auto pSector = §or[nSector];
|
||||
switch (event.cmd) {
|
||||
case kCmdOff:
|
||||
if (!pXSector->busy) break;
|
||||
AddBusy(nSector, busyWave, -65536/ClipLow((pXSector->busyTimeB*120)/10, 1));
|
||||
SectorStartSound(nSector, 1);
|
||||
SectorStartSound(pSector, 1);
|
||||
break;
|
||||
case kCmdOn:
|
||||
if (pXSector->busy == 0x10000) break;
|
||||
AddBusy(nSector, busyWave, 65536/ClipLow((pXSector->busyTimeA*120)/10, 1));
|
||||
SectorStartSound(nSector, 0);
|
||||
SectorStartSound(pSector, 0);
|
||||
break;
|
||||
default:
|
||||
if (pXSector->busy & 0xffff) {
|
||||
|
@ -1383,7 +1384,7 @@ void OperateDoor(unsigned int nSector, XSECTOR *pXSector, EVENT event, BUSYID bu
|
|||
else nDelta = -65536/ClipLow((pXSector->busyTimeB*120)/10, 1);
|
||||
|
||||
AddBusy(nSector, busyWave, nDelta);
|
||||
SectorStartSound(nSector, pXSector->state);
|
||||
SectorStartSound(pSector, pXSector->state);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1568,13 +1569,13 @@ void OperateSector(sectortype* pSector, EVENT event)
|
|||
pXSector->state = 0;
|
||||
pXSector->busy = 0;
|
||||
AddBusy(nSector, BUSYID_5, 65536/ClipLow((120*pXSector->busyTimeA)/10, 1));
|
||||
SectorStartSound(nSector, 0);
|
||||
SectorStartSound(pSector, 0);
|
||||
break;
|
||||
case kCmdOff:
|
||||
pXSector->state = 1;
|
||||
pXSector->busy = 65536;
|
||||
AddBusy(nSector, BUSYID_5, -65536/ClipLow((120*pXSector->busyTimeB)/10, 1));
|
||||
SectorStartSound(nSector, 1);
|
||||
SectorStartSound(pSector, 1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -66,7 +66,7 @@ bool SetSpriteState(DBloodActor* actor, int nState);
|
|||
bool SetWallState(walltype* pWall, int nState);
|
||||
bool SetSectorState(int nSector, XSECTOR* pXSector, int nState);
|
||||
void TeleFrag(DBloodActor* killer, int nSector);
|
||||
void SectorStartSound(int nSector, int nState);
|
||||
void SectorEndSound(int nSector, int nState);
|
||||
void SectorStartSound(sectortype* pSector, int nState);
|
||||
void SectorEndSound(sectortype* pSector, int nState);
|
||||
|
||||
END_BLD_NS
|
||||
|
|
Loading…
Reference in a new issue