mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- Iterators and pointers for movefx, moveflammable and detonate
This commit is contained in:
parent
2358f14cd1
commit
5d734eafa0
1 changed files with 49 additions and 46 deletions
|
@ -552,23 +552,22 @@ void moveplayers(void) //Players
|
||||||
|
|
||||||
void movefx(void)
|
void movefx(void)
|
||||||
{
|
{
|
||||||
short i, j, nexti, p;
|
int i, j, p;
|
||||||
int x, ht;
|
int x, ht;
|
||||||
spritetype* s;
|
spritetype* s;
|
||||||
|
|
||||||
i = headspritestat[STAT_FX];
|
StatIterator iti(STAT_FX);
|
||||||
while (i >= 0)
|
while ((i = iti.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
s = &sprite[i];
|
auto s = &sprite[i];
|
||||||
|
auto hti = &hittype[i];
|
||||||
nexti = nextspritestat[i];
|
|
||||||
|
|
||||||
switch (s->picnum)
|
switch (s->picnum)
|
||||||
{
|
{
|
||||||
case RESPAWN:
|
case RESPAWN:
|
||||||
if (sprite[i].extra == 66)
|
if (s->extra == 66)
|
||||||
{
|
{
|
||||||
j = fi.spawn(i, sprite[i].hitag);
|
j = fi.spawn(i, s->hitag);
|
||||||
if (isRRRA())
|
if (isRRRA())
|
||||||
{
|
{
|
||||||
respawn_rrra(i, j);
|
respawn_rrra(i, j);
|
||||||
|
@ -578,49 +577,49 @@ void movefx(void)
|
||||||
deletesprite(i);
|
deletesprite(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (sprite[i].extra > (66 - 13))
|
else if (s->extra > (66 - 13))
|
||||||
sprite[i].extra++;
|
s->extra++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MUSICANDSFX:
|
case MUSICANDSFX:
|
||||||
|
|
||||||
ht = s->hitag;
|
ht = s->hitag;
|
||||||
|
|
||||||
if (hittype[i].temp_data[1] != (int)SoundEnabled())
|
if (hti->temp_data[1] != (int)SoundEnabled())
|
||||||
{
|
{
|
||||||
hittype[i].temp_data[1] = SoundEnabled();
|
hti->temp_data[1] = SoundEnabled();
|
||||||
hittype[i].temp_data[0] = 0;
|
hti->temp_data[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->lotag >= 1000 && s->lotag < 2000)
|
if (s->lotag >= 1000 && s->lotag < 2000)
|
||||||
{
|
{
|
||||||
x = ldist(&sprite[ps[screenpeek].i], s);
|
x = ldist(&sprite[ps[screenpeek].i], s);
|
||||||
if (x < ht && hittype[i].temp_data[0] == 0)
|
if (x < ht && hti->temp_data[0] == 0)
|
||||||
{
|
{
|
||||||
FX_SetReverb(s->lotag - 1000);
|
FX_SetReverb(s->lotag - 1000);
|
||||||
hittype[i].temp_data[0] = 1;
|
hti->temp_data[0] = 1;
|
||||||
}
|
}
|
||||||
if (x >= ht && hittype[i].temp_data[0] == 1)
|
if (x >= ht && hti->temp_data[0] == 1)
|
||||||
{
|
{
|
||||||
FX_SetReverb(0);
|
FX_SetReverb(0);
|
||||||
FX_SetReverbDelay(0);
|
FX_SetReverbDelay(0);
|
||||||
hittype[i].temp_data[0] = 0;
|
hti->temp_data[0] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (s->lotag < 999 && (unsigned)sector[s->sectnum].lotag < ST_9_SLIDING_ST_DOOR && snd_ambience && sector[sprite[i].sectnum].floorz != sector[sprite[i].sectnum].ceilingz)
|
else if (s->lotag < 999 && (unsigned)sector[s->sectnum].lotag < ST_9_SLIDING_ST_DOOR && snd_ambience && sector[s->sectnum].floorz != sector[s->sectnum].ceilingz)
|
||||||
{
|
{
|
||||||
auto flags = S_GetUserFlags(s->lotag);
|
auto flags = S_GetUserFlags(s->lotag);
|
||||||
if (flags & SF_MSFX)
|
if (flags & SF_MSFX)
|
||||||
{
|
{
|
||||||
int x = dist(&sprite[ps[screenpeek].i], s);
|
int x = dist(&sprite[ps[screenpeek].i], s);
|
||||||
|
|
||||||
if (x < ht && hittype[i].temp_data[0] == 0)
|
if (x < ht && hti->temp_data[0] == 0)
|
||||||
{
|
{
|
||||||
// Start playing an ambience sound.
|
// Start playing an ambience sound.
|
||||||
S_PlayActorSound(s->lotag, i, CHAN_AUTO, CHANF_LOOP);
|
S_PlayActorSound(s->lotag, i, CHAN_AUTO, CHANF_LOOP);
|
||||||
hittype[i].temp_data[0] = 1; // AMBIENT_SFX_PLAYING
|
hti->temp_data[0] = 1; // AMBIENT_SFX_PLAYING
|
||||||
}
|
}
|
||||||
else if (x >= ht && hittype[i].temp_data[0] == 1)
|
else if (x >= ht && hti->temp_data[0] == 1)
|
||||||
{
|
{
|
||||||
// Stop playing ambience sound because we're out of its range.
|
// Stop playing ambience sound because we're out of its range.
|
||||||
S_StopSound(s->lotag, i);
|
S_StopSound(s->lotag, i);
|
||||||
|
@ -629,18 +628,17 @@ void movefx(void)
|
||||||
|
|
||||||
if ((flags & (SF_GLOBAL | SF_DTAG)) == SF_GLOBAL)
|
if ((flags & (SF_GLOBAL | SF_DTAG)) == SF_GLOBAL)
|
||||||
{
|
{
|
||||||
if (hittype[i].temp_data[4] > 0) hittype[i].temp_data[4]--;
|
if (hti->temp_data[4] > 0) hti->temp_data[4]--;
|
||||||
else for (p = connecthead; p >= 0; p = connectpoint2[p])
|
else for (p = connecthead; p >= 0; p = connectpoint2[p])
|
||||||
if (p == myconnectindex && ps[p].cursectnum == s->sectnum)
|
if (p == myconnectindex && ps[p].cursectnum == s->sectnum)
|
||||||
{
|
{
|
||||||
S_PlaySound(s->lotag + (unsigned)global_random % (s->hitag + 1));
|
S_PlaySound(s->lotag + (unsigned)global_random % (s->hitag + 1));
|
||||||
hittype[i].temp_data[4] = 26 * 40 + (global_random % (26 * 40));
|
hti->temp_data[4] = 26 * 40 + (global_random % (26 * 40));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i = nexti;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -881,13 +879,14 @@ void movefountain(int i, int fountain)
|
||||||
void moveflammable(int i, int tire, int box, int pool)
|
void moveflammable(int i, int tire, int box, int pool)
|
||||||
{
|
{
|
||||||
auto s = &sprite[i];
|
auto s = &sprite[i];
|
||||||
|
auto ht = &hittype[i];
|
||||||
int j;
|
int j;
|
||||||
if (hittype[i].temp_data[0] == 1)
|
if (ht->temp_data[0] == 1)
|
||||||
{
|
{
|
||||||
hittype[i].temp_data[1]++;
|
ht->temp_data[1]++;
|
||||||
if ((hittype[i].temp_data[1] & 3) > 0) return;
|
if ((ht->temp_data[1] & 3) > 0) return;
|
||||||
|
|
||||||
if (!isRR() && s->picnum == tire && hittype[i].temp_data[1] == 32)
|
if (!isRR() && s->picnum == tire && ht->temp_data[1] == 32)
|
||||||
{
|
{
|
||||||
s->cstat = 0;
|
s->cstat = 0;
|
||||||
j = fi.spawn(i, pool);
|
j = fi.spawn(i, pool);
|
||||||
|
@ -923,10 +922,11 @@ void moveflammable(int i, int tire, int box, int pool)
|
||||||
if (box >= 0 && s->picnum == box)
|
if (box >= 0 && s->picnum == box)
|
||||||
{
|
{
|
||||||
makeitfall(i);
|
makeitfall(i);
|
||||||
hittype[i].ceilingz = sector[s->sectnum].ceilingz;
|
ht->ceilingz = sector[s->sectnum].ceilingz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -936,30 +936,33 @@ void moveflammable(int i, int tire, int box, int pool)
|
||||||
void detonate(int i, int explosion)
|
void detonate(int i, int explosion)
|
||||||
{
|
{
|
||||||
auto s = &sprite[i];
|
auto s = &sprite[i];
|
||||||
|
auto ht = &hittype[i];
|
||||||
auto t = &hittype[i].temp_data[0];
|
auto t = &hittype[i].temp_data[0];
|
||||||
earthquaketime = 16;
|
earthquaketime = 16;
|
||||||
|
|
||||||
int j = headspritestat[STAT_EFFECTOR];
|
int j;
|
||||||
while (j >= 0)
|
StatIterator itj(STAT_EFFECTOR);
|
||||||
|
while ((j = itj.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
if (s->hitag == sprite[j].hitag)
|
auto sj = &sprite[j];
|
||||||
|
auto htj = &hittype[j];
|
||||||
|
if (s->hitag == sj->hitag)
|
||||||
{
|
{
|
||||||
if (sprite[j].lotag == SE_13_EXPLOSIVE)
|
if (sj->lotag == SE_13_EXPLOSIVE)
|
||||||
{
|
{
|
||||||
if (hittype[j].temp_data[2] == 0)
|
if (htj->temp_data[2] == 0)
|
||||||
hittype[j].temp_data[2] = 1;
|
htj->temp_data[2] = 1;
|
||||||
}
|
}
|
||||||
else if (sprite[j].lotag == SE_8_UP_OPEN_DOOR_LIGHTS)
|
else if (sj->lotag == SE_8_UP_OPEN_DOOR_LIGHTS)
|
||||||
hittype[j].temp_data[4] = 1;
|
htj->temp_data[4] = 1;
|
||||||
else if (sprite[j].lotag == SE_18_INCREMENTAL_SECTOR_RISE_FALL)
|
else if (sj->lotag == SE_18_INCREMENTAL_SECTOR_RISE_FALL)
|
||||||
{
|
{
|
||||||
if (hittype[j].temp_data[0] == 0)
|
if (htj->temp_data[0] == 0)
|
||||||
hittype[j].temp_data[0] = 1;
|
htj->temp_data[0] = 1;
|
||||||
}
|
}
|
||||||
else if (sprite[j].lotag == SE_21_DROP_FLOOR)
|
else if (sj->lotag == SE_21_DROP_FLOOR)
|
||||||
hittype[j].temp_data[0] = 1;
|
htj->temp_data[0] = 1;
|
||||||
}
|
}
|
||||||
j = nextspritestat[j];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s->z -= (32 << 8);
|
s->z -= (32 << 8);
|
||||||
|
|
Loading…
Reference in a new issue