From 932e9b92c3551dc4910157ea8d3eea1145ccfc40 Mon Sep 17 00:00:00 2001 From: haya_underscore Date: Wed, 5 Oct 2022 11:27:31 +0800 Subject: [PATCH] Add a -force parameter to addskins, fix localskin not playing the right sounds on server skins, fix the scoreboard --- src/d_netcmd.c | 34 +++++++++++++++++++++++----------- src/m_menu.c | 2 +- src/p_user.c | 4 ++-- src/y_inter.c | 9 +++++---- 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 4201a448b..2a6877a03 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -49,6 +49,7 @@ #include "m_anigif.h" #include "k_kart.h" // SRB2kart #include "y_inter.h" +#include "fastcmp.h" #ifdef NETGAME_DEVMODE #define CV_RESTRICT CV_NETVAR @@ -4502,21 +4503,32 @@ static boolean DumbStartsWith(const char *pre, const char *str) static void Command_Addskins (void) { - if (COM_Argc() != 2) + if (COM_Argc() > 3) { CONS_Printf( - "addskins : load skins bro\n"); + "addskins : Load a skin file.\n"); return; } - // we dont want anything that aint a skin - if (DumbStartsWith("KC_", COM_Argv(1))) - P_AddWadFile(COM_Argv(1), true); - else if (DumbStartsWith("KCL_", COM_Argv(1)) && demo.playback) // KCL only for demos - P_AddWadFile(COM_Argv(1), true); - else if (DumbStartsWith("KCL_", COM_Argv(1)) && !demo.playback) - CONS_Alert(CONS_ERROR, M_GetText("Cannot add file %s as it is a skin with lua."), COM_Argv(1)); - else - CONS_Alert(CONS_ERROR, M_GetText("Cannot add file %s as it is not a skin."), COM_Argv(1)); + + // no forcing? + if (fasticmp(COM_Argv(2), "-force") || fasticmp(COM_Argv(2), "-f")) { + CONS_Alert(CONS_NOTICE, M_GetText("Adding file %s. May or may not be a skin.\n"), COM_Argv(1)); + P_AddWadFile(COM_Argv(1), 0, true); + } else { + if (DumbStartsWith("KC_", COM_Argv(1))) { + P_AddWadFile(COM_Argv(1), 0, true); + } else if (DumbStartsWith("KCL_", COM_Argv(1))) { + if (!demo.playback) { + CONS_Alert(CONS_ERROR, M_GetText("Cannot add file %s as it is a skin with lua. Include -force or -f to force it to load.\n"), COM_Argv(1)); + return; + } else { + P_AddWadFile(COM_Argv(1), 0, true); + } + } else { + CONS_Alert(CONS_ERROR, M_GetText("Cannot add file %s as it is not a skin.\n"), COM_Argv(1)); + return; + } + } } static void Command_Localskin1 (void) { diff --git a/src/m_menu.c b/src/m_menu.c index 1a9edb636..54f4c508a 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -5484,7 +5484,7 @@ static void M_HandleAddons(INT32 choice) // no characters? if (DumbStartsWith("KC_", dirmenu[dir_on[menudepthleft]]+DIR_STRING)) { M_StartMessage(va("%c%s\x80\nYou are loading a local skin.\nLocal skins will not be usable\nafter going back from\nthe title screen.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),NULL,MM_NOTHING); - COM_BufAddText(va("addskins \"%s%s\"", menupath, dirmenu[dir_on[menudepthleft]]+DIR_STRING)); + COM_BufAddText(va("addskins \"%s%s\" -force", menupath, dirmenu[dir_on[menudepthleft]]+DIR_STRING)); } else S_StartSound(NULL, sfx_s26d); diff --git a/src/p_user.c b/src/p_user.c index 08bfd8b4a..33f6a7313 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1739,13 +1739,13 @@ void P_DoPlayerExit(player_t *player) sfxenum_t sfx_id; // fix godjjsa win sounds if (K_IsPlayerLosing(player)) { - if (player->mo->skinlocal) + if (player->mo->localskin) sfx_id = ((skin_t *)player->mo->localskin)->soundsid[S_sfx[sfx_klose].skinsound]; else sfx_id = ((skin_t *)player->mo->skin)->soundsid[S_sfx[sfx_klose].skinsound]; } else { - if (player->mo->skinlocal) + if (player->mo->localskin) sfx_id = ((skin_t *)player->mo->localskin)->soundsid[S_sfx[sfx_kwin].skinsound]; else sfx_id = ((skin_t *)player->mo->skin)->soundsid[S_sfx[sfx_kwin].skinsound]; diff --git a/src/y_inter.c b/src/y_inter.c index a4feb6c46..9eaf4e1b2 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -475,13 +475,14 @@ void Y_IntermissionDrawer(void) if (data.match.color[i]) { UINT8 *colormap = R_GetTranslationColormap(*data.match.character[i], *data.match.color[i], GTC_CACHE); - if (!players[i].skinlocal) { - if (!players[i].localskin) + // i fucking hate this i fucking hate this i hate this so much + if (!players[data.match.num[i]].skinlocal) { + if (!players[data.match.num[i]].localskin) V_DrawMappedPatch(x+16, y-4, 0, facerankprefix[*data.match.character[i]], colormap); else - V_DrawMappedPatch(x+16, y-4, 0, facerankprefix[players[i].localskin - 1], colormap); + V_DrawMappedPatch(x+16, y-4, 0, facerankprefix[players[data.match.num[i]].localskin - 1], colormap); } else { - V_DrawMappedPatch(x+16, y-4, 0, localfacerankprefix[players[i].localskin - 1], colormap); + V_DrawMappedPatch(x+16, y-4, 0, localfacerankprefix[players[data.match.num[i]].localskin - 1], colormap); } }