Add a -force parameter to addskins, fix localskin not playing the right sounds

https://git.do.srb2.org/haya_/Kart-Public/-/commit/932e9b92c3551dc4910157ea8d3eea1145ccfc40
This commit is contained in:
alufolie91 committed 2023-08-30 18:43:55 +02:00
1 parent 9dc2ad4f32
commit faeb4d22ed
4 files changed
+30 -18

No files matched your search

+22 -11
View File
@@ -49,6 +49,7 @@
#include "m_anigif.h"
#include "k_kart.h" // SRB2kart
#include "y_inter.h"
#include "fastcmp.h"
#include "m_perfstats.h"
#ifdef NETGAME_DEVMODE
@@ -4649,21 +4650,31 @@ 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 <file>: load skins bro\n");
"addskins <file>: 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) {
+1 -1
View File
@@ -5629,7 +5629,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);
+2 -2
View File
@@ -1741,13 +1741,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];
+5 -4
View File
@@ -482,13 +482,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);
}
}