mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
use iterators for moveplayers, movedummyplayers and movefallers_d.
This commit is contained in:
parent
d3a31a3ab7
commit
2358f14cd1
2 changed files with 57 additions and 68 deletions
|
@ -285,9 +285,7 @@ void ms(short i)
|
||||||
|
|
||||||
short startwall, endwall, x;
|
short startwall, endwall, x;
|
||||||
int tx, ty;
|
int tx, ty;
|
||||||
spritetype* s;
|
auto s = &sprite[i];
|
||||||
|
|
||||||
s = &sprite[i];
|
|
||||||
|
|
||||||
s->x += (s->xvel * (sintable[(s->ang + 512) & 2047])) >> 14;
|
s->x += (s->xvel * (sintable[(s->ang + 512) & 2047])) >> 14;
|
||||||
s->y += (s->xvel * (sintable[s->ang & 2047])) >> 14;
|
s->y += (s->xvel * (sintable[s->ang & 2047])) >> 14;
|
||||||
|
@ -361,44 +359,42 @@ void movecyclers(void)
|
||||||
|
|
||||||
void movedummyplayers(void)
|
void movedummyplayers(void)
|
||||||
{
|
{
|
||||||
short i, p, nexti;
|
int i, p;
|
||||||
|
|
||||||
i = headspritestat[STAT_DUMMYPLAYER];
|
StatIterator iti(STAT_DUMMYPLAYER);
|
||||||
while (i >= 0)
|
while ((i = iti.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
nexti = nextspritestat[i];
|
auto spri = &sprite[i];
|
||||||
|
auto hti = &hittype[i];
|
||||||
p = sprite[sprite[i].owner].yvel;
|
p = sprite[spri->owner].yvel;
|
||||||
|
|
||||||
if ((!isRR() && ps[p].on_crane >= 0) || sector[ps[p].cursectnum].lotag != 1 || sprite[ps[p].i].extra <= 0)
|
if ((!isRR() && ps[p].on_crane >= 0) || sector[ps[p].cursectnum].lotag != 1 || sprite[ps[p].i].extra <= 0)
|
||||||
{
|
{
|
||||||
ps[p].dummyplayersprite = -1;
|
ps[p].dummyplayersprite = -1;
|
||||||
deletesprite(i);
|
deletesprite(i);
|
||||||
i = nexti;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ps[p].on_ground && ps[p].on_warping_sector == 1 && sector[ps[p].cursectnum].lotag == 1)
|
if (ps[p].on_ground && ps[p].on_warping_sector == 1 && sector[ps[p].cursectnum].lotag == 1)
|
||||||
{
|
{
|
||||||
sprite[i].cstat = CSTAT_SPRITE_BLOCK_ALL;
|
spri->cstat = CSTAT_SPRITE_BLOCK_ALL;
|
||||||
sprite[i].z = sector[sprite[i].sectnum].ceilingz + (27 << 8);
|
spri->z = sector[spri->sectnum].ceilingz + (27 << 8);
|
||||||
sprite[i].ang = ps[p].angle.ang.asbuild();
|
spri->ang = ps[p].angle.ang.asbuild();
|
||||||
if (hittype[i].temp_data[0] == 8)
|
if (hti->temp_data[0] == 8)
|
||||||
hittype[i].temp_data[0] = 0;
|
hti->temp_data[0] = 0;
|
||||||
else hittype[i].temp_data[0]++;
|
else hti->temp_data[0]++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (sector[sprite[i].sectnum].lotag != 2) sprite[i].z = sector[sprite[i].sectnum].floorz;
|
if (sector[spri->sectnum].lotag != 2) spri->z = sector[spri->sectnum].floorz;
|
||||||
sprite[i].cstat = (short)32768;
|
spri->cstat = (short)32768;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sprite[i].x += (ps[p].posx - ps[p].oposx);
|
spri->x += (ps[p].posx - ps[p].oposx);
|
||||||
sprite[i].y += (ps[p].posy - ps[p].oposy);
|
spri->y += (ps[p].posy - ps[p].oposy);
|
||||||
setsprite(i, sprite[i].x, sprite[i].y, sprite[i].z);
|
setsprite(i, spri->x, spri->y, spri->z);
|
||||||
i = nexti;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,25 +406,22 @@ void movedummyplayers(void)
|
||||||
|
|
||||||
void moveplayers(void) //Players
|
void moveplayers(void) //Players
|
||||||
{
|
{
|
||||||
short i, nexti;
|
int i;
|
||||||
int otherx;
|
int otherx;
|
||||||
spritetype* s;
|
|
||||||
struct player_struct* p;
|
|
||||||
|
|
||||||
i = headspritestat[STAT_PLAYER];
|
StatIterator iti(STAT_PLAYER);
|
||||||
while (i >= 0)
|
while ((i = iti.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
nexti = nextspritestat[i];
|
auto s = &sprite[i];
|
||||||
|
auto ht = &hittype[i];
|
||||||
s = &sprite[i];
|
auto p = &ps[s->yvel];
|
||||||
p = &ps[s->yvel];
|
|
||||||
if (s->owner >= 0)
|
if (s->owner >= 0)
|
||||||
{
|
{
|
||||||
if (p->newowner >= 0) //Looking thru the camera
|
if (p->newowner >= 0) //Looking thru the camera
|
||||||
{
|
{
|
||||||
s->x = p->oposx;
|
s->x = p->oposx;
|
||||||
s->y = p->oposy;
|
s->y = p->oposy;
|
||||||
hittype[i].bposz = s->z = p->oposz + PHEIGHT;
|
ht->bposz = s->z = p->oposz + PHEIGHT;
|
||||||
s->ang = p->angle.oang.asbuild();
|
s->ang = p->angle.oang.asbuild();
|
||||||
setsprite(i, s->x, s->y, s->z);
|
setsprite(i, s->x, s->y, s->z);
|
||||||
}
|
}
|
||||||
|
@ -475,7 +468,7 @@ void moveplayers(void) //Players
|
||||||
{
|
{
|
||||||
// currently alive...
|
// currently alive...
|
||||||
|
|
||||||
hittype[i].owner = i;
|
ht->owner = i;
|
||||||
|
|
||||||
if (ud.god == 0)
|
if (ud.god == 0)
|
||||||
if (fi.ceilingspace(s->sectnum) || fi.floorspace(s->sectnum))
|
if (fi.ceilingspace(s->sectnum) || fi.floorspace(s->sectnum))
|
||||||
|
@ -502,13 +495,12 @@ void moveplayers(void) //Players
|
||||||
if (p->holoduke_on == -1)
|
if (p->holoduke_on == -1)
|
||||||
{
|
{
|
||||||
deletesprite(i);
|
deletesprite(i);
|
||||||
i = nexti;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
hittype[i].bposx = s->x;
|
ht->bposx = s->x;
|
||||||
hittype[i].bposy = s->y;
|
ht->bposy = s->y;
|
||||||
hittype[i].bposz = s->z;
|
ht->bposz = s->z;
|
||||||
|
|
||||||
s->cstat = 0;
|
s->cstat = 0;
|
||||||
|
|
||||||
|
@ -549,8 +541,6 @@ void moveplayers(void) //Players
|
||||||
s->shade += (sector[s->sectnum].ceilingshade - s->shade) >> 1;
|
s->shade += (sector[s->sectnum].ceilingshade - s->shade) >> 1;
|
||||||
else
|
else
|
||||||
s->shade += (sector[s->sectnum].floorshade - s->shade) >> 1;
|
s->shade += (sector[s->sectnum].floorshade - s->shade) >> 1;
|
||||||
|
|
||||||
i = nexti;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -489,7 +489,7 @@ SKIPWALLCHECK:
|
||||||
ht->extra = hp1 + (krand() % (hp2 - hp1));
|
ht->extra = hp1 + (krand() % (hp2 - hp1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sprite[j].picnum != TANK && sprite[j].picnum != ROTATEGUN && sprite[j].picnum != RECON && !bossguy(&sprite[j]))
|
if (sj->picnum != TANK && sj->picnum != ROTATEGUN && sj->picnum != RECON && !bossguy(sj))
|
||||||
{
|
{
|
||||||
if (sj->xvel < 0) sj->xvel = 0;
|
if (sj->xvel < 0) sj->xvel = 0;
|
||||||
sj->xvel += (s->extra << 2);
|
sj->xvel += (s->extra << 2);
|
||||||
|
@ -688,14 +688,15 @@ void guts_d(spritetype* s, short gtype, short n, short p)
|
||||||
int r4 = krand();
|
int r4 = krand();
|
||||||
int r5 = krand();
|
int r5 = krand();
|
||||||
// TRANSITIONAL: owned by a player???
|
// TRANSITIONAL: owned by a player???
|
||||||
i = EGS(s->sectnum, s->x + (r5 & 255) - 128, s->y + (r4 & 255) - 128, gutz - (r3 & 8191), gtype, -32, sx, sy, a, 48 + (r2 & 31), -512 - (r1 & 2047), ps[p].i, 5);
|
i = EGS(s->sectnum, s->x + (r5 & 255) - 128, s->y + (r4 & 255) - 128, gutz - (r3 & 8191), gtype, -32, sx, sy, a, 48 + (r2 & 31), -512 - (r1 & 2047), ps[p].i, 5);
|
||||||
if (sprite[i].picnum == JIBS2)
|
auto si = &sprite[i];
|
||||||
|
if (si->picnum == JIBS2)
|
||||||
{
|
{
|
||||||
sprite[i].xrepeat >>= 2;
|
si->xrepeat >>= 2;
|
||||||
sprite[i].yrepeat >>= 2;
|
si->yrepeat >>= 2;
|
||||||
}
|
}
|
||||||
if (pal != 0)
|
if (pal != 0)
|
||||||
sprite[i].pal = pal;
|
si->pal = pal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -983,55 +984,54 @@ int ifhitbyweapon_d(int sn)
|
||||||
|
|
||||||
void movefallers_d(void)
|
void movefallers_d(void)
|
||||||
{
|
{
|
||||||
short i, nexti, sect, j;
|
short sect;
|
||||||
spritetype* s;
|
int i, j, x;
|
||||||
int x;
|
|
||||||
|
|
||||||
i = headspritestat[STAT_FALLER];
|
StatIterator iti(STAT_FALLER);
|
||||||
while (i >= 0)
|
while ((i = iti.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
nexti = nextspritestat[i];
|
auto s = &sprite[i];
|
||||||
s = &sprite[i];
|
auto ht = &hittype[i];
|
||||||
|
|
||||||
sect = s->sectnum;
|
sect = s->sectnum;
|
||||||
|
|
||||||
if (hittype[i].temp_data[0] == 0)
|
if (ht->temp_data[0] == 0)
|
||||||
{
|
{
|
||||||
s->z -= (16 << 8);
|
s->z -= (16 << 8);
|
||||||
hittype[i].temp_data[1] = s->ang;
|
ht->temp_data[1] = s->ang;
|
||||||
x = s->extra;
|
x = s->extra;
|
||||||
j = fi.ifhitbyweapon(i);
|
j = fi.ifhitbyweapon(i);
|
||||||
if (j >= 0)
|
if (j >= 0)
|
||||||
{
|
{
|
||||||
if (j == FIREEXT || j == RPG || j == RADIUSEXPLOSION || j == SEENINE || j == OOZFILTER)
|
if (j == FIREEXT || j == RPG || j == RADIUSEXPLOSION || j == SEENINE || j == OOZFILTER)
|
||||||
{
|
{
|
||||||
if (s->extra <= 0)
|
if (s->extra <= 0)
|
||||||
{
|
{
|
||||||
hittype[i].temp_data[0] = 1;
|
ht->temp_data[0] = 1;
|
||||||
j = headspritestat[STAT_FALLER];
|
StatIterator itj(STAT_FALLER);
|
||||||
while (j >= 0)
|
while ((j = itj.NextIndex()) >= 0)
|
||||||
{
|
{
|
||||||
if (sprite[j].hitag == sprite[i].hitag)
|
auto sj = &sprite[j];
|
||||||
|
if (sj->hitag == s->hitag)
|
||||||
{
|
{
|
||||||
hittype[j].temp_data[0] = 1;
|
hittype[j].temp_data[0] = 1;
|
||||||
sprite[j].cstat &= (65535 - 64);
|
sj->cstat &= (65535 - 64);
|
||||||
if (sprite[j].picnum == CEILINGSTEAM || sprite[j].picnum == STEAM)
|
if (sj->picnum == CEILINGSTEAM || sj->picnum == STEAM)
|
||||||
sprite[j].cstat |= 32768;
|
sj->cstat |= 32768;
|
||||||
}
|
}
|
||||||
j = nextspritestat[j];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hittype[i].extra = 0;
|
ht->extra = 0;
|
||||||
s->extra = x;
|
s->extra = x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s->ang = hittype[i].temp_data[1];
|
s->ang = ht->temp_data[1];
|
||||||
s->z += (16 << 8);
|
s->z += (16 << 8);
|
||||||
}
|
}
|
||||||
else if (hittype[i].temp_data[0] == 1)
|
else if (ht->temp_data[0] == 1)
|
||||||
{
|
{
|
||||||
if (s->lotag > 0)
|
if (s->lotag > 0)
|
||||||
{
|
{
|
||||||
|
@ -1074,11 +1074,10 @@ void movefallers_d(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i = nexti;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// split out of movestandables
|
// split out of movestandables
|
||||||
|
|
Loading…
Reference in a new issue