mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
- iterators in ambient sound code.
This commit is contained in:
parent
3454fc397e
commit
a318129ff3
1 changed files with 14 additions and 16 deletions
|
@ -45,17 +45,15 @@ void ambProcess(void)
|
||||||
{
|
{
|
||||||
if (!SoundEnabled())
|
if (!SoundEnabled())
|
||||||
return;
|
return;
|
||||||
int nSprite;
|
BloodStatIterator it(kStatAmbience);
|
||||||
StatIterator it(kStatAmbience);
|
while (DBloodActor* actor = it.Next())
|
||||||
while ((nSprite = it.NextIndex()) >= 0)
|
|
||||||
{
|
{
|
||||||
spritetype *pSprite = &sprite[nSprite];
|
spritetype *pSprite = &actor->s();
|
||||||
if (pSprite->owner < 0 || pSprite->owner >= kMaxAmbChannel)
|
if (pSprite->owner < 0 || pSprite->owner >= kMaxAmbChannel)
|
||||||
continue;
|
continue;
|
||||||
int nXSprite = pSprite->extra;
|
if (actor->hasX())
|
||||||
if (nXSprite > 0 && nXSprite < kMaxXSprites)
|
|
||||||
{
|
{
|
||||||
XSPRITE *pXSprite = &xsprite[nXSprite];
|
XSPRITE *pXSprite = &actor->x();
|
||||||
if (pXSprite->state)
|
if (pXSprite->state)
|
||||||
{
|
{
|
||||||
int dx = pSprite->x-gMe->pSprite->x;
|
int dx = pSprite->x-gMe->pSprite->x;
|
||||||
|
@ -109,13 +107,13 @@ void ambInit(void)
|
||||||
{
|
{
|
||||||
ambKillAll();
|
ambKillAll();
|
||||||
memset(ambChannels, 0, sizeof(ambChannels));
|
memset(ambChannels, 0, sizeof(ambChannels));
|
||||||
int nSprite;
|
BloodStatIterator it(kStatAmbience);
|
||||||
StatIterator it(kStatAmbience);
|
while (DBloodActor* actor = it.Next())
|
||||||
while ((nSprite = it.NextIndex()) >= 0)
|
|
||||||
{
|
{
|
||||||
if (sprite[nSprite].extra <= 0 || sprite[nSprite].extra >= kMaxXSprites) continue;
|
spritetype* pSprite = &actor->s();
|
||||||
|
if (!actor->hasX()) continue;
|
||||||
|
|
||||||
XSPRITE *pXSprite = &xsprite[sprite[nSprite].extra];
|
XSPRITE* pXSprite = &actor->x();
|
||||||
if (pXSprite->data1 >= pXSprite->data2) continue;
|
if (pXSprite->data1 >= pXSprite->data2) continue;
|
||||||
|
|
||||||
int i; AMB_CHANNEL *pChannel = ambChannels;
|
int i; AMB_CHANNEL *pChannel = ambChannels;
|
||||||
|
@ -125,7 +123,7 @@ void ambInit(void)
|
||||||
if (i == nAmbChannels) {
|
if (i == nAmbChannels) {
|
||||||
|
|
||||||
if (i >= kMaxAmbChannel) {
|
if (i >= kMaxAmbChannel) {
|
||||||
sprite[nSprite].owner = -1;
|
pSprite->owner = -1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,8 +131,8 @@ void ambInit(void)
|
||||||
auto snd = soundEngine->FindSoundByResID(nSFX);
|
auto snd = soundEngine->FindSoundByResID(nSFX);
|
||||||
if (!snd) {
|
if (!snd) {
|
||||||
//I_Error("Missing sound #%d used in ambient sound generator %d\n", nSFX);
|
//I_Error("Missing sound #%d used in ambient sound generator %d\n", nSFX);
|
||||||
viewSetSystemMessage("Missing sound #%d used in ambient sound generator #%d\n", nSFX, nSprite);
|
viewSetSystemMessage("Missing sound #%d used in ambient sound generator #%d\n", nSFX, actor->s().index);
|
||||||
actPostSprite(nSprite, kStatDecoration);
|
actPostSprite(actor, kStatDecoration);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +143,7 @@ void ambInit(void)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sprite[nSprite].owner = i;
|
pSprite->owner = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue