Clean up G_MoveFX() a little.

git-svn-id: https://svn.eduke32.com/eduke32@2887 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-08-13 18:25:59 +00:00
parent b93deba4c2
commit e420dc84bd

View file

@ -1216,21 +1216,19 @@ BOLT:
ACTOR_STATIC void G_MoveFX(void) ACTOR_STATIC void G_MoveFX(void)
{ {
int32_t i = headspritestat[STAT_FX], j, nexti; int32_t i = headspritestat[STAT_FX];
spritetype *s;
while (i >= 0) while (i >= 0)
{ {
s = &sprite[i]; spritetype *const s = &sprite[i];
const int32_t nexti = nextspritestat[i];
nexti = nextspritestat[i];
switch (DYNAMICTILEMAP(s->picnum)) switch (DYNAMICTILEMAP(s->picnum))
{ {
case RESPAWN__STATIC: case RESPAWN__STATIC:
if (sprite[i].extra == 66) if (sprite[i].extra == 66)
{ {
j = A_Spawn(i,SHT); /*int32_t j =*/ A_Spawn(i,SHT);
// sprite[j].pal = sprite[i].pal; // sprite[j].pal = sprite[i].pal;
KILLIT(i); KILLIT(i);
} }
@ -1241,6 +1239,7 @@ ACTOR_STATIC void G_MoveFX(void)
case MUSICANDSFX__STATIC: case MUSICANDSFX__STATIC:
{ {
const int32_t ht = s->hitag; const int32_t ht = s->hitag;
DukePlayer_t *const peekps = g_player[screenpeek].ps;
if (T2 != ud.config.SoundToggle) if (T2 != ud.config.SoundToggle)
{ {
@ -1250,7 +1249,7 @@ ACTOR_STATIC void G_MoveFX(void)
if (s->lotag >= 1000 && s->lotag < 2000) if (s->lotag >= 1000 && s->lotag < 2000)
{ {
int32_t x = ldist(&sprite[g_player[screenpeek].ps->i],s); int32_t x = ldist(&sprite[peekps->i],s);
if (g_fakeMultiMode && ud.multimode==2) if (g_fakeMultiMode && ud.multimode==2)
{ {
@ -1271,11 +1270,12 @@ ACTOR_STATIC void G_MoveFX(void)
T1 = 0; T1 = 0;
} }
} }
else if (s->lotag < 999 && (unsigned)sector[s->sectnum].lotag < 9 && ud.config.AmbienceToggle && sector[SECT].floorz != sector[SECT].ceilingz) else if (s->lotag < 999 && (unsigned)sector[s->sectnum].lotag < 9 &&
ud.config.AmbienceToggle && sector[SECT].floorz != sector[SECT].ceilingz)
{ {
if ((g_sounds[s->lotag].m&2)) if (g_sounds[s->lotag].m&2)
{ {
int32_t x = dist(&sprite[g_player[screenpeek].ps->i],s); int32_t x = dist(&sprite[peekps->i],s);
if (g_fakeMultiMode && ud.multimode==2) if (g_fakeMultiMode && ud.multimode==2)
{ {
@ -1288,38 +1288,46 @@ ACTOR_STATIC void G_MoveFX(void)
{ {
if (g_numEnvSoundsPlaying == ud.config.NumVoices) if (g_numEnvSoundsPlaying == ud.config.NumVoices)
{ {
j = headspritestat[STAT_FX]; int32_t j;
while (j >= 0)
{ for (SPRITES_OF(STAT_FX, j))
if (PN == MUSICANDSFX && j != i && sprite[j].lotag < 999 && actor[j].t_data[0] == 1 && dist(&sprite[j],&sprite[g_player[screenpeek].ps->i]) > x) if (PN == MUSICANDSFX && j != i && sprite[j].lotag < 999 &&
actor[j].t_data[0] == 1 &&
dist(&sprite[j], &sprite[peekps->i]) > x)
{ {
S_StopEnvSound(sprite[j].lotag,j); S_StopEnvSound(sprite[j].lotag,j);
break; break;
} }
j = nextspritestat[j];
} if (j == -1)
if (j == -1) goto BOLT; goto BOLT;
} }
A_PlaySound(s->lotag,i); A_PlaySound(s->lotag,i);
T1 = 1; T1 = 1;
} }
if (x >= ht && T1 == 1) else if (x >= ht && T1 == 1)
{ {
// T1 = 0; // T1 = 0;
S_StopEnvSound(s->lotag,i); S_StopEnvSound(s->lotag,i);
} }
} }
if ((g_sounds[s->lotag].m&16)) if ((g_sounds[s->lotag].m&16))
{ {
if (T5 > 0) T5--; // Randomly playing global sounds (flyby of planes, screams, ...)
if (T5 > 0)
{
T5--;
}
else else
{ {
int32_t p; int32_t p;
for (TRAVERSE_CONNECT(p)) for (TRAVERSE_CONNECT(p))
if (p == myconnectindex && g_player[p].ps->cursectnum == s->sectnum) if (p == myconnectindex && g_player[p].ps->cursectnum == s->sectnum)
{ {
j = s->lotag+((unsigned)g_globalRandom%(s->hitag+1)); S_PlaySound(s->lotag + ((unsigned)g_globalRandom%(s->hitag+1)));
S_PlaySound(j);
T5 = GAMETICSPERSEC*40 + (g_globalRandom%(GAMETICSPERSEC*40)); T5 = GAMETICSPERSEC*40 + (g_globalRandom%(GAMETICSPERSEC*40));
} }
} }