Variable scope reductions

git-svn-id: https://svn.eduke32.com/eduke32@7038 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-10-07 05:23:10 +00:00
parent f67f935807
commit 2d25aaee95
2 changed files with 7 additions and 11 deletions

View file

@ -3931,8 +3931,6 @@ static void P_ProcessWeapon(int playerNum)
// this event is deprecated // this event is deprecated
VM_OnEvent(EVENT_FIREWEAPON, pPlayer->i, playerNum); VM_OnEvent(EVENT_FIREWEAPON, pPlayer->i, playerNum);
int spriteNum;
switch (PWEAPON(playerNum, pPlayer->curr_weapon, WorksLike)) switch (PWEAPON(playerNum, pPlayer->curr_weapon, WorksLike))
{ {
case HANDBOMB_WEAPON: case HANDBOMB_WEAPON:
@ -3978,7 +3976,7 @@ static void P_ProcessWeapon(int playerNum)
if (wall[hitData.wall].overpicnum == BIGFORCE) if (wall[hitData.wall].overpicnum == BIGFORCE)
break; break;
spriteNum = headspritesect[hitData.sect]; int spriteNum = headspritesect[hitData.sect];
while (spriteNum >= 0) while (spriteNum >= 0)
{ {
if (sprite[spriteNum].picnum == TRIPBOMB && klabs(sprite[spriteNum].z - hitData.pos.z) < ZOFFSET4 && if (sprite[spriteNum].picnum == TRIPBOMB && klabs(sprite[spriteNum].z - hitData.pos.z) < ZOFFSET4 &&

View file

@ -269,11 +269,10 @@ static void G_PrecacheSprites(void)
static void G_DoLoadScreen(const char *statustext, int32_t percent) static void G_DoLoadScreen(const char *statustext, int32_t percent)
{ {
int32_t i=0,j;
if (ud.recstat != 2) if (ud.recstat != 2)
{ {
j = VM_OnEventWithReturn(EVENT_GETLOADTILE, g_player[screenpeek].ps->i, screenpeek, LOADSCREEN); int32_t i = 0;
int32_t j = VM_OnEventWithReturn(EVENT_GETLOADTILE, g_player[screenpeek].ps->i, screenpeek, LOADSCREEN);
//g_player[myconnectindex].ps->palette = palette; //g_player[myconnectindex].ps->palette = palette;
P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308 P_SetGamePalette(g_player[myconnectindex].ps, BASEPAL, 1); // JBF 20040308
@ -344,7 +343,7 @@ static void G_DoLoadScreen(const char *statustext, int32_t percent)
} }
/*Gv_SetVar(g_iReturnVarID,LOADSCREEN, -1, -1);*/ /*Gv_SetVar(g_iReturnVarID,LOADSCREEN, -1, -1);*/
j = VM_OnEventWithReturn(EVENT_GETLOADTILE, g_player[screenpeek].ps->i, screenpeek, LOADSCREEN); int32_t j = VM_OnEventWithReturn(EVENT_GETLOADTILE, g_player[screenpeek].ps->i, screenpeek, LOADSCREEN);
if ((uint32_t)j < 2*MAXTILES) if ((uint32_t)j < 2*MAXTILES)
{ {
@ -577,9 +576,7 @@ void P_RandomSpawnPoint(int playerNum)
{ {
DukePlayer_t *const pPlayer = g_player[playerNum].ps; DukePlayer_t *const pPlayer = g_player[playerNum].ps;
int32_t i = playerNum; int32_t i = playerNum;
uint32_t dist;
uint32_t pdist = -1;
if ((g_netServer || ud.multimode > 1) && !(g_gametypeFlags[ud.coop] & GAMETYPE_FIXEDRESPAWN)) if ((g_netServer || ud.multimode > 1) && !(g_gametypeFlags[ud.coop] & GAMETYPE_FIXEDRESPAWN))
{ {
@ -587,13 +584,14 @@ void P_RandomSpawnPoint(int playerNum)
if (g_gametypeFlags[ud.coop] & GAMETYPE_TDMSPAWN) if (g_gametypeFlags[ud.coop] & GAMETYPE_TDMSPAWN)
{ {
uint32_t pdist = -1;
for (bssize_t j=0; j<ud.multimode; j++) for (bssize_t j=0; j<ud.multimode; j++)
{ {
if (j != playerNum && g_player[j].ps->team == pPlayer->team && sprite[g_player[j].ps->i].extra > 0) if (j != playerNum && g_player[j].ps->team == pPlayer->team && sprite[g_player[j].ps->i].extra > 0)
{ {
for (bssize_t k=0; k<g_playerSpawnCnt; k++) for (bssize_t k=0; k<g_playerSpawnCnt; k++)
{ {
dist = FindDistance2D(g_player[j].ps->pos.x - g_playerSpawnPoints[k].pos.x, uint32_t dist = FindDistance2D(g_player[j].ps->pos.x - g_playerSpawnPoints[k].pos.x,
g_player[j].ps->pos.y - g_playerSpawnPoints[k].pos.y); g_player[j].ps->pos.y - g_playerSpawnPoints[k].pos.y);
if (dist < pdist) if (dist < pdist)