- consolidation of defbinds definitions.

Putting all the generic definitions in files used by all games greatly reduces the clutter and chance for errors.
This commit is contained in:
Christoph Oelckers 2019-11-26 21:06:43 +01:00
parent 0f4d80b5d3
commit 1adceb82ef
28 changed files with 167 additions and 1367 deletions

View file

@ -649,7 +649,7 @@ CCMD(rebind)
//
//=============================================================================
void ReadBindings(int lump)
void ReadBindings(int lump, bool override)
{
FScanner sc(lump);
@ -675,20 +675,26 @@ void ReadBindings(int lump)
}
key = GetConfigKeyFromName(sc.String);
sc.MustGetString();
dest->SetBind(key, sc.String);
dest->SetBind(key, sc.String, override);
}
}
void CONFIG_SetDefaultKeys(const char* baseconfig)
{
auto lump = fileSystem.GetFile(baseconfig);
ReadBindings(lump);
auto lump = fileSystem.GetFile("demolition/commonbinds.txt", ELookupMode::FullName, 0);
if (lump >= 0) ReadBindings(lump, true);
int lastlump = 0;
while ((lump = fileSystem.Iterate(baseconfig, &lastlump)) != -1)
{
if (fileSystem.GetFileContainer(lump) > 0) break;
ReadBindings(lump, true);
}
while ((lump = fileSystem.Iterate("defbinds.txt", &lastlump)) != -1)
{
ReadBindings(lump);
ReadBindings(lump, false);
}
}

View file

@ -61,8 +61,9 @@ public:
void DoBind (const char *key, const char *bind);
void DefaultBind(const char *keyname, const char *cmd);
void SetBind(unsigned int key, const char *bind)
void SetBind(unsigned int key, const char *bind, bool override = true)
{
if (!override && Binds[key].IsNotEmpty()) return;
if (key < NUM_KEYS) Binds[key] = bind;
}

View file

@ -578,7 +578,7 @@ void FListMenuItemNativeText::Drawer(DListMenu* menu, const DVector2& origin, bo
{
if (*text == '$') text = GStrings(text + 1);
auto state = selected ? NIT_SelectedState : mEnabled ? NIT_ActiveState : NIT_InactiveState;
gi->DrawNativeMenuText(mFontnum, state, int((origin.X + mXpos) / 65536) , int((origin.Y + mYpos) / 65536), 1.f, text, menu->Descriptor()->mFlags);
gi->DrawNativeMenuText(mFontnum, state, int((origin.X + mXpos) * 65536) , int((origin.Y + mYpos) * 65536), 1.f, text, menu->Descriptor()->mFlags);
}
}