Fixed forceskin to not always allow due to bad logic.

This commit is contained in:
toasterbabe 2016-07-14 13:24:57 +01:00
parent 674ec3e515
commit c5f6ae8aaa
5 changed files with 9 additions and 22 deletions

View File

@ -1161,7 +1161,11 @@ found:
else
{
if (var == &cv_forceskin)
{
var->value = R_SkinAvailable(var->string);
if (!R_SkinUnlock(var->value))
var->value = -1;
}
else
var->value = atoi(var->string);
}

View File

@ -4002,17 +4002,10 @@ static void Command_Archivetest_f(void)
*/
static void ForceSkin_OnChange(void)
{
if ((server || adminplayer == consoleplayer) && (cv_forceskin.value < -1 || cv_forceskin.value >= numskins || !(dedicated || R_SkinUnlock(cv_forceskin.value)))) // Dedicated servers have everything when it comes to forceskin because they have no gamedata.
if ((server || adminplayer == consoleplayer) && ((cv_forceskin.value == -1 && stricmp(cv_forceskin.string, "None")) || !(R_SkinUnlock(cv_forceskin.value))))
{
if (cv_forceskin.value == -2)
CV_SetValue(&cv_forceskin, numskins-1);
else
{
// hack because I can't restrict this and still allow added skins to be used with forceskin.
if (!menuactive)
CONS_Printf(M_GetText("Valid skin numbers are 0 to %d (-1 disables)\n"), numskins - 1);
CV_SetValue(&cv_forceskin, -1);
}
CONS_Printf("Please provide a valid skin name (\"None\" disables).\n");
CV_SetValue(&cv_forceskin, -1);
return;
}
@ -4024,7 +4017,7 @@ static void ForceSkin_OnChange(void)
CONS_Printf("The server has lifted the forced skin restrictions.\n");
else
{
CONS_Printf("The server is restricting all players to skin \"%s\".\n",skins[cv_forceskin.value].name);
CONS_Printf("The server is restricting all players to skin \"%s\".\n",skins[cv_forceskin.value].realname);
ForceAllSkins(cv_forceskin.value);
}
}

View File

@ -1377,11 +1377,6 @@ msgstr ""
msgid "modifiedgame is false, you can unlock secrets\n"
msgstr ""
#: d_netcmd.c:4599
#, c-format
msgid "Valid skin numbers are 0 to %d (-1 disables)\n"
msgstr ""
#: d_netcmd.c:4617 d_netcmd.c:4629
msgid "You may not change your name when chat is muted.\n"
msgstr ""

View File

@ -1362,11 +1362,6 @@ msgstr ""
msgid "No CHEAT-marked variables are changed -- Cheats are disabled.\n"
msgstr ""
#: d_netcmd.c:4439
#, c-format
msgid "Valid skin numbers are 0 to %d (-1 disables)\n"
msgstr ""
#: d_netcmd.c:4457 d_netcmd.c:4469
msgid "You may not change your name when chat is muted.\n"
msgstr ""

View File

@ -2346,7 +2346,7 @@ boolean R_SkinUnlock(INT32 skinnum)
|| (skins[skinnum].availability)
|| (modeattacking) // If you have someone else's run you might as well take a look
|| (Playing() && (R_SkinAvailable(mapheaderinfo[gamemap-1]->forcecharacter) == skinnum)) // Force 1.
|| ((netgame) && (cv_forceskin.value == skinnum)) // Force 2.
|| (netgame && !(server || adminplayer == consoleplayer) && (cv_forceskin.value == skinnum)) // Force 2.
);
}