From f1648fbf5ce76548e92227088a4c4ffef96f1e05 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 9 Jul 2020 16:39:47 -0700 Subject: [PATCH 1/4] Followers compiler warnings --- src/d_netcmd.c | 42 ++++++++++++++++++++++++------------------ src/dehacked.c | 2 +- src/p_user.c | 8 +++++--- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 2f8bb0c5c..b55441b2d 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -6214,13 +6214,15 @@ static void Follower2_OnChange(void) } - INT32 num = R_FollowerAvailable(str); - char set[10]; - if (num == -1) // that's an error. - CONS_Alert(CONS_WARNING, M_GetText("Follower '%s' not found\n"), str); + { + INT32 num = R_FollowerAvailable(str); + char set[10]; + if (num == -1) // that's an error. + CONS_Alert(CONS_WARNING, M_GetText("Follower '%s' not found\n"), str); - sprintf(set, "%d", num); - CV_StealthSet(&cv_follower2, set); // set it to a number. It's easier for us to send later :) + sprintf(set, "%d", num); + CV_StealthSet(&cv_follower2, set); // set it to a number. It's easier for us to send later :) + } } SendNameAndColor2(); } @@ -6257,13 +6259,15 @@ static void Follower3_OnChange(void) return; } - INT32 num = R_FollowerAvailable(str); - char set[10]; - if (num == -1) // that's an error. - CONS_Alert(CONS_WARNING, M_GetText("Follower '%s' not found\n"), str); + { + INT32 num = R_FollowerAvailable(str); + char set[10]; + if (num == -1) // that's an error. + CONS_Alert(CONS_WARNING, M_GetText("Follower '%s' not found\n"), str); - sprintf(set, "%d", num); - CV_StealthSet(&cv_follower3, set); // set it to a number. It's easier for us to send later :) + sprintf(set, "%d", num); + CV_StealthSet(&cv_follower3, set); // set it to a number. It's easier for us to send later :) + } } SendNameAndColor3(); } @@ -6300,13 +6304,15 @@ static void Follower4_OnChange(void) return; } - INT32 num = R_FollowerAvailable(str); - char set[10]; - if (num == -1) // that's an error. - CONS_Alert(CONS_WARNING, M_GetText("Follower '%s' not found\n"), str); + { + INT32 num = R_FollowerAvailable(str); + char set[10]; + if (num == -1) // that's an error. + CONS_Alert(CONS_WARNING, M_GetText("Follower '%s' not found\n"), str); - sprintf(set, "%d", num); - CV_StealthSet(&cv_follower4, set); // set it to a number. It's easier for us to send later :) + sprintf(set, "%d", num); + CV_StealthSet(&cv_follower4, set); // set it to a number. It's easier for us to send later :) + } } SendNameAndColor4(); } diff --git a/src/dehacked.c b/src/dehacked.c index d8a3f6d01..372863bd5 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -908,7 +908,7 @@ if (followers[numfollowers].field < threshold) \ FALLBACK(bubblescale, "BUBBLESCALE", 0, 0); // No negative scale // Special case for color I suppose - if (followers[numfollowers].defaultcolor < 0 || followers[numfollowers].defaultcolor > MAXSKINCOLORS-1) + if (followers[numfollowers].defaultcolor > MAXSKINCOLORS-1) { followers[numfollowers].defaultcolor = 1; deh_warning("Follower \'%s\': Value for 'color' should be between 1 and %d.\n", dname, MAXSKINCOLORS-1); diff --git a/src/p_user.c b/src/p_user.c index fd5691601..e826d7cd1 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8492,9 +8492,11 @@ static void P_HandleFollower(player_t *player) // finally, add a cool floating effect to the z height. // not stolen from k_kart I swear!! - const fixed_t pi = (22<>ANGLETOFINESHIFT) & FINEMASK); - sz += FixedMul(player->mo->scale, sine)*P_MobjFlip(player->mo); + { + const fixed_t pi = (22<>ANGLETOFINESHIFT) & FINEMASK); + sz += FixedMul(player->mo->scale, sine)*P_MobjFlip(player->mo); + } // Set follower colour From 376f4d3116ac9ee3ff71330ebe9156bfae7cfa56 Mon Sep 17 00:00:00 2001 From: Sryder Date: Fri, 10 Jul 2020 01:32:46 +0100 Subject: [PATCH 2/4] Fix shadowed declaration in pathfind code --- src/k_pathfind.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/k_pathfind.c b/src/k_pathfind.c index ddea477c8..316eab418 100644 --- a/src/k_pathfind.c +++ b/src/k_pathfind.c @@ -484,24 +484,24 @@ boolean K_PathfindAStar(path_t *const path, pathfindsetup_t *const pathfindsetup // Need to update pointers in closedset, openset, and node "camefrom" if nodesarray moved. if (nodesarray != nodesarrayrealloc) { - size_t i = 0U; + size_t j = 0U; size_t arrayindex = 0U; - for (i = 0U; i < closedsetcount; i++) + for (j = 0U; j < closedsetcount; j++) { - arrayindex = closedset[i] - nodesarray; - closedset[i] = &nodesarrayrealloc[arrayindex]; + arrayindex = closedset[j] - nodesarray; + closedset[j] = &nodesarrayrealloc[arrayindex]; } - for (i = 0U; i < openset.count; i++) + for (j = 0U; j < openset.count; j++) { - arrayindex = ((pathfindnode_t *)(openset.array[i].data)) - nodesarray; - openset.array[i].data = &nodesarrayrealloc[arrayindex]; + arrayindex = ((pathfindnode_t *)(openset.array[j].data)) - nodesarray; + openset.array[j].data = &nodesarrayrealloc[arrayindex]; } - for (i = 0U; i < nodesarraycount; i++) + for (j = 0U; j < nodesarraycount; j++) { - if (nodesarrayrealloc[i].camefrom != NULL) + if (nodesarrayrealloc[j].camefrom != NULL) { - arrayindex = nodesarrayrealloc[i].camefrom - nodesarray; - nodesarrayrealloc[i].camefrom = &nodesarrayrealloc[arrayindex]; + arrayindex = nodesarrayrealloc[j].camefrom - nodesarray; + nodesarrayrealloc[j].camefrom = &nodesarrayrealloc[arrayindex]; } } From f348cd0f1fa49592815431abecad26dba64705c9 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 13 Jul 2020 19:55:00 -0700 Subject: [PATCH 3/4] Multiply ring float height by mobjscale --- src/p_mobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 2547f3212..963619c10 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11750,7 +11750,7 @@ void P_RespawnSpecials(void) ss->sector->ceilingheight) - (mthing->options >> ZSHIFT) * FRACUNIT; if (mthing->options & MTF_AMBUSH && (i == MT_RING || i == MT_REDTEAMRING || i == MT_BLUETEAMRING || i == MT_COIN || P_WeaponOrPanel(i))) - z -= 24*FRACUNIT; + z -= 24 * mapobjectscale; z -= mobjinfo[i].height; // Don't forget the height! } else @@ -11762,7 +11762,7 @@ void P_RespawnSpecials(void) ss->sector->floorheight) + (mthing->options >> ZSHIFT) * FRACUNIT; if (mthing->options & MTF_AMBUSH && (i == MT_RING || i == MT_REDTEAMRING || i == MT_BLUETEAMRING || i == MT_COIN || P_WeaponOrPanel(i))) - z += 24*FRACUNIT; + z += 24 * mapobjectscale; } mo = P_SpawnMobj(x, y, z, i); From 716898ebf697772810039fbd8b68d3ca68092298 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 13 Jul 2020 19:58:00 -0700 Subject: [PATCH 4/4] Probably a good idea to flip with mobjscaled height --- src/p_mobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 963619c10..96111cda9 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11751,7 +11751,7 @@ void P_RespawnSpecials(void) if (mthing->options & MTF_AMBUSH && (i == MT_RING || i == MT_REDTEAMRING || i == MT_BLUETEAMRING || i == MT_COIN || P_WeaponOrPanel(i))) z -= 24 * mapobjectscale; - z -= mobjinfo[i].height; // Don't forget the height! + z -= FixedMul(mobjinfo[i].height, mapobjectscale); // Don't forget the height! } else {