- made presets work again.

Two fixes:
* fixed file system setup to mark the last main game resource.
* unbind all keys before loading a preset.
This commit is contained in:
Christoph Oelckers 2020-06-07 13:35:23 +02:00
parent f2a637418d
commit 8da6b8796b
3 changed files with 44 additions and 22 deletions

View file

@ -716,13 +716,8 @@ void C_SetDefaultKeys(const char* baseconfig)
while ((lump = fileSystem.FindLumpFullName(baseconfig, &lastlump)) != -1) while ((lump = fileSystem.FindLumpFullName(baseconfig, &lastlump)) != -1)
{ {
if (fileSystem.GetFileContainer(lump) > 0) break; // Read this only from the main game resources.
// [SW] - We need to check to see the origin of the DEFBINDS... if it if (fileSystem.GetFileContainer(lump) <= fileSystem.GetMaxIwadNum())
// Comes from an IWAD/IPK3/IPK7 allow it to override the users settings...
// If it comes from a user mod however, don't.
if (fileSystem.GetFileContainer(lump) > fileSystem.GetMaxIwadNum())
ReadBindings(lump, false);
else
ReadBindings(lump, true); ReadBindings(lump, true);
} }
@ -752,6 +747,13 @@ void C_BindDefaults()
C_SetDefaultKeys(cl_defaultconfiguration == 1 ? "engine/origbinds.txt" : cl_defaultconfiguration == 2 ? "engine/leftbinds.txt" : "engine/defbinds.txt"); C_SetDefaultKeys(cl_defaultconfiguration == 1 ? "engine/origbinds.txt" : cl_defaultconfiguration == 2 ? "engine/leftbinds.txt" : "engine/defbinds.txt");
} }
void C_SetDefaultBindings()
{
C_UnbindAll();
C_BindDefaults();
}
CCMD(controlpreset) CCMD(controlpreset)
{ {
if (argv.argc() < 2) if (argv.argc() < 2)
@ -762,7 +764,7 @@ CCMD(controlpreset)
int v = atoi(argv[1]); int v = atoi(argv[1]);
if (v < 0 || v > 2) return; if (v < 0 || v > 2) return;
cl_defaultconfiguration = v; cl_defaultconfiguration = v;
C_BindDefaults(); C_SetDefaultBindings();
} }
CCMD(binddefaults) CCMD(binddefaults)
@ -770,12 +772,6 @@ CCMD(binddefaults)
C_BindDefaults(); C_BindDefaults();
} }
void C_SetDefaultBindings()
{
C_UnbindAll();
C_BindDefaults();
}
//============================================================================= //=============================================================================
// //
// //

View file

@ -322,6 +322,7 @@ void InitFileSystem(TArray<GrpEntry>& groups)
} }
i--; i--;
} }
fileSystem.SetMaxIwadNum(Files.Size() - 1);
D_AddConfigFiles(Files, "Global.Autoload", "*.grp", GameConfig); D_AddConfigFiles(Files, "Global.Autoload", "*.grp", GameConfig);

View file

@ -1,10 +1,35 @@
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman /*
// Ken Silverman's official web site: "http://www.advsys.net/ken" ** palette.cpp
// See the included license file "BUILDLIC.TXT" for license info. **
// **---------------------------------------------------------------------------
// This file has been modified from Ken Silverman's original release ** Copyright 2019-2020 Christoph Oelckers
// by Jonathon Fowler (jf@jonof.id.au) ** All rights reserved.
// by the EDuke32 team (development@voidpoint.com) **
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
*/
#include "build.h" #include "build.h"
#include "baselayer.h" #include "baselayer.h"
@ -325,7 +350,7 @@ void LookupTableInfo::makeTable(int palnum, const uint8_t *remapbuf, int r, int
if (remapbuf == nullptr) if (remapbuf == nullptr)
{ {
if (r == 0 || g == 0 || b == 0) if (r == 0 && g == 0 && b == 0)
{ {
clearTable(palnum); clearTable(palnum);
return; return;