Add command to change skin color to prefcolor

This commit is contained in:
indev committed 2026-09-21 20:53:44 +03:00
1 parent a0d6d452a0
commit 110e93f4ed
1 file changed
+53
+53
View File
@@ -147,6 +147,11 @@ static void Command_Addfilelocal(void);
static void Command_Addfile(void);
static void Command_Addskins(void);
static void Command_GLocalSkin(void);
static void SetPrefcolor(int splitplayer);
static void Command_Prefcolor(void);
static void Command_Prefcolor2(void);
static void Command_Prefcolor3(void);
static void Command_Prefcolor4(void);
static void Command_ListWADS_f(void);
static void Command_LocateLump_f(void);
static void Command_ListDoomednums_f(void);
@@ -866,6 +871,11 @@ void D_RegisterClientCommands(void)
COM_AddCommand("localskin", Command_GLocalSkin);
COM_AddCommand("prefcolor", Command_Prefcolor);
COM_AddCommand("prefcolor2", Command_Prefcolor2);
COM_AddCommand("prefcolor3", Command_Prefcolor3);
COM_AddCommand("prefcolor4", Command_Prefcolor4);
K_RegisterClientKartStuff(); // SRB2kart
CV_RegisterVar(&cv_screenshot_option);
@@ -4334,6 +4344,49 @@ static void Command_GLocalSkin(void)
}
}
static void SetPrefcolor(int splitplayer)
{
// splitscreen
if (splitscreen < splitplayer)
return;
const INT32 pnum = P_GetLocalPlayerNumForNum(splitplayer);
player_t *player = &players[pnum];
consvar_t *colorvars[] = {&cv_playercolor, &cv_playercolor2, &cv_playercolor3, &cv_playercolor4};
consvar_t *playercolor = colorvars[splitplayer];
if (skins[player->skin].prefcolor)
{
CV_SetValue(playercolor, skins[player->skin].prefcolor);
CONS_Printf("Set color to %s%s\n", HU_SkinColorToConsoleColor(skins[player->skin].prefcolor), KartColor_Names[skins[player->skin].prefcolor]);
}
else
{
CONS_Printf("\x86Your skin has no prefcolor set\n");
}
}
static void Command_Prefcolor(void)
{
SetPrefcolor(0);
}
static void Command_Prefcolor2(void)
{
SetPrefcolor(1);
}
static void Command_Prefcolor3(void)
{
SetPrefcolor(2);
}
static void Command_Prefcolor4(void)
{
SetPrefcolor(3);
}
static void Got_RequestAddfilecmd(const UINT8 **cp, INT32 playernum)
{
char filename[241];