From 97e261f443946fa63f95b6c7fcdc4eefca35f4f8 Mon Sep 17 00:00:00 2001 From: toaster Date: Fri, 22 May 2020 21:27:55 +0100 Subject: [PATCH 1/3] Fix some issues with the tab rankings and end screen that bots exposed. * Laps now have an initial zero instead of being directly indexed from 1, so start counting from there. * Clean up the circumstances under which LAGLESS! is shown next to a name - specifically removing it from both non-netgames in general, and bots in netgames. * Fix `(powertype == -1)` being broken on the intermission drawer, which was especially obvious with bots outside of netgames. --- src/hu_stuff.c | 2 +- src/k_kart.c | 2 +- src/y_inter.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index a4acabf79..7338a232b 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -3095,7 +3095,7 @@ static void HU_DrawRankings(void) if (G_RaceGametype()) { if (circuitmap) - tab[scorelines].count = players[i].laps+1; + tab[scorelines].count = players[i].laps; else tab[scorelines].count = players[i].realtime; } diff --git a/src/k_kart.c b/src/k_kart.c index de653e9b0..a8ddef8f0 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -9434,7 +9434,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I y2 = y; - if (playerconsole[tab[i].num] == 0 && server_lagless) + if (netgame && playerconsole[tab[i].num] == 0 && server_lagless && !players[tab[i].num].bot) { y2 = ( y - 4 ); diff --git a/src/y_inter.c b/src/y_inter.c index d3ef26fdd..1051a7e55 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -440,7 +440,7 @@ void Y_IntermissionDrawer(void) int y2; if (data.match.rankingsmode) - timeheader = "PWR.LV"; + timeheader = (powertype != -1 ? "PWR.LV" : "RANK"); else timeheader = ((intertype == int_race || (intertype == int_match && battlecapsules)) ? "TIME" : "SCORE"); @@ -497,7 +497,7 @@ void Y_IntermissionDrawer(void) y2 = y; - if (playerconsole[data.match.num[i]] == 0 && server_lagless) + if (netgame && playerconsole[data.match.num[i]] == 0 && server_lagless && !players[data.match.num[i]].bot) { static int alagles_timer = 0; patch_t *alagles; @@ -533,7 +533,7 @@ void Y_IntermissionDrawer(void) if (data.match.rankingsmode) { - if (!clientpowerlevels[data.match.num[i]][powertype]) // No power level (splitscreen guests) + if (powertype != -1 && !clientpowerlevels[data.match.num[i]][powertype]) // No power level (splitscreen guests) STRBUFCPY(strtime, "----"); else { From 84f277c3239d7e6d23aeab62c31c9213b10148ac Mon Sep 17 00:00:00 2001 From: toaster Date: Fri, 22 May 2020 21:34:05 +0100 Subject: [PATCH 2/3] Adjust the finish line detection to exclude a handful of circumstances I've tripped before. --- src/p_spec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_spec.c b/src/p_spec.c index 0c75051ad..82dad34a6 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2209,7 +2209,8 @@ static void K_HandleLapDecrement(player_t *player) void P_CrossSpecialLine(line_t *line, INT32 side, mobj_t *thing) { // only used for the players currently - if (thing && thing->player) + if (!(thing && thing->player && !thing->player->spectator && !(thing->player->pflags & PF_TIMEOVER))) + return; { player_t *player = thing->player; switch (line->special) From 56226fae458d1ea38be79e5d1fd8a23e609643cd Mon Sep 17 00:00:00 2001 From: toaster Date: Fri, 22 May 2020 21:51:05 +0100 Subject: [PATCH 3/3] Only iterate blockmap once for Random Items and Eggboxes. --- src/k_bot.c | 45 ++++++++------------------------------------- 1 file changed, 8 insertions(+), 37 deletions(-) diff --git a/src/k_bot.c b/src/k_bot.c index 285207caa..fd75adca5 100644 --- a/src/k_bot.c +++ b/src/k_bot.c @@ -554,11 +554,12 @@ fixed_t eggboxx, eggboxy; UINT8 randomitems = 0; UINT8 eggboxes = 0; -static boolean K_FindRandomItems(mobj_t *thing) +static boolean K_FindRandomItemsAndEggboxes(mobj_t *thing) { fixed_t dist; + boolean egg = (thing->type == MT_EGGMANITEM); - if (thing->type != MT_RANDOMITEM) + if (!egg && thing->type != MT_RANDOMITEM) { return true; } @@ -575,32 +576,10 @@ static boolean K_FindRandomItems(mobj_t *thing) return true; } - randomitems++; - return true; -} - -static boolean K_FindEggboxes(mobj_t *thing) -{ - fixed_t dist; - - if (thing->type != MT_EGGMANITEM) - { - return true; - } - - if (!thing->health) - { - return true; - } - - dist = P_AproxDistance(thing->x - eggboxx, thing->y - eggboxy); - - if (dist > distancetocheck) - { - return true; - } - - eggboxes++; + if (egg) + eggboxes++; + else + randomitems++; return true; } @@ -625,15 +604,7 @@ static UINT8 K_EggboxStealth(fixed_t x, fixed_t y) { for (by = yl; by <= yh; by++) { - P_BlockThingsIterator(bx, by, K_FindRandomItems); - } - } - - for (bx = xl; bx <= xh; bx++) - { - for (by = yl; by <= yh; by++) - { - P_BlockThingsIterator(bx, by, K_FindEggboxes); + P_BlockThingsIterator(bx, by, K_FindRandomItemsAndEggboxes); } }