From f7a32835d54effbd22a1c76c40cc304d9f8a8dd2 Mon Sep 17 00:00:00 2001 From: Monster Iestyn <iestynjealous@ntlworld.com> Date: Thu, 20 Jun 2019 20:05:07 +0100 Subject: [PATCH] Fix warnings/errors found during compiling, mostly of the mixed-declaration-and-code or shadowed variables variety --- src/p_enemy.c | 7 ++++--- src/p_user.c | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 3267965e4a..4123d316c0 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -5189,6 +5189,7 @@ void A_MinusDigging(mobj_t *actor) fixed_t x = FINECOSINE(fa)*dis + actor->x + FRACUNIT*P_RandomRange(-rad, rad); fixed_t y = FINESINE(fa)*dis + actor->y + FRACUNIT*P_RandomRange(-rad, rad); fixed_t mz = (actor->eflags & MFE_VERTICALFLIP) ? actor->ceilingz : actor->floorz; + mobj_t *par; #ifdef HAVE_BLUA if (LUA_CallAction("A_MinusDigging", actor)) @@ -5201,7 +5202,7 @@ void A_MinusDigging(mobj_t *actor) return; } - mobj_t *par = P_SpawnMobj(actor->x, actor->y, mz, MT_MINUSDIRT); + par = P_SpawnMobj(actor->x, actor->y, mz, MT_MINUSDIRT); if (actor->eflags & MFE_VERTICALFLIP) par->eflags |= MFE_VERTICALFLIP; P_TryMove(par, x, y, false); @@ -5214,7 +5215,7 @@ void A_MinusDigging(mobj_t *actor) S_StartSound(actor, actor->info->attacksound); // Spawn growing dirt pile. - mobj_t *par = P_SpawnMobj(actor->x, actor->y, mz, MT_MINUSDIRT); + par = P_SpawnMobj(actor->x, actor->y, mz, MT_MINUSDIRT); P_SetMobjState(par, actor->info->raisestate); P_SetScale(par, actor->scale*2); if (actor->eflags & MFE_VERTICALFLIP) @@ -5313,7 +5314,7 @@ void A_MinusCheck(mobj_t *actor) if (((actor->eflags & MFE_VERTICALFLIP) && actor->z + actor->height >= actor->ceilingz) || (!(actor->eflags & MFE_VERTICALFLIP) && actor->z <= actor->floorz)) { - P_SetMobjState(actor, locvar1 ? locvar1 : actor->info->seestate); + P_SetMobjState(actor, locvar1 ? (statenum_t)locvar1 : actor->info->seestate); actor->flags = actor->info->flags; } } diff --git a/src/p_user.c b/src/p_user.c index 8764fc9fba..997adda6e8 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -9785,9 +9785,9 @@ static sector_t *P_GetMinecartSector(fixed_t x, fixed_t y, fixed_t z, fixed_t *n return sec; } -static size_t P_GetMinecartSpecialLine(sector_t *sec) +static INT32 P_GetMinecartSpecialLine(sector_t *sec) { - size_t line = -1; + INT32 line = -1; if (!sec) return line; @@ -9917,7 +9917,7 @@ static mobj_t *P_LookForRails(mobj_t* mobj, fixed_t c, fixed_t s, angle_t target for (i = 4; i <= 10; i++) { fixed_t nz; - size_t lline; + INT32 lline; x += interval*xcom*i + fwooffset*c*i; y += interval*ycom*i + fwooffset*s*i; @@ -9944,7 +9944,7 @@ static mobj_t *P_LookForRails(mobj_t* mobj, fixed_t c, fixed_t s, angle_t target return NULL; } -static void P_ParabolicMove(mobj_t *mo, fixed_t x, fixed_t y, fixed_t z, fixed_t gravity, fixed_t speed) +static void P_ParabolicMove(mobj_t *mo, fixed_t x, fixed_t y, fixed_t z, fixed_t g, fixed_t speed) { fixed_t dx = x - mo->x; fixed_t dy = y - mo->y; @@ -9952,7 +9952,7 @@ static void P_ParabolicMove(mobj_t *mo, fixed_t x, fixed_t y, fixed_t z, fixed_t fixed_t dh = P_AproxDistance(dx, dy); fixed_t c = FixedDiv(dx, dh); fixed_t s = FixedDiv(dy, dh); - fixed_t fixConst = FixedDiv(speed, gravity); + fixed_t fixConst = FixedDiv(speed, g); mo->momx = FixedMul(c, speed); mo->momy = FixedMul(s, speed); @@ -10013,7 +10013,7 @@ static void P_MinecartThink(player_t *player) if (P_IsObjectOnGround(minecart)) { sector_t *sec; - size_t lnum; + INT32 lnum; fixed_t dummy; // Just hit floor. @@ -10075,9 +10075,9 @@ static void P_MinecartThink(player_t *player) // Sideways detection if (minecart->flags2 & MF2_AMBUSH) { - angle_t fa = (minecart->angle >> ANGLETOFINESHIFT) & FINEMASK; - fixed_t c = FINECOSINE(fa); - fixed_t s = FINESINE(fa); + angle_t fa2 = (minecart->angle >> ANGLETOFINESHIFT) & FINEMASK; + fixed_t c = FINECOSINE(fa2); + fixed_t s = FINESINE(fa2); detleft = P_LookForRails(minecart, c, s, targetangle, -s, c); detright = P_LookForRails(minecart, c, s, targetangle, s, -c); @@ -10130,9 +10130,9 @@ static void P_MinecartThink(player_t *player) if (minecart->standingslope) { - fa = (minecart->angle >> ANGLETOFINESHIFT) & FINEMASK; + fixed_t fa2 = (minecart->angle >> ANGLETOFINESHIFT) & FINEMASK; fixed_t front = P_GetZAt(minecart->standingslope, minecart->x, minecart->y); - fixed_t back = P_GetZAt(minecart->standingslope, minecart->x - FINECOSINE(fa), minecart->y - FINESINE(fa)); + fixed_t back = P_GetZAt(minecart->standingslope, minecart->x - FINECOSINE(fa2), minecart->y - FINESINE(fa2)); if (abs(front - back) < 3*FRACUNIT) currentSpeed += (back - front)/3; -- GitLab