mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-27 03:30:50 +00:00
Keep execversion stuff on, just dummied out
Had issues with skin values not changing from the menu, this seemed to fix it
This commit is contained in:
parent
49f2d65e95
commit
8736952aad
5 changed files with 27 additions and 63 deletions
|
@ -51,10 +51,8 @@ static void COM_Wait_f(void);
|
||||||
static void COM_Help_f(void);
|
static void COM_Help_f(void);
|
||||||
static void COM_Toggle_f(void);
|
static void COM_Toggle_f(void);
|
||||||
|
|
||||||
#ifdef USE_VERSION_FILTERING
|
|
||||||
static void CV_EnforceExecVersion(void);
|
static void CV_EnforceExecVersion(void);
|
||||||
static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr);
|
static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr);
|
||||||
#endif
|
|
||||||
|
|
||||||
static boolean CV_Command(void);
|
static boolean CV_Command(void);
|
||||||
static consvar_t *CV_FindVar(const char *name);
|
static consvar_t *CV_FindVar(const char *name);
|
||||||
|
@ -75,14 +73,14 @@ CV_PossibleValue_t kartspeed_cons_t[] = {
|
||||||
{0, NULL}};
|
{0, NULL}};
|
||||||
|
|
||||||
// Filter consvars by EXECVERSION
|
// Filter consvars by EXECVERSION
|
||||||
// First implementation is 26 (2.1.21), so earlier configs default at 25 (2.1.20)
|
// First implementation is 2 (1.0.2), so earlier configs default at 1 (1.0.0)
|
||||||
// Also set CV_HIDEN during runtime, after config is loaded
|
// Also set CV_HIDEN during runtime, after config is loaded
|
||||||
|
|
||||||
#ifdef USE_VERSION_FILTERING
|
|
||||||
static boolean execversion_enabled = false;
|
static boolean execversion_enabled = false;
|
||||||
consvar_t cv_execversion = {"execversion","25",CV_CALL,CV_Unsigned, CV_EnforceExecVersion, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_execversion = {"execversion","1",CV_CALL,CV_Unsigned, CV_EnforceExecVersion, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
// for default joyaxis detection
|
// for default joyaxis detection
|
||||||
|
#if 0
|
||||||
static boolean joyaxis_default[4] = {false,false,false,false};
|
static boolean joyaxis_default[4] = {false,false,false,false};
|
||||||
static INT32 joyaxis_count[4] = {0,0,0,0};
|
static INT32 joyaxis_count[4] = {0,0,0,0};
|
||||||
#endif
|
#endif
|
||||||
|
@ -1728,15 +1726,16 @@ void CV_AddValue(consvar_t *var, INT32 increment)
|
||||||
var->changed = 1; // user has changed it now
|
var->changed = 1; // user has changed it now
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_VERSION_FILTERING
|
|
||||||
void CV_InitFilterVar(void)
|
void CV_InitFilterVar(void)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
joyaxis_default[i] = true;
|
joyaxis_default[i] = true;
|
||||||
joyaxis_count[i] = 0;
|
joyaxis_count[i] = 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CV_ToggleExecVersion(boolean enable)
|
void CV_ToggleExecVersion(boolean enable)
|
||||||
|
@ -1752,6 +1751,11 @@ static void CV_EnforceExecVersion(void)
|
||||||
|
|
||||||
static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr)
|
static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr)
|
||||||
{
|
{
|
||||||
|
#if 1
|
||||||
|
// We don't have changed axis defaults yet
|
||||||
|
(void)v;
|
||||||
|
(void)valstr;
|
||||||
|
#else
|
||||||
UINT8 i;
|
UINT8 i;
|
||||||
|
|
||||||
// If ALL axis settings are previous defaults, set them to the new defaults
|
// If ALL axis settings are previous defaults, set them to the new defaults
|
||||||
|
@ -1761,16 +1765,16 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr)
|
||||||
{
|
{
|
||||||
if (joyaxis_default[i])
|
if (joyaxis_default[i])
|
||||||
{
|
{
|
||||||
/*if (!stricmp(v->name, "joyaxis_fire"))
|
if (!stricmp(v->name, "joyaxis_fire"))
|
||||||
{
|
{
|
||||||
if (joyaxis_count[i] > 6) return false;
|
if (joyaxis_count[i] > 7) return false;
|
||||||
else if (joyaxis_count[i] == 6) return true;
|
else if (joyaxis_count[i] == 7) return true;
|
||||||
|
|
||||||
if (!stricmp(valstr, "None")) joyaxis_count[i]++;
|
if (!stricmp(valstr, "None")) joyaxis_count[i]++;
|
||||||
else joyaxis_default[i] = false;
|
else joyaxis_default[i] = false;
|
||||||
}*/
|
}
|
||||||
// reset all axis settings to defaults
|
// reset all axis settings to defaults
|
||||||
if (joyaxis_count[i] == 6)
|
if (joyaxis_count[i] == 7)
|
||||||
{
|
{
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
|
@ -1789,6 +1793,7 @@ static boolean CV_FilterJoyAxisVars(consvar_t *v, const char *valstr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// we haven't reached our counts yet, or we're not default
|
// we haven't reached our counts yet, or we're not default
|
||||||
return true;
|
return true;
|
||||||
|
@ -1803,32 +1808,15 @@ static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr)
|
||||||
if (!(v->flags & CV_SAVE))
|
if (!(v->flags & CV_SAVE))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (GETMAJOREXECVERSION(cv_execversion.value) < 26) // 26 = 2.1.21
|
if (GETMAJOREXECVERSION(cv_execversion.value) < 2) // 2 = 1.0.2
|
||||||
{
|
{
|
||||||
// MOUSE SETTINGS
|
#if 0
|
||||||
// alwaysfreelook split between first and third person (chasefreelook)
|
// We don't have changed saved cvars yet
|
||||||
// mousemove was on by default, which invalidates the current approach
|
|
||||||
if (!stricmp(v->name, "alwaysmlook")
|
if (!stricmp(v->name, "alwaysmlook")
|
||||||
|| !stricmp(v->name, "alwaysmlook2")
|
|| !stricmp(v->name, "alwaysmlook2")
|
||||||
|| !stricmp(v->name, "mousemove")
|
|| !stricmp(v->name, "mousemove")
|
||||||
|| !stricmp(v->name, "mousemove2"))
|
|| !stricmp(v->name, "mousemove2"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// mousesens was changed from 35 to 20 due to oversensitivity
|
|
||||||
if ((!stricmp(v->name, "mousesens")
|
|
||||||
|| !stricmp(v->name, "mousesens2")
|
|
||||||
|| !stricmp(v->name, "mouseysens")
|
|
||||||
|| !stricmp(v->name, "mouseysens2"))
|
|
||||||
&& atoi(valstr) == 35)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// JOYSTICK DEFAULTS
|
|
||||||
// use_joystick was changed from 0 to 1 to automatically use a joystick if available
|
|
||||||
#if defined(HAVE_SDL) || defined(_WINDOWS)
|
|
||||||
if ((!stricmp(v->name, "use_joystick")
|
|
||||||
|| !stricmp(v->name, "use_joystick2"))
|
|
||||||
&& atoi(valstr) == 0)
|
|
||||||
return false;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// axis defaults were changed to be friendly to 360 controllers
|
// axis defaults were changed to be friendly to 360 controllers
|
||||||
|
@ -1836,9 +1824,9 @@ static boolean CV_FilterVarByVersion(consvar_t *v, const char *valstr)
|
||||||
if (!CV_FilterJoyAxisVars(v, valstr))
|
if (!CV_FilterJoyAxisVars(v, valstr))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Displays or changes a variable from the console.
|
/** Displays or changes a variable from the console.
|
||||||
* Since the user is presumed to have been directly responsible
|
* Since the user is presumed to have been directly responsible
|
||||||
|
@ -1864,11 +1852,7 @@ static boolean CV_Command(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(v->flags & CV_SAVE)
|
if (!(v->flags & CV_SAVE) || CV_FilterVarByVersion(v, COM_Argv(1)))
|
||||||
#if 0
|
|
||||||
|| CV_FilterVarByVersion(v, COM_Argv(1))
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
CV_Set(v, COM_Argv(1));
|
CV_Set(v, COM_Argv(1));
|
||||||
v->changed = 1; // now it's been changed by (presumably) the user
|
v->changed = 1; // now it's been changed by (presumably) the user
|
||||||
|
|
|
@ -129,12 +129,10 @@ extern CV_PossibleValue_t CV_Natural[];
|
||||||
// SRB2kart
|
// SRB2kart
|
||||||
extern CV_PossibleValue_t kartspeed_cons_t[];
|
extern CV_PossibleValue_t kartspeed_cons_t[];
|
||||||
|
|
||||||
#ifdef USE_VERSION_FILTERING
|
|
||||||
extern consvar_t cv_execversion;
|
extern consvar_t cv_execversion;
|
||||||
|
|
||||||
void CV_InitFilterVar(void);
|
void CV_InitFilterVar(void);
|
||||||
void CV_ToggleExecVersion(boolean enable);
|
void CV_ToggleExecVersion(boolean enable);
|
||||||
#endif
|
|
||||||
|
|
||||||
// register a variable for use at the console
|
// register a variable for use at the console
|
||||||
void CV_RegisterVar(consvar_t *variable);
|
void CV_RegisterVar(consvar_t *variable);
|
||||||
|
|
|
@ -224,10 +224,6 @@ extern FILE *logstream;
|
||||||
#define MODVERSION 2
|
#define MODVERSION 2
|
||||||
|
|
||||||
// Filter consvars by version
|
// Filter consvars by version
|
||||||
// SRB2Kart: we don't need this YET...
|
|
||||||
//#define USE_VERSION_FILTERING
|
|
||||||
|
|
||||||
#ifdef USE_VERSION_FILTERING
|
|
||||||
// To version config.cfg, MAJOREXECVERSION is set equal to MODVERSION automatically.
|
// To version config.cfg, MAJOREXECVERSION is set equal to MODVERSION automatically.
|
||||||
// Increment MINOREXECVERSION whenever a config change is needed that does not correspond
|
// Increment MINOREXECVERSION whenever a config change is needed that does not correspond
|
||||||
// to an increment in MODVERSION. This might never happen in practice.
|
// to an increment in MODVERSION. This might never happen in practice.
|
||||||
|
@ -241,7 +237,6 @@ extern FILE *logstream;
|
||||||
#define GETMINOREXECVERSION(v) (v >> 16)
|
#define GETMINOREXECVERSION(v) (v >> 16)
|
||||||
#define GETEXECVERSION(major,minor) (major + (minor << 16))
|
#define GETEXECVERSION(major,minor) (major + (minor << 16))
|
||||||
#define EXECVERSION GETEXECVERSION(MAJOREXECVERSION, MINOREXECVERSION)
|
#define EXECVERSION GETEXECVERSION(MAJOREXECVERSION, MINOREXECVERSION)
|
||||||
#endif
|
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
||||||
|
|
|
@ -1450,12 +1450,6 @@ INT32 G_CheckDoubleUsage(INT32 keynum, boolean modify)
|
||||||
|
|
||||||
static INT32 G_FilterKeyByVersion(INT32 numctrl, INT32 keyidx, INT32 player, INT32 *keynum1, INT32 *keynum2, boolean *nestedoverride)
|
static INT32 G_FilterKeyByVersion(INT32 numctrl, INT32 keyidx, INT32 player, INT32 *keynum1, INT32 *keynum2, boolean *nestedoverride)
|
||||||
{
|
{
|
||||||
#ifndef USE_VERSION_FILTERING
|
|
||||||
(void)numctrl;
|
|
||||||
(void)player;
|
|
||||||
(void)nestedoverride;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Special case: ignore KEY_PAUSE because it's hardcoded
|
// Special case: ignore KEY_PAUSE because it's hardcoded
|
||||||
if (keyidx == 0 && *keynum1 == KEY_PAUSE)
|
if (keyidx == 0 && *keynum1 == KEY_PAUSE)
|
||||||
{
|
{
|
||||||
|
@ -1470,7 +1464,12 @@ static INT32 G_FilterKeyByVersion(INT32 numctrl, INT32 keyidx, INT32 player, INT
|
||||||
else if (keyidx == 1 && *keynum2 == KEY_PAUSE)
|
else if (keyidx == 1 && *keynum2 == KEY_PAUSE)
|
||||||
return -1; // skip setting control
|
return -1; // skip setting control
|
||||||
|
|
||||||
#ifdef USE_VERSION_FILTERING
|
#if 1
|
||||||
|
// We don't have changed control defaults yet
|
||||||
|
(void)numctrl;
|
||||||
|
(void)player;
|
||||||
|
(void)nestedoverride;
|
||||||
|
#else
|
||||||
#if !defined (DC) && !defined (_PSP) && !defined (GP2X) && !defined (_NDS) && !defined(WMINPUT) && !defined(_WII)
|
#if !defined (DC) && !defined (_PSP) && !defined (GP2X) && !defined (_NDS) && !defined(WMINPUT) && !defined(_WII)
|
||||||
if (GETMAJOREXECVERSION(cv_execversion.value) < 27 && ( // v2.1.22
|
if (GETMAJOREXECVERSION(cv_execversion.value) < 27 && ( // v2.1.22
|
||||||
numctrl == gc_weaponnext || numctrl == gc_weaponprev || numctrl == gc_tossflag ||
|
numctrl == gc_weaponnext || numctrl == gc_weaponprev || numctrl == gc_tossflag ||
|
||||||
|
|
12
src/m_misc.c
12
src/m_misc.c
|
@ -37,9 +37,7 @@
|
||||||
#include "d_main.h"
|
#include "d_main.h"
|
||||||
#include "m_argv.h"
|
#include "m_argv.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#ifdef USE_VERSION_FILTERING
|
|
||||||
#include "command.h" // cv_execversion
|
#include "command.h" // cv_execversion
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "m_anigif.h"
|
#include "m_anigif.h"
|
||||||
|
|
||||||
|
@ -449,20 +447,16 @@ void Command_LoadConfig_f(void)
|
||||||
G_Controldefault(0);
|
G_Controldefault(0);
|
||||||
|
|
||||||
// temporarily reset execversion to default
|
// temporarily reset execversion to default
|
||||||
#ifdef USE_VERSION_FILTERING
|
|
||||||
CV_ToggleExecVersion(true);
|
CV_ToggleExecVersion(true);
|
||||||
COM_BufInsertText(va("%s \"%s\"\n", cv_execversion.name, cv_execversion.defaultvalue));
|
COM_BufInsertText(va("%s \"%s\"\n", cv_execversion.name, cv_execversion.defaultvalue));
|
||||||
CV_InitFilterVar();
|
CV_InitFilterVar();
|
||||||
#endif
|
|
||||||
|
|
||||||
// exec the config
|
// exec the config
|
||||||
COM_BufInsertText(va("exec \"%s\"\n", configfile));
|
COM_BufInsertText(va("exec \"%s\"\n", configfile));
|
||||||
|
|
||||||
// don't filter anymore vars and don't let this convsvar be changed
|
// don't filter anymore vars and don't let this convsvar be changed
|
||||||
#ifdef USE_VERSION_FILTERING
|
|
||||||
COM_BufInsertText(va("%s \"%d\"\n", cv_execversion.name, EXECVERSION));
|
COM_BufInsertText(va("%s \"%d\"\n", cv_execversion.name, EXECVERSION));
|
||||||
CV_ToggleExecVersion(false);
|
CV_ToggleExecVersion(false);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Saves the current configuration and loads another.
|
/** Saves the current configuration and loads another.
|
||||||
|
@ -500,7 +494,6 @@ void M_FirstLoadConfig(void)
|
||||||
G_Controldefault(0);
|
G_Controldefault(0);
|
||||||
|
|
||||||
// register execversion here before we load any configs
|
// register execversion here before we load any configs
|
||||||
#ifdef USE_VERSION_FILTERING
|
|
||||||
CV_RegisterVar(&cv_execversion);
|
CV_RegisterVar(&cv_execversion);
|
||||||
|
|
||||||
// temporarily reset execversion to default
|
// temporarily reset execversion to default
|
||||||
|
@ -508,17 +501,14 @@ void M_FirstLoadConfig(void)
|
||||||
CV_ToggleExecVersion(true);
|
CV_ToggleExecVersion(true);
|
||||||
COM_BufInsertText(va("%s \"%s\"\n", cv_execversion.name, cv_execversion.defaultvalue));
|
COM_BufInsertText(va("%s \"%s\"\n", cv_execversion.name, cv_execversion.defaultvalue));
|
||||||
CV_InitFilterVar();
|
CV_InitFilterVar();
|
||||||
#endif
|
|
||||||
|
|
||||||
// load config, make sure those commands doesnt require the screen...
|
// load config, make sure those commands doesnt require the screen...
|
||||||
COM_BufInsertText(va("exec \"%s\"\n", configfile));
|
COM_BufInsertText(va("exec \"%s\"\n", configfile));
|
||||||
// no COM_BufExecute() needed; that does it right away
|
// no COM_BufExecute() needed; that does it right away
|
||||||
|
|
||||||
// don't filter anymore vars and don't let this convsvar be changed
|
// don't filter anymore vars and don't let this convsvar be changed
|
||||||
#ifdef USE_VERSION_FILTERING
|
|
||||||
COM_BufInsertText(va("%s \"%d\"\n", cv_execversion.name, EXECVERSION));
|
COM_BufInsertText(va("%s \"%d\"\n", cv_execversion.name, EXECVERSION));
|
||||||
CV_ToggleExecVersion(false);
|
CV_ToggleExecVersion(false);
|
||||||
#endif
|
|
||||||
|
|
||||||
// make sure I_Quit() will write back the correct config
|
// make sure I_Quit() will write back the correct config
|
||||||
// (do not write back the config if it crash before)
|
// (do not write back the config if it crash before)
|
||||||
|
@ -585,9 +575,7 @@ void M_SaveConfig(const char *filename)
|
||||||
|
|
||||||
// print execversion FIRST, because subsequent consvars need to be filtered
|
// print execversion FIRST, because subsequent consvars need to be filtered
|
||||||
// always print current EXECVERSION
|
// always print current EXECVERSION
|
||||||
#ifdef USE_VERSION_FILTERING
|
|
||||||
fprintf(f, "%s \"%d\"\n", cv_execversion.name, EXECVERSION);
|
fprintf(f, "%s \"%d\"\n", cv_execversion.name, EXECVERSION);
|
||||||
#endif
|
|
||||||
|
|
||||||
// FIXME: save key aliases if ever implemented..
|
// FIXME: save key aliases if ever implemented..
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue