From d166dffe82d1da6e7b9b1ec9d8e21f143a285b46 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 15 Sep 2019 00:32:01 -0700 Subject: [PATCH 1/8] Let first person camera work in demos (cherry picked from commit 7a70f882b12ecb993370b19bbe4f6e80ae8f323e) --- src/r_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_main.c b/src/r_main.c index df86affbd..fdc78f140 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1149,7 +1149,7 @@ void R_SetupFrame(player_t *player, boolean skybox) aimingangle = player->aiming; viewangle = viewmobj->angle; - if (/*!demo.playback && */player->playerstate != PST_DEAD) + if (!demo.playback && player->playerstate != PST_DEAD) { if (player == &players[consoleplayer]) { From cbcbe9f15bdd8d6daa5f3e80dd0f0ea89a6c4d53 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 6 Jun 2020 22:28:13 -0700 Subject: [PATCH 2/8] Reset DISPLAYPLAYERS if someone leaves --- src/d_clisrv.c | 4 ++-- src/g_game.c | 8 -------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 001a95ea8..3e5544329 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2766,8 +2766,8 @@ void CL_RemovePlayer(INT32 playernum, INT32 reason) RemoveAdminPlayer(playernum); // don't stay admin after you're gone } - if (playernum == g_localplayers[0] && !demo.playback) - g_localplayers[0] = consoleplayer; // don't look through someone's view who isn't there + if (playernum == displayplayers[0] && !demo.playback) + displayplayers[0] = consoleplayer; // don't look through someone's view who isn't there #ifdef HAVE_BLUA LUA_InvalidatePlayer(&players[playernum]); diff --git a/src/g_game.c b/src/g_game.c index ebbf60e3d..6d7597905 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1765,14 +1765,6 @@ void G_DoLoadLevel(boolean resetplayer) if (!resetplayer) P_FindEmerald(); - g_localplayers[0] = consoleplayer; // view the guy you are playing - - for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) - { - if (i > 0 && r_splitscreen < i) - g_localplayers[i] = consoleplayer; - } - gameaction = ga_nothing; #ifdef PARANOIA Z_CheckHeap(-2); From 7af0f92cc92613890334cd38fc00b5678d5ec79f Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 6 Jun 2020 22:28:40 -0700 Subject: [PATCH 3/8] And somehow I replaced an instance of displayplayers on only one side of this conditional... --- src/p_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index ed31c1d11..03482a627 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8217,8 +8217,8 @@ boolean P_SpectatorJoinGame(player_t *player) player->playerstate = PST_REBORN; //Reset away view - if (P_IsLocalPlayer(player) && g_localplayers[0] != consoleplayer) - g_localplayers[0] = consoleplayer; + if (P_IsLocalPlayer(player) && displayplayers[0] != consoleplayer) + displayplayers[0] = consoleplayer; HU_AddChatText(va(M_GetText("\x82*%s entered the game."), player_names[player-players]), false); return true; // no more player->mo, cannot continue. From 5f39dba43264f4da23e504728a01db2f8f9dc9b3 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 7 Jun 2020 19:36:29 -0700 Subject: [PATCH 4/8] Don't add color code to string address --- src/hu_stuff.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 1044dee19..cf217ed1a 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -739,6 +739,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) { const char *prefix = "", *cstart = "", *cend = "", *adminchar = "\x82~\x83", *remotechar = "\x82@\x83", *fmt2, *textcolor = "\x80"; char *tempchar = NULL; + char color_prefix[2]; if (players[playernum].spectator) { @@ -760,7 +761,8 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) } else { - cstart = "\x80" + (K_SkincolorToTextColor(players[playernum].skincolor) >> V_CHARCOLORSHIFT); + sprintf(color_prefix, "%c", '\x80' + (K_SkincolorToTextColor(players[playernum].skincolor) >> V_CHARCOLORSHIFT)); + cstart = color_prefix; } prefix = cstart; From 232cc1a20b5c0be151adcb61838b1425e6ecd037 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Mon, 8 Jun 2020 22:00:24 +0200 Subject: [PATCH 5/8] Fix replay hut crashing when skins were missing --- src/m_menu.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 16cef2eb9..e9da2ad06 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -5487,7 +5487,11 @@ static void DrawReplayHutReplayInfo(void) } // Character face! - if (W_CheckNumForName(skins[demolist[dir_on[menudepthleft]].standings[0].skin].facewant) != LUMPERROR) + + // Lat: 08/06/2020: For some reason missing skins have their value set to 255 (don't even ask me why I didn't write this) + // and for an even STRANGER reason this passes the first check below, so we're going to make sure that the skin here ISN'T 255 before we do anything stupid. + + if (W_CheckNumForName(skins[demolist[dir_on[menudepthleft]].standings[0].skin].facewant) != LUMPERROR && demolist[dir_on[menudepthleft]].standings[0].skin != 0xFF) { patch = facewantprefix[demolist[dir_on[menudepthleft]].standings[0].skin]; colormap = R_GetTranslationColormap( @@ -5685,7 +5689,11 @@ static void M_DrawReplayStartMenu(void) V_DrawString(BASEVIDWIDTH-92, STARTY + i*20 + 9, V_SNAPTOTOP, va("%d", demolist[dir_on[menudepthleft]].standings[i].timeorscore)); // Character face! - if (W_CheckNumForName(skins[demolist[dir_on[menudepthleft]].standings[i].skin].facerank) != LUMPERROR) + + // Lat: 08/06/2020: For some reason missing skins have their value set to 255 (don't even ask me why I didn't write this) + // and for an even STRANGER reason this passes the first check below, so we're going to make sure that the skin here ISN'T 255 before we do anything stupid. + + if (W_CheckNumForName(skins[demolist[dir_on[menudepthleft]].standings[i].skin].facerank) != LUMPERROR && demolist[dir_on[menudepthleft]].standings[0].skin != 0xFF) { patch = facerankprefix[demolist[dir_on[menudepthleft]].standings[i].skin]; colormap = R_GetTranslationColormap( @@ -7632,7 +7640,7 @@ static void M_StartGrandPrix(INT32 choice) grandprixinfo.gamespeed = KARTSPEED_HARD; grandprixinfo.masterbots = true; break; - + } grandprixinfo.encore = (boolean)(cv_dummygpencore.value); From 3914128ce3744d902b6f3d08749664c8f794f1a1 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Mon, 8 Jun 2020 22:11:42 +0200 Subject: [PATCH 6/8] Check for missing skin before the lump --- src/m_menu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index e9da2ad06..9fdd70b12 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -5491,7 +5491,7 @@ static void DrawReplayHutReplayInfo(void) // Lat: 08/06/2020: For some reason missing skins have their value set to 255 (don't even ask me why I didn't write this) // and for an even STRANGER reason this passes the first check below, so we're going to make sure that the skin here ISN'T 255 before we do anything stupid. - if (W_CheckNumForName(skins[demolist[dir_on[menudepthleft]].standings[0].skin].facewant) != LUMPERROR && demolist[dir_on[menudepthleft]].standings[0].skin != 0xFF) + if (demolist[dir_on[menudepthleft]].standings[0].skin != 0xFF && W_CheckNumForName(skins[demolist[dir_on[menudepthleft]].standings[0].skin].facewant) != LUMPERROR) { patch = facewantprefix[demolist[dir_on[menudepthleft]].standings[0].skin]; colormap = R_GetTranslationColormap( @@ -5693,7 +5693,7 @@ static void M_DrawReplayStartMenu(void) // Lat: 08/06/2020: For some reason missing skins have their value set to 255 (don't even ask me why I didn't write this) // and for an even STRANGER reason this passes the first check below, so we're going to make sure that the skin here ISN'T 255 before we do anything stupid. - if (W_CheckNumForName(skins[demolist[dir_on[menudepthleft]].standings[i].skin].facerank) != LUMPERROR && demolist[dir_on[menudepthleft]].standings[0].skin != 0xFF) + if (demolist[dir_on[menudepthleft]].standings[0].skin != 0xFF && W_CheckNumForName(skins[demolist[dir_on[menudepthleft]].standings[i].skin].facerank) != LUMPERROR) { patch = facerankprefix[demolist[dir_on[menudepthleft]].standings[i].skin]; colormap = R_GetTranslationColormap( From b5df372143e2d4c5498a56d125d17ee663112248 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 9 Jun 2020 01:35:50 -0700 Subject: [PATCH 7/8] Don't offset left side of V_DrawStringScaled This line wasn't in the the original functions, I don't know where I got it from. :V --- src/v_video.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/v_video.c b/src/v_video.c index 20931291f..0f6479205 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -1909,7 +1909,6 @@ void V_DrawStringScaled( if (!( flags & V_SNAPTOLEFT )) { left = ( right - BASEVIDWIDTH )/ 2;/* left edge of drawable area */ - x = ( left << FRACBITS )+ x; right -= left; } } From c98b76bf32e5ff7e08d7b79d1215439ef11e7a93 Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Wed, 10 Jun 2020 23:32:26 +0200 Subject: [PATCH 8/8] Fix potentially NULL colormap on nametags upon joining a netgame --- src/k_kart.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 84aa3b4fc..32e238fa8 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -10025,9 +10025,10 @@ static void K_drawKartNameTags(void) { bary += (vid.height - (BASEVIDHEIGHT * vid.dupy)) / 2; } - - V_DrawFill(barx, bary, barw, (3 * vid.dupy), colormap[31]|V_NOSCALESTART); - V_DrawFill(barx, bary + vid.dupy, barw, vid.dupy, colormap[0]|V_NOSCALESTART); + + // Lat: 10/06/2020: colormap can be NULL on the frame you join a game, just arbitrarily use palette indexes 31 and 0 instead of whatever the colormap would give us instead to avoid crashes. + V_DrawFill(barx, bary, barw, (3 * vid.dupy), (colormap ? colormap[31] : 31)|V_NOSCALESTART); + V_DrawFill(barx, bary + vid.dupy, barw, vid.dupy, (colormap ? colormap[0] : 0)|V_NOSCALESTART); // END DRAWFILL DUMBNESS // Draw the stem