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,7 +428,7 @@ 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)
for (TRAVERSE_SPRITE_STAT(headspritestat[STAT_TRANSPORT], i, nexti))
if (sprite[i].sectnum == dasectnum)
{
switch (sector[dasectnum].lotag)
@ -1300,7 +1300,7 @@ ACTOR_STATIC void G_MoveFX(void)
{
if (T5 > 0) T5--;
else
TRAVERSE_CONNECT(p)
for (TRAVERSE_CONNECT(p))
if (p == myconnectindex && g_player[p].ps->cursectnum == s->sectnum)
{
j = s->lotag+((unsigned)g_globalRandom%(s->hitag+1));
@ -3206,7 +3206,7 @@ ACTOR_STATIC void G_MoveTransports(void)
A_PlaySound(TELEPORTER,i);
}
TRAVERSE_CONNECT(k)
for (TRAVERSE_CONNECT(k))
if (g_player[k].ps->cursectnum == sprite[OW].sectnum)
{
g_player[k].ps->frag_ps = p;
@ -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,7 +5770,7 @@ 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)
for (TRAVERSE_CONNECT(p))
if (sprite[g_player[p].ps->i].extra > 0)
{
k = g_player[p].ps->cursectnum;
@ -5790,7 +5790,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
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,7 +5884,7 @@ 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)
for (TRAVERSE_CONNECT(p))
if (sprite[g_player[p].ps->i].extra > 0)
{
k = g_player[p].ps->cursectnum;
@ -5999,7 +5999,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
if ((sc->floorz-sc->ceilingz) < (108<<8))
if (ud.clipping == 0)
TRAVERSE_CONNECT(p)
for (TRAVERSE_CONNECT(p))
if (sprite[g_player[p].ps->i].extra > 0)
{
k = g_player[p].ps->cursectnum;
@ -6015,7 +6015,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
}
}
TRAVERSE_CONNECT(p)
for (TRAVERSE_CONNECT(p))
{
if (sprite[g_player[p].ps->i].sectnum == s->sectnum)
{
@ -6068,7 +6068,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
if ((sc->floorz-sc->ceilingz) < (108<<8))
{
if (ud.clipping == 0)
TRAVERSE_CONNECT(p)
for (TRAVERSE_CONNECT(p))
if (sprite[g_player[p].ps->i].extra > 0)
{
k = g_player[p].ps->cursectnum;
@ -6153,7 +6153,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
x = (s->xvel*sintable[s->ang&2047])>>14;
TRAVERSE_CONNECT(p)
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;
@ -6438,7 +6438,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
j = 1;
if ((sc->lotag&0xff) != 27)
TRAVERSE_CONNECT(p)
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;
@ -7076,7 +7076,7 @@ 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)
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;
@ -7327,7 +7327,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
fricyv += x<<5;
}
TRAVERSE_CONNECT(p)
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;

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,7 +1073,7 @@ void G_DrawFrags(void)
{
int32_t i, j = 0;
TRAVERSE_CONNECT(i)
for (TRAVERSE_CONNECT(i))
if (i > j) j = i;
rotatesprite_fs(0,0,65600L,0,FRAGBAR,0,0,2+8+16+64);
@ -1081,7 +1081,7 @@ void G_DrawFrags(void)
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,7 +1107,7 @@ static void G_DrawStatusBar(int32_t snum)
G_DrawFrags();
else
{
TRAVERSE_CONNECT(i)
for (TRAVERSE_CONNECT(i))
if (g_player[i].ps->frag != sbar.frag[i])
{
G_DrawFrags();
@ -1115,7 +1115,7 @@ static void G_DrawStatusBar(int32_t snum)
}
}
TRAVERSE_CONNECT(i)
for (TRAVERSE_CONNECT(i))
if (i != myconnectindex)
sbar.frag[i] = g_player[i].ps->frag;
}
@ -1762,7 +1762,7 @@ void G_PrintGameQuotes(void)
{
j = 0;
k += 8;
TRAVERSE_CONNECT(i)
for (TRAVERSE_CONNECT(i))
if (i > j) j = i;
if (j >= 4 && j <= 8) k += 8;
@ -1827,7 +1827,7 @@ void G_PrintGameQuotes(void)
{
j = 0;
k = 8;
TRAVERSE_CONNECT(i)
for (TRAVERSE_CONNECT(i))
if (i > j) j = i;
if (j >= 4 && j <= 8) k += 8;
@ -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,7 +5178,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
{
int32_t j, nextj;
TRAVERSE_SPRITE_SECT(headspritesect[sp->sectnum], j, nextj)
for (TRAVERSE_SPRITE_SECT(headspritesect[sp->sectnum], j, nextj))
if (sprite[j].picnum == ACTIVATOR || sprite[j].picnum == ACTIVATORLOCKED)
actor[i].flags |= SPRITE_USEACTIVATOR;
}
@ -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,7 +2264,7 @@ 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)
for (TRAVERSE_SPRITE_STAT(headspritestat[g_netStatnums[zz]], i, nexti))
{
if (lastupdate[i] >= g_player[other].netsynctime)
lastupdate[i] = 0;
@ -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,7 +2898,7 @@ 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)
for (TRAVERSE_SPRITE_STAT(headspritestat[g_netStatnums[zz]], i, nexti))
{
// only send newly spawned sprites
if (!lastupdate[i] && sprite[i].statnum != MAXSTATUS)
@ -2952,7 +2952,7 @@ 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)
for (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)
@ -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,7 +3790,7 @@ int32_t P_FindOtherPlayer(int32_t p,int32_t *d)
int32_t j, closest_player = p;
int32_t x, closest = 0x7fffffff;
TRAVERSE_CONNECT(j)
for (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) +
@ -4459,7 +4459,7 @@ int32_t P_DoFist(DukePlayer_t *p)
{
int32_t i;
TRAVERSE_CONNECT(i)
for (TRAVERSE_CONNECT(i))
g_player[i].ps->gm = MODE_EOL;
if (p->buttonpalette && ud.from_bonus == 0)
@ -4670,7 +4670,7 @@ void P_ProcessInput(int32_t snum)
}
else if (p->timebeforeexit == 1)
{
TRAVERSE_CONNECT(i)
for (TRAVERSE_CONNECT(i))
g_player[i].ps->gm = MODE_EOL;
ud.m_level_number = ud.level_number++;
@ -5784,7 +5784,7 @@ 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)
for (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));

View file

@ -611,7 +611,7 @@ void G_UpdateScreenArea(void)
if (ud.screen_size > 0 && (GametypeFlags[ud.coop]&GAMETYPE_FRAGBAR) && (g_netServer || ud.multimode > 1))
{
j = 0;
TRAVERSE_CONNECT(i)
for (TRAVERSE_CONNECT(i))
if (i > j) j = i;
if (j >= 1) y1 += 8;
@ -1588,7 +1588,7 @@ static void resetpspritevars(char g)
}
if (ud.recstat != 2)
TRAVERSE_CONNECT(i)
for (TRAVERSE_CONNECT(i))
{
aimmode[i] = g_player[i].ps->aim_mode;
autoaim[i] = g_player[i].ps->auto_aim;
@ -1607,11 +1607,11 @@ static void resetpspritevars(char g)
P_ResetStatus(0);
TRAVERSE_CONNECT(i)
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)
for (TRAVERSE_CONNECT(i))
{
g_player[i].ps->aim_mode = aimmode[i];
g_player[i].ps->auto_aim = autoaim[i];
@ -2051,7 +2051,7 @@ int32_t G_EnterLevel(int32_t g)
if (g & (MODE_GAME|MODE_EOL))
{
TRAVERSE_CONNECT(i)
for (TRAVERSE_CONNECT(i))
g_player[i].ps->gm = MODE_GAME;
}
else if (g & MODE_RESTART)
@ -2067,7 +2067,7 @@ 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)
for (TRAVERSE_CONNECT(i))
switch (DYNAMICTILEMAP(sector[sprite[g_player[i].ps->i].sectnum].floorpicnum))
{
case HURTRAIL__STATIC:

View file

@ -193,7 +193,7 @@ int32_t isanearoperator(int32_t lotag)
inline int32_t G_CheckPlayerInSector(int32_t sect)
{
int32_t i;
TRAVERSE_CONNECT(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,7 +302,7 @@ void G_DoSectorAnimations(void)
if (animateptr[i] == &sector[animatesect[i]].floorz)
{
TRAVERSE_CONNECT(p)
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)
@ -3078,7 +3078,7 @@ void P_CheckSectors(int32_t snum)
p->secret_rooms++;
return;
case -1:
TRAVERSE_CONNECT(i)
for (TRAVERSE_CONNECT(i))
g_player[i].ps->gm = MODE_EOL;
sector[p->cursectnum].lotag = 0;
if (ud.from_bonus)