write +moveleft etc to configs ONLY if they were explicitly +fooed, and not just because someone was still holding a key on a map change.

moved various config saving options to features, buttons saving is now disabled by default.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5239 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2018-04-09 18:01:15 +00:00
parent 1490d00793
commit ce4d162f31
3 changed files with 46 additions and 25 deletions

View file

@ -185,7 +185,7 @@ static void KeyDown (kbutton_t *b, kbutton_t *anti)
b->down[pnum][1] = k; b->down[pnum][1] = k;
else else
{ {
Con_Printf ("Three keys down for a button!\n"); Con_DPrintf ("Three keys down for a button!\n");
return; return;
} }
@ -379,20 +379,20 @@ void IN_WriteButtons(vfsfile_t *f, qboolean all)
VFS_PRINTF(f, "\n//Player 1 buttons\n"); VFS_PRINTF(f, "\n//Player 1 buttons\n");
for (b = 0; b < countof(buttons); b++) for (b = 0; b < countof(buttons); b++)
{ {
if (buttons[b].button->state[s]&1) if ((buttons[b].button->state[s]&1) && (buttons[b].button->down[s][0]==-1 || buttons[b].button->down[s][1]==-1))
VFS_PRINTF(f, "+%s\n", buttons[b].name); VFS_PRINTF(f, "+%s\n", buttons[b].name);
else if (b || all) else if (b || all)
VFS_PRINTF(f, "-%s\n", buttons[b].name); VFS_PRINTF(f, "-%s\n", buttons[b].name);
} }
for (; s < MAX_SPLITS; s++) for (s = 1; s < MAX_SPLITS; s++)
{ {
VFS_PRINTF(f, "\n//Player %i buttons\n", s+1); VFS_PRINTF(f, "\n//Player %i buttons\n", s);
for (b = 0; b < countof(buttons); b++) for (b = 0; b < countof(buttons); b++)
{ {
if (buttons[b].button->state[s]&1) if ((buttons[b].button->state[s]&1) && (buttons[b].button->down[s][0]==-1 || buttons[b].button->down[s][1]==-1))
VFS_PRINTF(f, "+p%i %s\n", s+1, buttons[b].name); VFS_PRINTF(f, "+p%i %s\n", s, buttons[b].name);
else if (b || all) else if (b || all)
VFS_PRINTF(f, "-p%i %s\n", s+1, buttons[b].name); VFS_PRINTF(f, "-p%i %s\n", s, buttons[b].name);
} }
} }

View file

@ -52,6 +52,11 @@ cmdalias_t *cmd_alias;
cvar_t cfg_save_all = CVARFD("cfg_save_all", "", CVAR_ARCHIVE|CVAR_NOTFROMSERVER, "If 1, cfg_save ALWAYS saves all cvars. If 0, cfg_save only ever saves archived cvars. If empty, cfg_save saves all cvars only when an explicit filename was given (ie: when not used internally via quit menu options)."); cvar_t cfg_save_all = CVARFD("cfg_save_all", "", CVAR_ARCHIVE|CVAR_NOTFROMSERVER, "If 1, cfg_save ALWAYS saves all cvars. If 0, cfg_save only ever saves archived cvars. If empty, cfg_save saves all cvars only when an explicit filename was given (ie: when not used internally via quit menu options).");
cvar_t cfg_save_auto = CVARFD("cfg_save_auto", "0", CVAR_ARCHIVE|CVAR_NOTFROMSERVER, "If 1, the config will automatically be saved and without prompts. If 0, you'll have to save your config manually (possibly via prompts from the quit menu)."); cvar_t cfg_save_auto = CVARFD("cfg_save_auto", "0", CVAR_ARCHIVE|CVAR_NOTFROMSERVER, "If 1, the config will automatically be saved and without prompts. If 0, you'll have to save your config manually (possibly via prompts from the quit menu).");
cvar_t cfg_save_infos = CVARFD("cfg_save_infos", "1", CVAR_ARCHIVE|CVAR_NOTFROMSERVER, "If 1, saves userinfo and serverinfo to configs.");
cvar_t cfg_save_aliases = CVARFD("cfg_save_aliases", "1", CVAR_ARCHIVE|CVAR_NOTFROMSERVER, "If 1, saves userinfo and serverinfo to configs.");
cvar_t cfg_save_binds = CVARFD("cfg_save_binds", "1", CVAR_ARCHIVE|CVAR_NOTFROMSERVER, "If 1, saves all key bindings to configs.");
cvar_t cfg_save_buttons = CVARFD("cfg_save_buttons", "0", CVAR_ARCHIVE|CVAR_NOTFROMSERVER, "If 1, saves the state of things such as +mlook or +forward to configs.");
cvar_t cl_warncmd = CVARF("cl_warncmd", "1", CVAR_NOSAVE|CVAR_NORESET); cvar_t cl_warncmd = CVARF("cl_warncmd", "1", CVAR_NOSAVE|CVAR_NORESET);
cvar_t cl_aliasoverlap = CVARF("cl_aliasoverlap", "1", CVAR_NOTFROMSERVER); cvar_t cl_aliasoverlap = CVARF("cl_aliasoverlap", "1", CVAR_NOTFROMSERVER);
@ -3785,7 +3790,6 @@ void Cmd_WriteConfig_f(void)
char fname[MAX_QPATH]; char fname[MAX_QPATH];
char sysname[MAX_OSPATH]; char sysname[MAX_OSPATH];
qboolean all = true; qboolean all = true;
extern cvar_t cfg_save_all;
if (Cmd_IsInsecure() && Cmd_Argc() > 1) if (Cmd_IsInsecure() && Cmd_Argc() > 1)
{ {
@ -3832,18 +3836,23 @@ void Cmd_WriteConfig_f(void)
VFS_PRINTF(f, "// %s config file\n\n", *fs_gamename.string?fs_gamename.string:FULLENGINENAME); VFS_PRINTF(f, "// %s config file\n\n", *fs_gamename.string?fs_gamename.string:FULLENGINENAME);
#ifndef SERVERONLY #ifndef SERVERONLY
Key_WriteBindings (f); if (cfg_save_binds.ival)
IN_WriteButtons(f, all); Key_WriteBindings (f);
CL_SaveInfo(f); if (cfg_save_buttons.ival)
IN_WriteButtons(f, all);
if (cfg_save_infos.ival)
CL_SaveInfo(f);
#else #else
VFS_WRITE(f, "// Dedicated Server config\n\n", 28); VFS_WRITE(f, "// Dedicated Server config\n\n", 28);
#endif #endif
#ifdef CLIENTONLY #ifdef CLIENTONLY
VFS_WRITE(f, "// no local/server infos\n\n", 26); VFS_WRITE(f, "// no local/server infos\n\n", 26);
#else #else
SV_SaveInfos(f); if (cfg_save_infos.ival)
SV_SaveInfos(f);
#endif #endif
Alias_WriteAliases (f); if (cfg_save_aliases.ival)
Alias_WriteAliases (f);
Cvar_WriteVariables (f, all); Cvar_WriteVariables (f, all);
VFS_CLOSE(f); VFS_CLOSE(f);
@ -4100,6 +4109,10 @@ void Cmd_Init (void)
Cvar_Register (&cl_warncmd, "Warnings"); Cvar_Register (&cl_warncmd, "Warnings");
Cvar_Register (&cfg_save_all, "client operation options"); Cvar_Register (&cfg_save_all, "client operation options");
Cvar_Register (&cfg_save_auto, "client operation options"); Cvar_Register (&cfg_save_auto, "client operation options");
Cvar_Register (&cfg_save_infos, "client operation options");
Cvar_Register (&cfg_save_aliases, "client operation options");
Cvar_Register (&cfg_save_binds, "client operation options");
Cvar_Register (&cfg_save_buttons, "client operation options");
#ifndef SERVERONLY #ifndef SERVERONLY
rcon_level.ival = atof(rcon_level.enginevalue); //client is restricted to not be allowed to change restrictions. rcon_level.ival = atof(rcon_level.enginevalue); //client is restricted to not be allowed to change restrictions.

View file

@ -2664,7 +2664,7 @@ static void BE_DrawMeshChain_Internal(void)
BindTexture(passno, shaderstate.fogtexture); BindTexture(passno, shaderstate.fogtexture);
BE_ApplyTMUState(passno, shaderstate.curtexflags[passno]); BE_ApplyTMUState(passno, shaderstate.curtexflags[passno]);
Vector4Set((qbyte*)&shaderstate.passcolour, r_refdef.globalfog.colour[2]*255, r_refdef.globalfog.colour[1]*255, r_refdef.globalfog.colour[0]*255, r_refdef.globalfog.colour[3]*255); Vector4Set((qbyte*)&shaderstate.passcolour, r_refdef.globalfog.colour[2]*255, r_refdef.globalfog.colour[1]*255, r_refdef.globalfog.colour[0]*255, r_refdef.globalfog.alpha*255);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, passno, D3DTSS_CONSTANT, shaderstate.passcolour); IDirect3DDevice9_SetTextureStageState(pD3DDev9, passno, D3DTSS_CONSTANT, shaderstate.passcolour);
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_COLORVERTEX, FALSE); IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_COLORVERTEX, FALSE);
IDirect3DDevice9_SetTextureStageState(pD3DDev9, passno, D3DTSS_COLORARG1, D3DTA_CONSTANT); IDirect3DDevice9_SetTextureStageState(pD3DDev9, passno, D3DTSS_COLORARG1, D3DTA_CONSTANT);
@ -3862,20 +3862,28 @@ void D3D9BE_BaseEntTextures(void)
void D3D9BE_RenderShadowBuffer(unsigned int numverts, IDirect3DVertexBuffer9 *vbuf, unsigned int numindicies, IDirect3DIndexBuffer9 *ibuf) void D3D9BE_RenderShadowBuffer(unsigned int numverts, IDirect3DVertexBuffer9 *vbuf, unsigned int numindicies, IDirect3DIndexBuffer9 *ibuf)
{ {
float pushdepth = shaderstate.curshader->polyoffset.factor; polyoffset_t po = shaderstate.curshader->polyoffset;
#ifdef BEF_PUSHDEPTH #ifdef BEF_PUSHDEPTH
extern cvar_t r_polygonoffset_submodel_factor; if (shaderstate.flags & BEF_PUSHDEPTH)
// if (shaderstate.flags & BEF_PUSHDEPTH)
pushdepth += r_polygonoffset_submodel_factor.value;
#endif
// D3D9BE_Cull(0);//shaderstate.curshader->flags & (SHADER_CULL_FRONT | SHADER_CULL_BACK));
pushdepth /= 0xffff;
if (pushdepth != shaderstate.depthbias)
{ {
shaderstate.depthbias = pushdepth; extern cvar_t r_polygonoffset_submodel_factor, r_polygonoffset_submodel_offset;
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_DEPTHBIAS, *(DWORD*)&shaderstate.depthbias); po.factor += r_polygonoffset_submodel_factor.value;
po.unit += r_polygonoffset_submodel_offset.value;
} }
#endif
if (po.factor != shaderstate.curpolyoffset.factor)
{
shaderstate.curpolyoffset.factor = po.factor;
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_SLOPESCALEDEPTHBIAS, *(DWORD*)&po.factor);
}
if (po.unit != shaderstate.curpolyoffset.unit)
{
shaderstate.curpolyoffset.unit = po.unit;
po.unit *= shaderstate.gltod3d_depthunit;
IDirect3DDevice9_SetRenderState(pD3DDev9, D3DRS_DEPTHBIAS, *(DWORD*)&po.unit);
}
// D3D9BE_Cull(0);
IDirect3DDevice9_SetStreamSource(pD3DDev9, STRM_VERT, vbuf, 0, sizeof(vecV_t)); IDirect3DDevice9_SetStreamSource(pD3DDev9, STRM_VERT, vbuf, 0, sizeof(vecV_t));