Skip to content

Commit 9a9874f

Browse files
committed
Merge branch 'development' of https://github.com/Nukem9/LinkerMod into development
2 parents 2b1faf6 + ed493c2 commit 9a9874f

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

components/game_mod/dvar.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,26 @@ void Dvar_SetFromStringByName(const char *dvarName, const char *string)
154154
if (dvarName && string)
155155
{
156156
if (!_stricmp(dvarName, "cg_fov") && !_stricmp(string, "65"))
157+
{
158+
if (cg_fov == NULL || cg_fov_default == NULL)
159+
return;
160+
161+
#if _DEBUG
162+
Com_Printf(0, "CG_FOV_DEFAULT: %p\n", cg_fov_default);
163+
Com_Printf(0, "CG_FOV_DEFAULT: %f\n", cg_fov_default->current.value);
164+
#endif
165+
166+
//
167+
// Note: If we run Dvar_SetFloat *every* time the game crashes
168+
//
169+
if (cg_fov->current.value != cg_fov_default->current.value)
170+
{
171+
Dvar_SetFloat(cg_fov, cg_fov_default->current.value);
172+
return;
173+
}
174+
157175
return;
176+
}
158177

159178
if (!_stricmp(dvarName, "cg_default_fov") && !_stricmp(string, "65"))
160179
return;

components/game_mod/dvar.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ static Dvar_RegisterString_t* Dvar_RegisterString = (Dvar_RegisterString_t*)0x00
223223
typedef dvar_s *__cdecl Dvar_RegisterInt_t(const char *dvarName, int value, int min, int max, unsigned __int16 flags, const char *description);
224224
static Dvar_RegisterInt_t* Dvar_RegisterInt = (Dvar_RegisterInt_t*)0x00651910;
225225

226+
typedef dvar_s *(__cdecl* Dvar_RegisterFloat_t)(const char *dvarName, float value, float min, float max, unsigned __int16 flags, const char *description);
227+
static Dvar_RegisterFloat_t Dvar_RegisterFloat = (Dvar_RegisterFloat_t)0x00679020;
228+
226229
typedef dvar_s *(__cdecl* Dvar_RegisterBool_t)(const char *dvarName, bool value, unsigned __int16 flags, const char *description);
227230
static Dvar_RegisterBool_t Dvar_RegisterBool = (Dvar_RegisterBool_t)0x0045BB20;
228231

0 commit comments

Comments
 (0)