- move static AM color initialization into the AM_StaticInit function.
- move D_LoadWadSettings to keysections.cpp. - made some more data reloadable. - data structures filled by P_SetupLevel should be cleared before loading the level. They can remain non-empty in case of an error. There's probably more to fix here... - fixed: MidiDevices and MusicAliases were not cleared before reloading local SNDINFOs. - fixed signed/unsigned warnings in AddSwitchPair for real (GCC really allows -1u? MSVC prints a warning for that.) SVN r3036 (trunk)
This commit is contained in:
parent
ee20d0ea7a
commit
f0f17e531c
23 changed files with 134 additions and 107 deletions
|
|
@ -41,6 +41,7 @@
|
|||
#include "c_bind.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "gameconfigfile.h"
|
||||
#include "w_wad.h"
|
||||
|
||||
TArray<FKeySection> KeySections;
|
||||
|
||||
|
|
@ -141,3 +142,78 @@ CCMD (addmenukey)
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// D_LoadWadSettings
|
||||
//
|
||||
// Parses any loaded KEYCONF lumps. These are restricted console scripts
|
||||
// that can only execute the alias, defaultbind, addkeysection,
|
||||
// addmenukey, weaponsection, and addslotdefault commands.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void D_LoadWadSettings ()
|
||||
{
|
||||
char cmd[4096];
|
||||
int lump, lastlump = 0;
|
||||
|
||||
ParsingKeyConf = true;
|
||||
KeySections.Clear();
|
||||
|
||||
while ((lump = Wads.FindLump ("KEYCONF", &lastlump)) != -1)
|
||||
{
|
||||
FMemLump data = Wads.ReadLump (lump);
|
||||
const char *eof = (char *)data.GetMem() + Wads.LumpLength (lump);
|
||||
const char *conf = (char *)data.GetMem();
|
||||
|
||||
while (conf < eof)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
// Fetch a line to execute
|
||||
for (i = 0; conf + i < eof && conf[i] != '\n'; ++i)
|
||||
{
|
||||
cmd[i] = conf[i];
|
||||
}
|
||||
cmd[i] = 0;
|
||||
conf += i;
|
||||
if (*conf == '\n')
|
||||
{
|
||||
conf++;
|
||||
}
|
||||
|
||||
// Comments begin with //
|
||||
char *stop = cmd + i - 1;
|
||||
char *comment = cmd;
|
||||
int inQuote = 0;
|
||||
|
||||
if (*stop == '\r')
|
||||
*stop-- = 0;
|
||||
|
||||
while (comment < stop)
|
||||
{
|
||||
if (*comment == '\"')
|
||||
{
|
||||
inQuote ^= 1;
|
||||
}
|
||||
else if (!inQuote && *comment == '/' && *(comment + 1) == '/')
|
||||
{
|
||||
break;
|
||||
}
|
||||
comment++;
|
||||
}
|
||||
if (comment == cmd)
|
||||
{ // Comment at line beginning
|
||||
continue;
|
||||
}
|
||||
else if (comment < stop)
|
||||
{ // Comment in middle of line
|
||||
*comment = 0;
|
||||
}
|
||||
|
||||
AddCommandString (cmd);
|
||||
}
|
||||
}
|
||||
ParsingKeyConf = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue