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;
|
||||
int tx, ty;
|
||||
spritetype* s;
|
||||
|
||||
s = &sprite[i];
|
||||
auto s = &sprite[i];
|
||||
|
||||
s->x += (s->xvel * (sintable[(s->ang + 512) & 2047])) >> 14;
|
||||
s->y += (s->xvel * (sintable[s->ang & 2047])) >> 14;
|
||||
|
@ -361,44 +359,42 @@ void movecyclers(void)
|
|||
|
||||
void movedummyplayers(void)
|
||||
{
|
||||
short i, p, nexti;
|
||||
int i, p;
|
||||
|
||||
i = headspritestat[STAT_DUMMYPLAYER];
|
||||
while (i >= 0)
|
||||
StatIterator iti(STAT_DUMMYPLAYER);
|
||||
while ((i = iti.NextIndex()) >= 0)
|
||||
{
|
||||
nexti = nextspritestat[i];
|
||||
|
||||
p = sprite[sprite[i].owner].yvel;
|
||||
auto spri = &sprite[i];
|
||||
auto hti = &hittype[i];
|
||||
p = sprite[spri->owner].yvel;
|
||||
|
||||
if ((!isRR() && ps[p].on_crane >= 0) || sector[ps[p].cursectnum].lotag != 1 || sprite[ps[p].i].extra <= 0)
|
||||
{
|
||||
ps[p].dummyplayersprite = -1;
|
||||
deletesprite(i);
|
||||
i = nexti;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ps[p].on_ground && ps[p].on_warping_sector == 1 && sector[ps[p].cursectnum].lotag == 1)
|
||||
{
|
||||
sprite[i].cstat = CSTAT_SPRITE_BLOCK_ALL;
|
||||
sprite[i].z = sector[sprite[i].sectnum].ceilingz + (27 << 8);
|
||||
sprite[i].ang = ps[p].angle.ang.asbuild();
|
||||
if (hittype[i].temp_data[0] == 8)
|
||||
hittype[i].temp_data[0] = 0;
|
||||
else hittype[i].temp_data[0]++;
|
||||
spri->cstat = CSTAT_SPRITE_BLOCK_ALL;
|
||||
spri->z = sector[spri->sectnum].ceilingz + (27 << 8);
|
||||
spri->ang = ps[p].angle.ang.asbuild();
|
||||
if (hti->temp_data[0] == 8)
|
||||
hti->temp_data[0] = 0;
|
||||
else hti->temp_data[0]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sector[sprite[i].sectnum].lotag != 2) sprite[i].z = sector[sprite[i].sectnum].floorz;
|
||||
sprite[i].cstat = (short)32768;
|
||||
if (sector[spri->sectnum].lotag != 2) spri->z = sector[spri->sectnum].floorz;
|
||||
spri->cstat = (short)32768;
|
||||
}
|
||||
}
|
||||
|
||||
sprite[i].x += (ps[p].posx - ps[p].oposx);
|
||||
sprite[i].y += (ps[p].posy - ps[p].oposy);
|
||||
setsprite(i, sprite[i].x, sprite[i].y, sprite[i].z);
|
||||
i = nexti;
|
||||
spri->x += (ps[p].posx - ps[p].oposx);
|
||||
spri->y += (ps[p].posy - ps[p].oposy);
|
||||
setsprite(i, spri->x, spri->y, spri->z);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -410,25 +406,22 @@ void movedummyplayers(void)
|
|||
|
||||
void moveplayers(void) //Players
|
||||
{
|
||||
short i, nexti;
|
||||
int i;
|
||||
int otherx;
|
||||
spritetype* s;
|
||||
struct player_struct* p;
|
||||
|
||||
i = headspritestat[STAT_PLAYER];
|
||||
while (i >= 0)
|
||||
StatIterator iti(STAT_PLAYER);
|
||||
while ((i = iti.NextIndex()) >= 0)
|
||||
{
|
||||
nexti = nextspritestat[i];
|
||||
|
||||
s = &sprite[i];
|
||||
p = &ps[s->yvel];
|
||||
auto s = &sprite[i];
|
||||
auto ht = &hittype[i];
|
||||
auto p = &ps[s->yvel];
|
||||
if (s->owner >= 0)
|
||||
{
|
||||
if (p->newowner >= 0) //Looking thru the camera
|
||||
{
|
||||
s->x = p->oposx;
|
||||
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();
|
||||
setsprite(i, s->x, s->y, s->z);
|
||||
}
|
||||
|
@ -475,7 +468,7 @@ void moveplayers(void) //Players
|
|||
{
|
||||
// currently alive...
|
||||
|
||||
hittype[i].owner = i;
|
||||
ht->owner = i;
|
||||
|
||||
if (ud.god == 0)
|
||||
if (fi.ceilingspace(s->sectnum) || fi.floorspace(s->sectnum))
|
||||
|
@ -502,13 +495,12 @@ void moveplayers(void) //Players
|
|||
if (p->holoduke_on == -1)
|
||||
{
|
||||
deletesprite(i);
|
||||
i = nexti;
|
||||
continue;
|
||||
}
|
||||
|
||||
hittype[i].bposx = s->x;
|
||||
hittype[i].bposy = s->y;
|
||||
hittype[i].bposz = s->z;
|
||||
ht->bposx = s->x;
|
||||
ht->bposy = s->y;
|
||||
ht->bposz = s->z;
|
||||
|
||||
s->cstat = 0;
|
||||
|
||||
|
@ -549,8 +541,6 @@ void moveplayers(void) //Players
|
|||
s->shade += (sector[s->sectnum].ceilingshade - s->shade) >> 1;
|
||||
else
|
||||
s->shade += (sector[s->sectnum].floorshade - s->shade) >> 1;
|
||||
|
||||
i = nexti;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -489,7 +489,7 @@ SKIPWALLCHECK:
|
|||
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;
|
||||
sj->xvel += (s->extra << 2);
|
||||
|
@ -689,13 +689,14 @@ void guts_d(spritetype* s, short gtype, short n, short p)
|
|||
int r5 = krand();
|
||||
// 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);
|
||||
if (sprite[i].picnum == JIBS2)
|
||||
auto si = &sprite[i];
|
||||
if (si->picnum == JIBS2)
|
||||
{
|
||||
sprite[i].xrepeat >>= 2;
|
||||
sprite[i].yrepeat >>= 2;
|
||||
si->xrepeat >>= 2;
|
||||
si->yrepeat >>= 2;
|
||||
}
|
||||
if (pal != 0)
|
||||
sprite[i].pal = pal;
|
||||
si->pal = pal;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -983,22 +984,21 @@ int ifhitbyweapon_d(int sn)
|
|||
|
||||
void movefallers_d(void)
|
||||
{
|
||||
short i, nexti, sect, j;
|
||||
spritetype* s;
|
||||
int x;
|
||||
short sect;
|
||||
int i, j, x;
|
||||
|
||||
i = headspritestat[STAT_FALLER];
|
||||
while (i >= 0)
|
||||
StatIterator iti(STAT_FALLER);
|
||||
while ((i = iti.NextIndex()) >= 0)
|
||||
{
|
||||
nexti = nextspritestat[i];
|
||||
s = &sprite[i];
|
||||
auto s = &sprite[i];
|
||||
auto ht = &hittype[i];
|
||||
|
||||
sect = s->sectnum;
|
||||
|
||||
if (hittype[i].temp_data[0] == 0)
|
||||
if (ht->temp_data[0] == 0)
|
||||
{
|
||||
s->z -= (16 << 8);
|
||||
hittype[i].temp_data[1] = s->ang;
|
||||
ht->temp_data[1] = s->ang;
|
||||
x = s->extra;
|
||||
j = fi.ifhitbyweapon(i);
|
||||
if (j >= 0)
|
||||
|
@ -1007,31 +1007,31 @@ void movefallers_d(void)
|
|||
{
|
||||
if (s->extra <= 0)
|
||||
{
|
||||
hittype[i].temp_data[0] = 1;
|
||||
j = headspritestat[STAT_FALLER];
|
||||
while (j >= 0)
|
||||
ht->temp_data[0] = 1;
|
||||
StatIterator itj(STAT_FALLER);
|
||||
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;
|
||||
sprite[j].cstat &= (65535 - 64);
|
||||
if (sprite[j].picnum == CEILINGSTEAM || sprite[j].picnum == STEAM)
|
||||
sprite[j].cstat |= 32768;
|
||||
sj->cstat &= (65535 - 64);
|
||||
if (sj->picnum == CEILINGSTEAM || sj->picnum == STEAM)
|
||||
sj->cstat |= 32768;
|
||||
}
|
||||
j = nextspritestat[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hittype[i].extra = 0;
|
||||
ht->extra = 0;
|
||||
s->extra = x;
|
||||
}
|
||||
}
|
||||
s->ang = hittype[i].temp_data[1];
|
||||
s->ang = ht->temp_data[1];
|
||||
s->z += (16 << 8);
|
||||
}
|
||||
else if (hittype[i].temp_data[0] == 1)
|
||||
else if (ht->temp_data[0] == 1)
|
||||
{
|
||||
if (s->lotag > 0)
|
||||
{
|
||||
|
@ -1074,10 +1074,9 @@ void movefallers_d(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
i = nexti;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue