Pull the 'for (' ... ')' out of the TRAVERSE_{CONNECT,SPRITE_*} macros.

This plays more nicely with automatic formatters.  Also indent accordingly.

git-svn-id: https://svn.eduke32.com/eduke32@2379 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-02-21 19:33:33 +00:00
parent 0309ba3141
commit 0919c186ba
9 changed files with 285 additions and 285 deletions

View File

@ -428,46 +428,46 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype)
{
int32_t i, nexti;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_TRANSPORT], i, nexti)
if (sprite[i].sectnum == dasectnum)
{
switch (sector[dasectnum].lotag)
for (TRAVERSE_SPRITE_STAT(headspritestat[STAT_TRANSPORT], i, nexti))
if (sprite[i].sectnum == dasectnum)
{
case 1:
if (daz >= actor[spritenum].floorz)
switch (sector[dasectnum].lotag)
{
if (totalclock > actor[spritenum].lasttransport)
case 1:
if (daz >= actor[spritenum].floorz)
{
actor[spritenum].lasttransport = totalclock + (TICSPERFRAME<<2);
if (totalclock > actor[spritenum].lasttransport)
{
actor[spritenum].lasttransport = totalclock + (TICSPERFRAME<<2);
spr->x += (sprite[OW].x-SX);
spr->y += (sprite[OW].y-SY);
spr->z = sector[sprite[OW].sectnum].ceilingz - daz + sector[sprite[i].sectnum].floorz;
spr->x += (sprite[OW].x-SX);
spr->y += (sprite[OW].y-SY);
spr->z = sector[sprite[OW].sectnum].ceilingz - daz + sector[sprite[i].sectnum].floorz;
Bmemcpy(&actor[spritenum].bposx, &sprite[spritenum], sizeof(vec3_t));
changespritesect(spritenum,sprite[OW].sectnum);
Bmemcpy(&actor[spritenum].bposx, &sprite[spritenum], sizeof(vec3_t));
changespritesect(spritenum,sprite[OW].sectnum);
}
return 0;
}
return 0;
}
case 2:
if (daz <= actor[spritenum].ceilingz)
{
if (totalclock > actor[spritenum].lasttransport)
case 2:
if (daz <= actor[spritenum].ceilingz)
{
actor[spritenum].lasttransport = totalclock + (TICSPERFRAME<<2);
spr->x += (sprite[OW].x-SX);
spr->y += (sprite[OW].y-SY);
spr->z = sector[sprite[OW].sectnum].floorz - daz + sector[sprite[i].sectnum].ceilingz;
if (totalclock > actor[spritenum].lasttransport)
{
actor[spritenum].lasttransport = totalclock + (TICSPERFRAME<<2);
spr->x += (sprite[OW].x-SX);
spr->y += (sprite[OW].y-SY);
spr->z = sector[sprite[OW].sectnum].floorz - daz + sector[sprite[i].sectnum].ceilingz;
Bmemcpy(&actor[spritenum].bposx, &sprite[spritenum], sizeof(vec3_t));
changespritesect(spritenum,sprite[OW].sectnum);
Bmemcpy(&actor[spritenum].bposx, &sprite[spritenum], sizeof(vec3_t));
changespritesect(spritenum,sprite[OW].sectnum);
}
return 0;
}
return 0;
}
}
}
}
return(retval);
@ -1300,13 +1300,13 @@ ACTOR_STATIC void G_MoveFX(void)
{
if (T5 > 0) T5--;
else
TRAVERSE_CONNECT(p)
if (p == myconnectindex && g_player[p].ps->cursectnum == s->sectnum)
{
j = s->lotag+((unsigned)g_globalRandom%(s->hitag+1));
S_PlaySound(j);
T5 = GAMETICSPERSEC*40 + (g_globalRandom%(GAMETICSPERSEC*40));
}
for (TRAVERSE_CONNECT(p))
if (p == myconnectindex && g_player[p].ps->cursectnum == s->sectnum)
{
j = s->lotag+((unsigned)g_globalRandom%(s->hitag+1));
S_PlaySound(j);
T5 = GAMETICSPERSEC*40 + (g_globalRandom%(GAMETICSPERSEC*40));
}
}
}
break;
@ -3206,12 +3206,12 @@ ACTOR_STATIC void G_MoveTransports(void)
A_PlaySound(TELEPORTER,i);
}
TRAVERSE_CONNECT(k)
if (g_player[k].ps->cursectnum == sprite[OW].sectnum)
{
g_player[k].ps->frag_ps = p;
sprite[g_player[k].ps->i].extra = 0;
}
for (TRAVERSE_CONNECT(k))
if (g_player[k].ps->cursectnum == sprite[OW].sectnum)
{
g_player[k].ps->frag_ps = p;
sprite[g_player[k].ps->i].extra = 0;
}
g_player[p].ps->ang = sprite[OW].ang;
@ -5564,7 +5564,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
if (l && (sc->floorstat&64))
{
TRAVERSE_CONNECT(p)
for (TRAVERSE_CONNECT(p))
{
if (g_player[p].ps->cursectnum == s->sectnum && g_player[p].ps->on_ground == 1)
{
@ -5770,27 +5770,27 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
if ((sc->floorz-sc->ceilingz) < (108<<8))
{
if (ud.clipping == 0 && s->xvel >= 192)
TRAVERSE_CONNECT(p)
if (sprite[g_player[p].ps->i].extra > 0)
{
k = g_player[p].ps->cursectnum;
updatesector(g_player[p].ps->pos.x,g_player[p].ps->pos.y,&k);
if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && g_player[p].ps->cursectnum != s->sectnum))
for (TRAVERSE_CONNECT(p))
if (sprite[g_player[p].ps->i].extra > 0)
{
g_player[p].ps->pos.x = s->x;
g_player[p].ps->pos.y = s->y;
g_player[p].ps->cursectnum = s->sectnum;
k = g_player[p].ps->cursectnum;
updatesector(g_player[p].ps->pos.x,g_player[p].ps->pos.y,&k);
if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && g_player[p].ps->cursectnum != s->sectnum))
{
g_player[p].ps->pos.x = s->x;
g_player[p].ps->pos.y = s->y;
g_player[p].ps->cursectnum = s->sectnum;
setsprite(g_player[p].ps->i,(vec3_t *)s);
P_QuickKill(g_player[p].ps);
setsprite(g_player[p].ps->i,(vec3_t *)s);
P_QuickKill(g_player[p].ps);
}
}
}
}
m = (s->xvel*sintable[(s->ang+512)&2047])>>14;
x = (s->xvel*sintable[s->ang&2047])>>14;
TRAVERSE_CONNECT(p)
for (TRAVERSE_CONNECT(p))
{
if (g_player[p].ps->cursectnum < 0)
{
@ -5884,21 +5884,21 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
if ((sc->floorz-sc->ceilingz) < (108<<8))
{
if (ud.clipping == 0 && s->xvel >= 192)
TRAVERSE_CONNECT(p)
if (sprite[g_player[p].ps->i].extra > 0)
{
k = g_player[p].ps->cursectnum;
updatesector(g_player[p].ps->pos.x,g_player[p].ps->pos.y,&k);
if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && g_player[p].ps->cursectnum != s->sectnum))
for (TRAVERSE_CONNECT(p))
if (sprite[g_player[p].ps->i].extra > 0)
{
g_player[p].ps->opos.x = g_player[p].ps->pos.x = s->x;
g_player[p].ps->opos.y = g_player[p].ps->pos.y = s->y;
g_player[p].ps->cursectnum = s->sectnum;
k = g_player[p].ps->cursectnum;
updatesector(g_player[p].ps->pos.x,g_player[p].ps->pos.y,&k);
if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && g_player[p].ps->cursectnum != s->sectnum))
{
g_player[p].ps->opos.x = g_player[p].ps->pos.x = s->x;
g_player[p].ps->opos.y = g_player[p].ps->pos.y = s->y;
g_player[p].ps->cursectnum = s->sectnum;
setsprite(g_player[p].ps->i,(vec3_t *)s);
P_QuickKill(g_player[p].ps);
setsprite(g_player[p].ps->i,(vec3_t *)s);
P_QuickKill(g_player[p].ps);
}
}
}
j = headspritesect[sprite[OW].sectnum];
while (j >= 0)
@ -5999,23 +5999,23 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
if ((sc->floorz-sc->ceilingz) < (108<<8))
if (ud.clipping == 0)
TRAVERSE_CONNECT(p)
if (sprite[g_player[p].ps->i].extra > 0)
{
k = g_player[p].ps->cursectnum;
updatesector(g_player[p].ps->pos.x,g_player[p].ps->pos.y,&k);
if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && g_player[p].ps->cursectnum != s->sectnum))
for (TRAVERSE_CONNECT(p))
if (sprite[g_player[p].ps->i].extra > 0)
{
g_player[p].ps->pos.x = s->x;
g_player[p].ps->pos.y = s->y;
g_player[p].ps->cursectnum = s->sectnum;
k = g_player[p].ps->cursectnum;
updatesector(g_player[p].ps->pos.x,g_player[p].ps->pos.y,&k);
if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && g_player[p].ps->cursectnum != s->sectnum))
{
g_player[p].ps->pos.x = s->x;
g_player[p].ps->pos.y = s->y;
g_player[p].ps->cursectnum = s->sectnum;
setsprite(g_player[p].ps->i,(vec3_t *)s);
P_QuickKill(g_player[p].ps);
setsprite(g_player[p].ps->i,(vec3_t *)s);
P_QuickKill(g_player[p].ps);
}
}
}
TRAVERSE_CONNECT(p)
for (TRAVERSE_CONNECT(p))
{
if (sprite[g_player[p].ps->i].sectnum == s->sectnum)
{
@ -6068,25 +6068,25 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
if ((sc->floorz-sc->ceilingz) < (108<<8))
{
if (ud.clipping == 0)
TRAVERSE_CONNECT(p)
if (sprite[g_player[p].ps->i].extra > 0)
{
k = g_player[p].ps->cursectnum;
updatesector(g_player[p].ps->pos.x,g_player[p].ps->pos.y,&k);
if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && g_player[p].ps->cursectnum != s->sectnum))
for (TRAVERSE_CONNECT(p))
if (sprite[g_player[p].ps->i].extra > 0)
{
g_player[p].ps->pos.x = s->x;
g_player[p].ps->pos.y = s->y;
k = g_player[p].ps->cursectnum;
updatesector(g_player[p].ps->pos.x,g_player[p].ps->pos.y,&k);
if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && g_player[p].ps->cursectnum != s->sectnum))
{
g_player[p].ps->pos.x = s->x;
g_player[p].ps->pos.y = s->y;
g_player[p].ps->opos.x = g_player[p].ps->pos.x;
g_player[p].ps->opos.y = g_player[p].ps->pos.y;
g_player[p].ps->opos.x = g_player[p].ps->pos.x;
g_player[p].ps->opos.y = g_player[p].ps->pos.y;
g_player[p].ps->cursectnum = s->sectnum;
g_player[p].ps->cursectnum = s->sectnum;
setsprite(g_player[p].ps->i,(vec3_t *)s);
P_QuickKill(g_player[p].ps);
setsprite(g_player[p].ps->i,(vec3_t *)s);
P_QuickKill(g_player[p].ps);
}
}
}
j = headspritesect[sprite[OW].sectnum];
while (j >= 0)
@ -6153,15 +6153,15 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
x = (s->xvel*sintable[s->ang&2047])>>14;
TRAVERSE_CONNECT(p)
if (g_player[p].ps->cursectnum == s->sectnum && g_player[p].ps->on_ground)
{
g_player[p].ps->pos.x += m;
g_player[p].ps->pos.y += x;
for (TRAVERSE_CONNECT(p))
if (g_player[p].ps->cursectnum == s->sectnum && g_player[p].ps->on_ground)
{
g_player[p].ps->pos.x += m;
g_player[p].ps->pos.y += x;
g_player[p].ps->bobposx += m;
g_player[p].ps->bobposy += x;
}
g_player[p].ps->bobposx += m;
g_player[p].ps->bobposy += x;
}
j = headspritesect[s->sectnum];
while (j >= 0)
@ -6438,10 +6438,10 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
j = 1;
if ((sc->lotag&0xff) != 27)
TRAVERSE_CONNECT(p)
if (sc->lotag != 30 && sc->lotag != 31 && sc->lotag != 0)
if (s->sectnum == sprite[g_player[p].ps->i].sectnum)
j = 0;
for (TRAVERSE_CONNECT(p))
if (sc->lotag != 30 && sc->lotag != 31 && sc->lotag != 0)
if (s->sectnum == sprite[g_player[p].ps->i].sectnum)
j = 0;
if (j == 1)
{
@ -7076,19 +7076,19 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
dragpoint((int16_t)t[1],wall[t[1]].x+x,wall[t[1]].y+l);
dragpoint((int16_t)t[2],wall[t[2]].x+x,wall[t[2]].y+l);
TRAVERSE_CONNECT(p)
if (g_player[p].ps->cursectnum == s->sectnum && g_player[p].ps->on_ground)
{
g_player[p].ps->pos.x += x;
g_player[p].ps->pos.y += l;
for (TRAVERSE_CONNECT(p))
if (g_player[p].ps->cursectnum == s->sectnum && g_player[p].ps->on_ground)
{
g_player[p].ps->pos.x += x;
g_player[p].ps->pos.y += l;
g_player[p].ps->opos.x = g_player[p].ps->pos.x;
g_player[p].ps->opos.y = g_player[p].ps->pos.y;
g_player[p].ps->opos.x = g_player[p].ps->pos.x;
g_player[p].ps->opos.y = g_player[p].ps->pos.y;
g_player[p].ps->pos.z += PHEIGHT;
setsprite(g_player[p].ps->i,(vec3_t *)g_player[p].ps);
g_player[p].ps->pos.z -= PHEIGHT;
}
g_player[p].ps->pos.z += PHEIGHT;
setsprite(g_player[p].ps->i,(vec3_t *)g_player[p].ps);
g_player[p].ps->pos.z -= PHEIGHT;
}
sc->floorxpanning-=x>>3;
sc->floorypanning-=l>>3;
@ -7327,9 +7327,9 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
fricyv += x<<5;
}
TRAVERSE_CONNECT(p)
if (sprite[g_player[p].ps->i].sectnum == s->sectnum && g_player[p].ps->on_ground)
g_player[p].ps->pos.z += s->zvel;
for (TRAVERSE_CONNECT(p))
if (sprite[g_player[p].ps->i].sectnum == s->sectnum && g_player[p].ps->on_ground)
g_player[p].ps->pos.z += s->zvel;
A_MoveSector(i);
setsprite(i,(vec3_t *)s);

View File

@ -246,7 +246,7 @@ void G_DemoRecord(void)
if (demorec_seeds)
g_demo_seedbuf[ud.reccnt] = (uint8_t)(randomseed>>24);
TRAVERSE_CONNECT(i)
for (TRAVERSE_CONNECT(i))
{
Bmemcpy(&recsync[ud.reccnt], g_player[i].sync, sizeof(input_t));
ud.reccnt++;
@ -505,7 +505,7 @@ nextdemo:
if (demo_hasseeds)
outofsync = (uint8_t)(randomseed>>24) != g_demo_seedbuf[bigi];
TRAVERSE_CONNECT(j)
for (TRAVERSE_CONNECT(j))
{
Bmemcpy(&inputfifo[0][j], &recsync[bigi], sizeof(input_t));
bigi++;

View File

@ -1073,15 +1073,15 @@ void G_DrawFrags(void)
{
int32_t i, j = 0;
TRAVERSE_CONNECT(i)
if (i > j) j = i;
for (TRAVERSE_CONNECT(i))
if (i > j) j = i;
rotatesprite_fs(0,0,65600L,0,FRAGBAR,0,0,2+8+16+64);
if (j >= 4) rotatesprite_fs(319,(8)<<16,65600L,0,FRAGBAR,0,0,10+16+64);
if (j >= 8) rotatesprite_fs(319,(16)<<16,65600L,0,FRAGBAR,0,0,10+16+64);
if (j >= 12) rotatesprite_fs(319,(24)<<16,65600L,0,FRAGBAR,0,0,10+16+64);
TRAVERSE_CONNECT(i)
for (TRAVERSE_CONNECT(i))
{
minitext(21+(73*(i&3)),2+((i&28)<<1),&g_player[i].user_name[0],/*sprite[g_player[i].ps->i].pal*/g_player[i].ps->palookup,2+8+16);
Bsprintf(tempbuf,"%d",g_player[i].ps->frag-g_player[i].ps->fraggedself);
@ -1107,17 +1107,17 @@ static void G_DrawStatusBar(int32_t snum)
G_DrawFrags();
else
{
TRAVERSE_CONNECT(i)
if (g_player[i].ps->frag != sbar.frag[i])
{
G_DrawFrags();
break;
}
for (TRAVERSE_CONNECT(i))
if (g_player[i].ps->frag != sbar.frag[i])
{
G_DrawFrags();
break;
}
}
TRAVERSE_CONNECT(i)
if (i != myconnectindex)
sbar.frag[i] = g_player[i].ps->frag;
for (TRAVERSE_CONNECT(i))
if (i != myconnectindex)
sbar.frag[i] = g_player[i].ps->frag;
}
if (ss == 4) //DRAW MINI STATUS BAR:
@ -1762,8 +1762,8 @@ void G_PrintGameQuotes(void)
{
j = 0;
k += 8;
TRAVERSE_CONNECT(i)
if (i > j) j = i;
for (TRAVERSE_CONNECT(i))
if (i > j) j = i;
if (j >= 4 && j <= 8) k += 8;
else if (j > 8 && j <= 12) k += 16;
@ -1827,8 +1827,8 @@ void G_PrintGameQuotes(void)
{
j = 0;
k = 8;
TRAVERSE_CONNECT(i)
if (i > j) j = i;
for (TRAVERSE_CONNECT(i))
if (i > j) j = i;
if (j >= 4 && j <= 8) k += 8;
else if (j > 8 && j <= 12) k += 16;
@ -2413,7 +2413,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16
setaspect_new();
TRAVERSE_CONNECT(p)
for (TRAVERSE_CONNECT(p))
{
if (ud.scrollmode && p == screenpeek) continue;
@ -5178,9 +5178,9 @@ int32_t A_Spawn(int32_t j, int32_t pn)
{
int32_t j, nextj;
TRAVERSE_SPRITE_SECT(headspritesect[sp->sectnum], j, nextj)
if (sprite[j].picnum == ACTIVATOR || sprite[j].picnum == ACTIVATORLOCKED)
actor[i].flags |= SPRITE_USEACTIVATOR;
for (TRAVERSE_SPRITE_SECT(headspritesect[sp->sectnum], j, nextj))
if (sprite[j].picnum == ACTIVATOR || sprite[j].picnum == ACTIVATORLOCKED)
actor[i].flags |= SPRITE_USEACTIVATOR;
}
changespritestat(i, STAT_EFFECTOR);
goto SPAWN_END;
@ -10421,7 +10421,7 @@ MAIN_LOOP_RESTART:
ud.m_respawn_monsters = 1;
else ud.m_respawn_monsters = 0;
TRAVERSE_CONNECT(i)
for (TRAVERSE_CONNECT(i))
{
P_ResetWeapons(i);
P_ResetInventory(i);
@ -10546,7 +10546,7 @@ MAIN_LOOP_RESTART:
/*
if (ud.playerai && (g_netServer || ud.multimode > 1))
{
TRAVERSE_CONNECT(i)
for (TRAVERSE_CONNECT(i))
if (i != myconnectindex)
{
//clearbufbyte(&inputfifo[g_player[i].movefifoend&(MOVEFIFOSIZ-1)][i],sizeof(input_t),0L);
@ -10733,7 +10733,7 @@ int32_t G_DoMoveThings(void)
if (g_netServer || g_netClient)
randomseed = ticrandomseed;
TRAVERSE_CONNECT(i)
for (TRAVERSE_CONNECT(i))
Bmemcpy(g_player[i].sync, &inputfifo[(g_netServer && myconnectindex == i) ? 1 : 0][i],
sizeof(input_t));
@ -10741,7 +10741,7 @@ int32_t G_DoMoveThings(void)
/*
j = -1;
TRAVERSE_CONNECT(i)
for (TRAVERSE_CONNECT(i))
{
if (g_player[i].playerquitflag == 0 || TEST_SYNC_KEY(g_player[i].sync->bits,SK_GAMEQUIT) == 0)
{
@ -10768,7 +10768,7 @@ int32_t G_DoMoveThings(void)
A_MoveDummyPlayers();//ST 13
}
TRAVERSE_CONNECT(i)
for (TRAVERSE_CONNECT(i))
{
if (g_player[i].sync->extbits&(1<<6))
{

View File

@ -29,9 +29,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define GTFLAGS(x) (GametypeFlags[ud.coop] & x)
#define TRAVERSE_SPRITE_SECT(l, o, n) for ((o) = (l); ((o) != -1) && ((n) = nextspritesect[o]); (o) = (n))
#define TRAVERSE_SPRITE_STAT(l, o, n) for ((o) = (l); ((o) != -1) && ((n) = nextspritestat[o]); (o) = (n))
#define TRAVERSE_CONNECT(i) for (i = 0; i != -1; i = connectpoint2[i])
#define TRAVERSE_SPRITE_SECT(l, o, n) (o) = (l); ((o) != -1) && ((n) = nextspritesect[o]); (o) = (n)
#define TRAVERSE_SPRITE_STAT(l, o, n) (o) = (l); ((o) != -1) && ((n) = nextspritestat[o]); (o) = (n)
#define TRAVERSE_CONNECT(i) i = 0; i != -1; i = connectpoint2[i]
#define TEST(flags,mask) ((flags) & (mask))
#define SET(flags,mask) ((flags) |= (mask))

View File

@ -5208,7 +5208,7 @@ VOLUME_ALL_40x:
ud.m_respawn_inventory = 1;
TRAVERSE_CONNECT(c)
for (TRAVERSE_CONNECT(c))
{
P_ResetWeapons(c);
P_ResetInventory(c);

View File

@ -344,7 +344,7 @@ void Net_SyncPlayer(ENetEvent *event)
S_PlaySound(DUKE_GETWEAPON2);
// open a new slot if necessary and save off the resulting slot # for future reference
TRAVERSE_CONNECT(i) if (g_player[i].playerquitflag == 0) break;
for (TRAVERSE_CONNECT(i)) if (g_player[i].playerquitflag == 0) break;
event->peer->data = (void *)((intptr_t)(i = (i == -1 ? playerswhenstarted++ : i)));
g_player[i].netsynctime = totalclock;
@ -353,7 +353,7 @@ void Net_SyncPlayer(ENetEvent *event)
for (j=0; j<playerswhenstarted-1; j++) connectpoint2[j] = j+1;
connectpoint2[playerswhenstarted-1] = -1;
// TRAVERSE_CONNECT(j)
// for (TRAVERSE_CONNECT(j))
// {
if (!g_player[i].ps) g_player[i].ps = (DukePlayer_t *) Bcalloc(1, sizeof(DukePlayer_t));
if (!g_player[i].sync) g_player[i].sync = (input_t *) Bcalloc(1, sizeof(input_t));
@ -1714,7 +1714,7 @@ void Net_ParseServerPacket(ENetEvent *event)
j += sizeof(int32_t);
ud.pause_on = pbuf[j++];
TRAVERSE_CONNECT(i)
for (TRAVERSE_CONNECT(i))
{
g_player[i].ps->dead_flag = *(int16_t *)&pbuf[j];
j += sizeof(int16_t);
@ -1970,7 +1970,7 @@ void Net_ParseServerPacket(ENetEvent *event)
ud.m_ffire = ud.ffire = pbuf[10];
ud.m_noexits = ud.noexits = pbuf[11];
TRAVERSE_CONNECT(i)
for (TRAVERSE_CONNECT(i))
{
P_ResetWeapons(i);
P_ResetInventory(i);
@ -2264,11 +2264,11 @@ void Net_ParseClientPacket(ENetEvent *event)
int32_t zz, i, nexti;
for (zz = 0; (unsigned)zz < (sizeof(g_netStatnums)/sizeof(g_netStatnums[0])); zz++)
TRAVERSE_SPRITE_STAT(headspritestat[g_netStatnums[zz]], i, nexti)
{
if (lastupdate[i] >= g_player[other].netsynctime)
lastupdate[i] = 0;
}
for (TRAVERSE_SPRITE_STAT(headspritestat[g_netStatnums[zz]], i, nexti))
{
if (lastupdate[i] >= g_player[other].netsynctime)
lastupdate[i] = 0;
}
}
for (i=numwalls-1; i>=0; i--)
@ -2318,7 +2318,7 @@ void Net_ParseClientPacket(ENetEvent *event)
ud.m_ffire = ud.ffire = pbuf[10];
ud.m_noexits = ud.noexits = pbuf[11];
TRAVERSE_CONNECT(i)
for (TRAVERSE_CONNECT(i))
{
P_ResetWeapons(i);
P_ResetInventory(i);
@ -2740,7 +2740,7 @@ void Net_UpdateClients(void)
j += sizeof(int32_t);
packbuf[j++] = ud.pause_on;
TRAVERSE_CONNECT(i)
for (TRAVERSE_CONNECT(i))
{
Bmemcpy(&osyn[i], &nsyn[i], offsetof(input_t, filler));
@ -2898,22 +2898,22 @@ void Net_UpdateClients(void)
j += sizeof(int16_t);
for (zz = 0; (unsigned)zz < (sizeof(g_netStatnums)/sizeof(g_netStatnums[0])) && j <= (SYNCPACKETSIZE-(SYNCPACKETSIZE>>3)); zz++)
TRAVERSE_SPRITE_STAT(headspritestat[g_netStatnums[zz]], i, nexti)
{
// only send newly spawned sprites
if (!lastupdate[i] && sprite[i].statnum != MAXSTATUS)
for (TRAVERSE_SPRITE_STAT(headspritestat[g_netStatnums[zz]], i, nexti))
{
int32_t ii;
// only send newly spawned sprites
if (!lastupdate[i] && sprite[i].statnum != MAXSTATUS)
{
int32_t ii;
j += (ii = Net_PackSprite(i, (uint8_t *)&packbuf[j]));
if (ii) k++;
j += (ii = Net_PackSprite(i, (uint8_t *)&packbuf[j]));
if (ii) k++;
lastupdate[i] = totalclock;
lastupdate[i] = totalclock;
if (j >= (SYNCPACKETSIZE-(SYNCPACKETSIZE>>3)))
break;
if (j >= (SYNCPACKETSIZE-(SYNCPACKETSIZE>>3)))
break;
}
}
}
*(int16_t *)&packbuf[zj] = k;
j += sizeof(int16_t);
@ -2952,29 +2952,29 @@ void Net_StreamLevel(void)
j += sizeof(uint16_t);
for (zz = 0; (unsigned)zz < (sizeof(g_netStatnums)/sizeof(g_netStatnums[0])) && j <= (SYNCPACKETSIZE-(SYNCPACKETSIZE>>3)); zz++)
TRAVERSE_SPRITE_STAT(headspritestat[g_netStatnums[zz]], i, nexti)
{
// only send STAT_MISC sprites at spawn time and let the client handle it from there
if (totalclock > (lastupdate[i] + TICRATE) && sprite[i].statnum != STAT_MISC)
for (TRAVERSE_SPRITE_STAT(headspritestat[g_netStatnums[zz]], i, nexti))
{
l = crc32once((uint8_t *)&sprite[i], sizeof(spritetype));
if (!lastupdate[i] || spritecrc[i] != l)
// only send STAT_MISC sprites at spawn time and let the client handle it from there
if (totalclock > (lastupdate[i] + TICRATE) && sprite[i].statnum != STAT_MISC)
{
int32_t ii;
/*initprintf("updating sprite %d (%d)\n",i,sprite[i].picnum);*/
spritecrc[i] = l;
l = crc32once((uint8_t *)&sprite[i], sizeof(spritetype));
j += (ii = Net_PackSprite(i, (uint8_t *)&packbuf[j]));
if (ii) k++;
if (!lastupdate[i] || spritecrc[i] != l)
{
int32_t ii;
/*initprintf("updating sprite %d (%d)\n",i,sprite[i].picnum);*/
spritecrc[i] = l;
lastupdate[i] = totalclock;
j += (ii = Net_PackSprite(i, (uint8_t *)&packbuf[j]));
if (ii) k++;
if (j >= (SYNCPACKETSIZE-(SYNCPACKETSIZE>>3)))
break;
lastupdate[i] = totalclock;
if (j >= (SYNCPACKETSIZE-(SYNCPACKETSIZE>>3)))
break;
}
}
}
}
*(uint16_t *)&packbuf[zj] = k;
k = 0;
@ -3114,7 +3114,7 @@ void Net_EnterMessage(void)
j = 50;
gametext(320>>1,j,"SEND MESSAGE TO...",0,2+8+16);
j += 8;
TRAVERSE_CONNECT(i)
for (TRAVERSE_CONNECT(i))
{
if (i == myconnectindex)
{

View File

@ -3790,19 +3790,19 @@ int32_t P_FindOtherPlayer(int32_t p,int32_t *d)
int32_t j, closest_player = p;
int32_t x, closest = 0x7fffffff;
TRAVERSE_CONNECT(j)
if (p != j && sprite[g_player[j].ps->i].extra > 0)
{
x = klabs(g_player[j].ps->opos.x-g_player[p].ps->pos.x) +
klabs(g_player[j].ps->opos.y-g_player[p].ps->pos.y) +
(klabs(g_player[j].ps->opos.z-g_player[p].ps->pos.z)>>4);
if (x < closest)
for (TRAVERSE_CONNECT(j))
if (p != j && sprite[g_player[j].ps->i].extra > 0)
{
closest_player = j;
closest = x;
x = klabs(g_player[j].ps->opos.x-g_player[p].ps->pos.x) +
klabs(g_player[j].ps->opos.y-g_player[p].ps->pos.y) +
(klabs(g_player[j].ps->opos.z-g_player[p].ps->pos.z)>>4);
if (x < closest)
{
closest_player = j;
closest = x;
}
}
}
*d = closest;
return closest_player;
@ -4459,8 +4459,8 @@ int32_t P_DoFist(DukePlayer_t *p)
{
int32_t i;
TRAVERSE_CONNECT(i)
g_player[i].ps->gm = MODE_EOL;
for (TRAVERSE_CONNECT(i))
g_player[i].ps->gm = MODE_EOL;
if (p->buttonpalette && ud.from_bonus == 0)
{
@ -4670,8 +4670,8 @@ void P_ProcessInput(int32_t snum)
}
else if (p->timebeforeexit == 1)
{
TRAVERSE_CONNECT(i)
g_player[i].ps->gm = MODE_EOL;
for (TRAVERSE_CONNECT(i))
g_player[i].ps->gm = MODE_EOL;
ud.m_level_number = ud.level_number++;
@ -5784,24 +5784,24 @@ void computergetinput(int32_t snum, input_t *syn)
if ((goalplayer[snum] == snum) || (g_player[goalplayer[snum]].ps->dead_flag != 0))
{
j = 0x7fffffff;
TRAVERSE_CONNECT(i)
if (i != snum && !(GTFLAGS(GAMETYPE_TDM) && g_player[snum].ps->team == g_player[i].ps->team))
{
dist = ksqrt((sprite[g_player[i].ps->i].x-x1)*(sprite[g_player[i].ps->i].x-x1)+(sprite[g_player[i].ps->i].y-y1)*(sprite[g_player[i].ps->i].y-y1));
x2 = sprite[g_player[i].ps->i].x;
y2 = sprite[g_player[i].ps->i].y;
z2 = sprite[g_player[i].ps->i].z;
if (!cansee(x1,y1,z1-(48<<8),damysect,x2,y2,z2-(48<<8),sprite[g_player[i].ps->i].sectnum))
dist <<= 1;
if (dist < j)
for (TRAVERSE_CONNECT(i))
if (i != snum && !(GTFLAGS(GAMETYPE_TDM) && g_player[snum].ps->team == g_player[i].ps->team))
{
j = dist;
goalplayer[snum] = i;
}
dist = ksqrt((sprite[g_player[i].ps->i].x-x1)*(sprite[g_player[i].ps->i].x-x1)+(sprite[g_player[i].ps->i].y-y1)*(sprite[g_player[i].ps->i].y-y1));
}
x2 = sprite[g_player[i].ps->i].x;
y2 = sprite[g_player[i].ps->i].y;
z2 = sprite[g_player[i].ps->i].z;
if (!cansee(x1,y1,z1-(48<<8),damysect,x2,y2,z2-(48<<8),sprite[g_player[i].ps->i].sectnum))
dist <<= 1;
if (dist < j)
{
j = dist;
goalplayer[snum] = i;
}
}
}
x2 = sprite[g_player[goalplayer[snum]].ps->i].x;

View File

@ -611,8 +611,8 @@ void G_UpdateScreenArea(void)
if (ud.screen_size > 0 && (GametypeFlags[ud.coop]&GAMETYPE_FRAGBAR) && (g_netServer || ud.multimode > 1))
{
j = 0;
TRAVERSE_CONNECT(i)
if (i > j) j = i;
for (TRAVERSE_CONNECT(i))
if (i > j) j = i;
if (j >= 1) y1 += 8;
if (j >= 4) y1 += 8;
@ -1588,45 +1588,45 @@ static void resetpspritevars(char g)
}
if (ud.recstat != 2)
TRAVERSE_CONNECT(i)
{
aimmode[i] = g_player[i].ps->aim_mode;
autoaim[i] = g_player[i].ps->auto_aim;
weaponswitch[i] = g_player[i].ps->weaponswitch;
if ((g_netServer || ud.multimode > 1) && (GametypeFlags[ud.coop]&GAMETYPE_PRESERVEINVENTORYDEATH) && ud.last_level >= 0)
for (TRAVERSE_CONNECT(i))
{
for (j=0; j<MAX_WEAPONS; j++)
tsbar[i].ammo_amount[j] = g_player[i].ps->ammo_amount[j];
aimmode[i] = g_player[i].ps->aim_mode;
autoaim[i] = g_player[i].ps->auto_aim;
weaponswitch[i] = g_player[i].ps->weaponswitch;
if ((g_netServer || ud.multimode > 1) && (GametypeFlags[ud.coop]&GAMETYPE_PRESERVEINVENTORYDEATH) && ud.last_level >= 0)
{
for (j=0; j<MAX_WEAPONS; j++)
tsbar[i].ammo_amount[j] = g_player[i].ps->ammo_amount[j];
tsbar[i].gotweapon = g_player[i].ps->gotweapon;
Bmemcpy(tsbar[i].inv_amount, g_player[i].ps->inv_amount, sizeof(tsbar[i].inv_amount));
tsbar[i].curr_weapon = g_player[i].ps->curr_weapon;
tsbar[i].inven_icon = g_player[i].ps->inven_icon;
tsbar[i].gotweapon = g_player[i].ps->gotweapon;
Bmemcpy(tsbar[i].inv_amount, g_player[i].ps->inv_amount, sizeof(tsbar[i].inv_amount));
tsbar[i].curr_weapon = g_player[i].ps->curr_weapon;
tsbar[i].inven_icon = g_player[i].ps->inven_icon;
}
}
}
P_ResetStatus(0);
TRAVERSE_CONNECT(i)
if (i) Bmemcpy(g_player[i].ps,g_player[0].ps,sizeof(DukePlayer_t));
for (TRAVERSE_CONNECT(i))
if (i) Bmemcpy(g_player[i].ps,g_player[0].ps,sizeof(DukePlayer_t));
if (ud.recstat != 2)
TRAVERSE_CONNECT(i)
{
g_player[i].ps->aim_mode = aimmode[i];
g_player[i].ps->auto_aim = autoaim[i];
g_player[i].ps->weaponswitch = weaponswitch[i];
if ((g_netServer || ud.multimode > 1) && (GametypeFlags[ud.coop]&GAMETYPE_PRESERVEINVENTORYDEATH) && ud.last_level >= 0)
for (TRAVERSE_CONNECT(i))
{
for (j=0; j<MAX_WEAPONS; j++)
g_player[i].ps->ammo_amount[j] = tsbar[i].ammo_amount[j];
g_player[i].ps->aim_mode = aimmode[i];
g_player[i].ps->auto_aim = autoaim[i];
g_player[i].ps->weaponswitch = weaponswitch[i];
if ((g_netServer || ud.multimode > 1) && (GametypeFlags[ud.coop]&GAMETYPE_PRESERVEINVENTORYDEATH) && ud.last_level >= 0)
{
for (j=0; j<MAX_WEAPONS; j++)
g_player[i].ps->ammo_amount[j] = tsbar[i].ammo_amount[j];
g_player[i].ps->gotweapon = tsbar[i].gotweapon;
g_player[i].ps->curr_weapon = tsbar[i].curr_weapon;
g_player[i].ps->inven_icon = tsbar[i].inven_icon;
Bmemcpy(g_player[i].ps->inv_amount, tsbar[i].inv_amount, sizeof(tsbar[i].inv_amount));
g_player[i].ps->gotweapon = tsbar[i].gotweapon;
g_player[i].ps->curr_weapon = tsbar[i].curr_weapon;
g_player[i].ps->inven_icon = tsbar[i].inven_icon;
Bmemcpy(g_player[i].ps->inv_amount, tsbar[i].inv_amount, sizeof(tsbar[i].inv_amount));
}
}
}
g_numPlayerSprites = 0;
// circ = 2048/ud.multimode;
@ -2051,8 +2051,8 @@ int32_t G_EnterLevel(int32_t g)
if (g & (MODE_GAME|MODE_EOL))
{
TRAVERSE_CONNECT(i)
g_player[i].ps->gm = MODE_GAME;
for (TRAVERSE_CONNECT(i))
g_player[i].ps->gm = MODE_GAME;
}
else if (g & MODE_RESTART)
{
@ -2067,20 +2067,20 @@ int32_t G_EnterLevel(int32_t g)
if (VOLUMEONE && ud.level_number == 0 && ud.recstat != 2)
P_DoQuote(QUOTE_F1HELP,g_player[myconnectindex].ps);
TRAVERSE_CONNECT(i)
switch (DYNAMICTILEMAP(sector[sprite[g_player[i].ps->i].sectnum].floorpicnum))
{
case HURTRAIL__STATIC:
case FLOORSLIME__STATIC:
case FLOORPLASMA__STATIC:
P_ResetWeapons(i);
P_ResetInventory(i);
g_player[i].ps->gotweapon &= ~(1<<PISTOL_WEAPON);
g_player[i].ps->ammo_amount[PISTOL_WEAPON] = 0;
g_player[i].ps->curr_weapon = KNEE_WEAPON;
g_player[i].ps->kickback_pic = 0;
break;
}
for (TRAVERSE_CONNECT(i))
switch (DYNAMICTILEMAP(sector[sprite[g_player[i].ps->i].sectnum].floorpicnum))
{
case HURTRAIL__STATIC:
case FLOORSLIME__STATIC:
case FLOORPLASMA__STATIC:
P_ResetWeapons(i);
P_ResetInventory(i);
g_player[i].ps->gotweapon &= ~(1<<PISTOL_WEAPON);
g_player[i].ps->ammo_amount[PISTOL_WEAPON] = 0;
g_player[i].ps->curr_weapon = KNEE_WEAPON;
g_player[i].ps->kickback_pic = 0;
break;
}
//PREMAP.C - replace near the my's at the end of the file

View File

@ -193,9 +193,9 @@ int32_t isanearoperator(int32_t lotag)
inline int32_t G_CheckPlayerInSector(int32_t sect)
{
int32_t i;
TRAVERSE_CONNECT(i)
if ((unsigned)g_player[i].ps->i < MAXSPRITES && sprite[g_player[i].ps->i].sectnum == sect)
return i;
for (TRAVERSE_CONNECT(i))
if ((unsigned)g_player[i].ps->i < MAXSPRITES && sprite[g_player[i].ps->i].sectnum == sect)
return i;
return -1;
}
@ -239,7 +239,7 @@ int32_t __fastcall A_FindPlayer(spritetype *s, int32_t *d)
int32_t j, closest_player = 0;
int32_t x, closest = 0x7fffffff;
TRAVERSE_CONNECT(j)
for (TRAVERSE_CONNECT(j))
{
x = klabs(g_player[j].ps->opos.x-s->x) + klabs(g_player[j].ps->opos.y-s->y) + ((klabs(g_player[j].ps->opos.z-s->z+(28<<8)))>>4);
if (x < closest && sprite[g_player[j].ps->i].extra > 0)
@ -302,19 +302,19 @@ void G_DoSectorAnimations(void)
if (animateptr[i] == &sector[animatesect[i]].floorz)
{
TRAVERSE_CONNECT(p)
if (g_player[p].ps->cursectnum == dasect)
if ((sector[dasect].floorz-g_player[p].ps->pos.z) < (64<<8))
if (sprite[g_player[p].ps->i].owner >= 0)
{
g_player[p].ps->pos.z += v;
g_player[p].ps->vel.z = 0;
if (p == myconnectindex)
for (TRAVERSE_CONNECT(p))
if (g_player[p].ps->cursectnum == dasect)
if ((sector[dasect].floorz-g_player[p].ps->pos.z) < (64<<8))
if (sprite[g_player[p].ps->i].owner >= 0)
{
my.z += v;
myvel.z = 0;
g_player[p].ps->pos.z += v;
g_player[p].ps->vel.z = 0;
if (p == myconnectindex)
{
my.z += v;
myvel.z = 0;
}
}
}
for (j=headspritesect[dasect]; j>=0; j=nextspritesect[j])
if (sprite[j].statnum != 3)
@ -3078,8 +3078,8 @@ void P_CheckSectors(int32_t snum)
p->secret_rooms++;
return;
case -1:
TRAVERSE_CONNECT(i)
g_player[i].ps->gm = MODE_EOL;
for (TRAVERSE_CONNECT(i))
g_player[i].ps->gm = MODE_EOL;
sector[p->cursectnum].lotag = 0;
if (ud.from_bonus)
{