mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
- removed more backing data for the old keybinding code.
Unfortunately this means that the keybinding menus in all games except Blood are shot to shit right now because of how they passed the data on to its destination. These menus are not fixable, this will have to wait until the replacement is up.
This commit is contained in:
parent
eb049abc3a
commit
1b958a7f9f
9 changed files with 27 additions and 79 deletions
|
@ -37,6 +37,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "qav.h"
|
||||
#include "resource.h"
|
||||
#include "view.h"
|
||||
#include "c_bind.h"
|
||||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
|
@ -1129,7 +1130,7 @@ void CGameMenuItemKeyList::Scan(void)
|
|||
|
||||
void CGameMenuItemKeyList::Draw(void)
|
||||
{
|
||||
char buffer[40], buffer2[40];
|
||||
char buffer[40];
|
||||
int width, height;
|
||||
int shade;
|
||||
gMenuTextMgr.GetFontInfo(m_nFont, NULL, NULL, &height);
|
||||
|
@ -1139,21 +1140,9 @@ void CGameMenuItemKeyList::Draw(void)
|
|||
bool bClick = false;
|
||||
for (int i = 0; i < nRows; i++, y += height, k++)
|
||||
{
|
||||
char key1, key2;
|
||||
key1 = KeyboardKeys[k][0];
|
||||
key2 = KeyboardKeys[k][1];
|
||||
const char *sKey1 = key1 == sc_Tilde ? "Tilde" : KB_ScanCodeToString(key1);
|
||||
const char *sKey2 = key2 == sc_Tilde ? "Tilde" : KB_ScanCodeToString(key2);
|
||||
auto keys = Bindings.GetKeysForCommand(CONFIG_FunctionNumToName(k));
|
||||
FString text = C_NameKeys(keys.Data(), std::min(keys.Size(), 2u));
|
||||
sprintf(buffer, "%s", CONFIG_FunctionNumToName(k));
|
||||
if (key2 == 0 || key2 == 0xff)
|
||||
{
|
||||
if (key1 == 0 || key1 == 0xff)
|
||||
sprintf(buffer2, "????");
|
||||
else
|
||||
sprintf(buffer2, "%s", sKey1);
|
||||
}
|
||||
else
|
||||
sprintf(buffer2, "%s or %s", sKey1, sKey2);
|
||||
|
||||
if (k == nFocus)
|
||||
{
|
||||
|
@ -1165,15 +1154,15 @@ void CGameMenuItemKeyList::Draw(void)
|
|||
if (bScan && ((int)totalclock & 32))
|
||||
sVal = "____";
|
||||
else
|
||||
sVal = buffer2;
|
||||
sVal = text;
|
||||
gMenuTextMgr.GetFontInfo(m_nFont, sVal, &width, 0);
|
||||
viewDrawText(m_nFont, sVal, m_nX+m_nWidth-1-width, y, shade, 0, 0, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
viewDrawText(3, buffer, m_nX, y, 24, 0, 0, false);
|
||||
gMenuTextMgr.GetFontInfo(m_nFont, buffer2, &width, 0);
|
||||
viewDrawText(m_nFont, buffer2, m_nX+m_nWidth-1-width, y, 24, 0, 0, false);
|
||||
gMenuTextMgr.GetFontInfo(m_nFont, text, &width, 0);
|
||||
viewDrawText(m_nFont, text, m_nX+m_nWidth-1-width, y, 24, 0, 0, false);
|
||||
}
|
||||
int mx = m_nX<<16;
|
||||
int my = y<<16;
|
||||
|
|
|
@ -53,16 +53,10 @@ void sub_5A928(void)
|
|||
inputState.ClearButton(i);
|
||||
}
|
||||
|
||||
void sub_5A944(char key)
|
||||
void sub_5A944(int key)
|
||||
{
|
||||
for (int i = 0; i < NUMGAMEFUNCTIONS-1; i++)
|
||||
{
|
||||
char key1, key2;
|
||||
key1 = KeyboardKeys[i][0];
|
||||
key2 = KeyboardKeys[i][1];
|
||||
if (key1 == key || key2 == key)
|
||||
inputState.ClearButton(i);
|
||||
}
|
||||
auto binding = Bindings.GetBind(key);
|
||||
#pragma message("todo: reset the bound button here")
|
||||
}
|
||||
|
||||
void SetGodMode(bool god)
|
||||
|
@ -592,7 +586,7 @@ void CPlayerMsg::Send(void)
|
|||
void CPlayerMsg::ProcessKeys(void)
|
||||
{
|
||||
int key = keyGetScan();
|
||||
char ch;
|
||||
int ch;
|
||||
if (key != 0)
|
||||
{
|
||||
bool ctrl = (inputState.CtrlPressed());
|
||||
|
|
|
@ -424,19 +424,6 @@ void onvideomodechange(int32_t newmode)
|
|||
UpdateDacs(gLastPal, false);
|
||||
}
|
||||
|
||||
static int osdcmd_unbound(osdcmdptr_t parm)
|
||||
{
|
||||
if (parm->numparms != 1)
|
||||
return OSDCMD_OK;
|
||||
|
||||
int const gameFunc = CONFIG_FunctionNameToNum(parm->parms[0]);
|
||||
|
||||
if (gameFunc != -1)
|
||||
KeyboardKeys[gameFunc][0] = 0;
|
||||
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int osdcmd_quicksave(osdcmdptr_t UNUSED(parm))
|
||||
{
|
||||
UNREFERENCED_CONST_PARAMETER(parm);
|
||||
|
@ -513,7 +500,6 @@ int32_t registerosdcommands(void)
|
|||
OSD_RegisterFunction("restartsound","restartsound: reinitializes the sound system",osdcmd_restartsound);
|
||||
OSD_RegisterFunction("restartvid","restartvid: reinitializes the video mode",osdcmd_restartvid);
|
||||
OSD_RegisterFunction("screenshot","screenshot [format]: takes a screenshot.", osdcmd_screenshot);
|
||||
OSD_RegisterFunction("unbound", NULL, osdcmd_unbound);
|
||||
|
||||
OSD_RegisterFunction("vidmode","vidmode <xdim> <ydim> <bpp> <fullscreen>: change the video mode",osdcmd_vidmode);
|
||||
#ifdef USE_OPENGL
|
||||
|
|
|
@ -16,8 +16,6 @@ class FArgs;
|
|||
|
||||
void D_AddWildFile(TArray<FString>& wadfiles, const char* value);
|
||||
|
||||
extern uint8_t KeyboardKeys[NUMGAMEFUNCTIONS][2];
|
||||
|
||||
int CONFIG_Init();
|
||||
void CONFIG_SetDefaultKeys(const char *defbinds);
|
||||
int32_t CONFIG_FunctionNameToNum(const char* func);
|
||||
|
@ -25,7 +23,6 @@ const char* CONFIG_FunctionNumToName(int32_t func);
|
|||
const char* CONFIG_FunctionNumToRealName(int32_t func);
|
||||
void CONFIG_ReplaceButtonName(int num, const char* text);
|
||||
void CONFIG_DeleteButtonName(int num);
|
||||
void CONFIG_MapKey(int which, kb_scancode key1, kb_scancode oldkey1, kb_scancode key2, kb_scancode oldkey2);
|
||||
|
||||
// I am not sure if anything below will survive for long...
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "superfasthash.h"
|
||||
#include "gamecvars.h"
|
||||
#include "gamecontrol.h"
|
||||
#include "c_bind.h"
|
||||
#include "../../glbackend/glbackend.h"
|
||||
|
||||
BEGIN_DUKE_NS
|
||||
|
@ -768,7 +769,7 @@ static MenuEntry_t *MEL_DISPLAYSETUP_GL_POLYMER[] = {
|
|||
static char const *MenuKeyNone = " -";
|
||||
static char const *MEOSN_Keys[NUMKEYS];
|
||||
|
||||
static MenuCustom2Col_t MEO_KEYBOARDSETUPFUNCS_TEMPLATE = { { NULL, NULL, }, MEOSN_Keys, &MF_Minifont, NUMKEYS, 54<<16, 0 };
|
||||
static MenuCustom2Col_t MEO_KEYBOARDSETUPFUNCS_TEMPLATE = { 0, &MF_Minifont, NUMKEYS, 54<<16, 0 };
|
||||
static MenuCustom2Col_t MEO_KEYBOARDSETUPFUNCS[NUMGAMEFUNCTIONS];
|
||||
static MenuEntry_t ME_KEYBOARDSETUPFUNCS_TEMPLATE = MAKE_MENUENTRY( NULL, &MF_Minifont, &MEF_KBFuncList, &MEO_KEYBOARDSETUPFUNCS_TEMPLATE, Custom2Col );
|
||||
static MenuEntry_t ME_KEYBOARDSETUPFUNCS[NUMGAMEFUNCTIONS];
|
||||
|
@ -1826,8 +1827,6 @@ void Menu_Init(void)
|
|||
ME_KEYBOARDSETUPFUNCS[i].name = MenuGameFuncs[i];
|
||||
ME_KEYBOARDSETUPFUNCS[i].entry = &MEO_KEYBOARDSETUPFUNCS[i];
|
||||
MEO_KEYBOARDSETUPFUNCS[i] = MEO_KEYBOARDSETUPFUNCS_TEMPLATE;
|
||||
MEO_KEYBOARDSETUPFUNCS[i].column[0] = &KeyboardKeys[i][0];
|
||||
MEO_KEYBOARDSETUPFUNCS[i].column[1] = &KeyboardKeys[i][1];
|
||||
}
|
||||
M_KEYBOARDKEYS.numEntries = NUMGAMEFUNCTIONS;
|
||||
for (i = 0; i < MENUMOUSEFUNCTIONS; ++i)
|
||||
|
@ -2921,7 +2920,6 @@ static int32_t Menu_PreCustom2ColScreen(MenuEntry_t *entry)
|
|||
if (sc != sc_None)
|
||||
{
|
||||
S_PlaySound(PISTOL_BODYHIT);
|
||||
*column->column[M_KEYBOARDKEYS.currentColumn] = sc;
|
||||
Bindings.SetBind(sc, CONFIG_FunctionNumToName(M_KEYBOARDKEYS.currentEntry));
|
||||
KB_ClearKeyDown(sc);
|
||||
|
||||
|
@ -4885,8 +4883,14 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
|
|||
int32_t columnx[2] = { origin.x + x - ((status & MT_XRight) ? object->columnWidth : 0), origin.x + x + ((status & MT_XRight) ? 0 : object->columnWidth) };
|
||||
const int32_t columny = origin.y + y_upper + y - menu->scrollPos;
|
||||
|
||||
const vec2_t column0textsize = Menu_Text(columnx[0], columny + ((height>>17)<<16), object->font, object->key[*object->column[0]], menu->currentColumn == 0 ? status : (status & ~MT_Selected), ydim_upper, ydim_lower);
|
||||
const vec2_t column1textsize = Menu_Text(columnx[1], columny + ((height>>17)<<16), object->font, object->key[*object->column[1]], menu->currentColumn == 1 ? status : (status & ~MT_Selected), ydim_upper, ydim_lower);
|
||||
// Beware of hack job!
|
||||
auto keys = Bindings.GetKeysForCommand(CONFIG_FunctionNumToName(object->buttonindex));
|
||||
FString text1;
|
||||
FString text2;
|
||||
if (keys.Size() > 0) text1 = C_NameKeys(&keys[0], 1);
|
||||
if (keys.Size() > 1) text2 = C_NameKeys(&keys[1], 1);
|
||||
const vec2_t column0textsize = Menu_Text(columnx[0], columny + ((height >> 17) << 16), object->font, text1, menu->currentColumn == 0 ? status : (status & ~MT_Selected), ydim_upper, ydim_lower);
|
||||
const vec2_t column1textsize = Menu_Text(columnx[1], columny + ((height>>17)<<16), object->font, text2, menu->currentColumn == 1 ? status : (status & ~MT_Selected), ydim_upper, ydim_lower);
|
||||
|
||||
if (entry->format->width > 0)
|
||||
mousewidth += object->columnWidth + column1textsize.x;
|
||||
|
|
|
@ -214,9 +214,7 @@ typedef struct MenuOption_t
|
|||
} MenuOption_t;
|
||||
typedef struct MenuCustom2Col_t
|
||||
{
|
||||
// effect
|
||||
uint8_t *column[2];
|
||||
char const **key;
|
||||
int buttonindex;
|
||||
|
||||
// appearance
|
||||
MenuFont_t *font;
|
||||
|
|
|
@ -803,19 +803,6 @@ void onvideomodechange(int32_t newmode)
|
|||
g_crosshairSum = -1;
|
||||
}
|
||||
|
||||
static int osdcmd_unbound(osdcmdptr_t parm)
|
||||
{
|
||||
if (parm->numparms != 1)
|
||||
return OSDCMD_OK;
|
||||
|
||||
int const gameFunc = CONFIG_FunctionNameToNum(parm->parms[0]);
|
||||
|
||||
if (gameFunc != -1)
|
||||
KeyboardKeys[gameFunc][0] = 0;
|
||||
|
||||
return OSDCMD_OK;
|
||||
}
|
||||
|
||||
static int osdcmd_quicksave(osdcmdptr_t UNUSED(parm))
|
||||
{
|
||||
UNREFERENCED_CONST_PARAMETER(parm);
|
||||
|
@ -1174,8 +1161,6 @@ int32_t registerosdcommands(void)
|
|||
|
||||
OSD_RegisterFunction("spawn","spawn <picnum> [palnum] [cstat] [ang] [x y z]: spawns a sprite with the given properties",osdcmd_spawn);
|
||||
|
||||
OSD_RegisterFunction("unbound", NULL, osdcmd_unbound);
|
||||
|
||||
OSD_RegisterFunction("vidmode","vidmode <xdim> <ydim> <bpp> <fullscreen>: change the video mode",osdcmd_vidmode);
|
||||
#ifdef USE_OPENGL
|
||||
baselayer_osdcmd_vidmode_func = osdcmd_vidmode;
|
||||
|
|
|
@ -1720,8 +1720,6 @@ void Menu_Init(void)
|
|||
ME_KEYBOARDSETUPFUNCS[i].name = MenuGameFuncs[i];
|
||||
ME_KEYBOARDSETUPFUNCS[i].entry = &MEO_KEYBOARDSETUPFUNCS[i];
|
||||
MEO_KEYBOARDSETUPFUNCS[i] = MEO_KEYBOARDSETUPFUNCS_TEMPLATE;
|
||||
MEO_KEYBOARDSETUPFUNCS[i].column[0] = &KeyboardKeys[i][0];
|
||||
MEO_KEYBOARDSETUPFUNCS[i].column[1] = &KeyboardKeys[i][1];
|
||||
}
|
||||
M_KEYBOARDKEYS.numEntries = NUMGAMEFUNCTIONS;
|
||||
for (i = 0; i < MENUMOUSEFUNCTIONS; ++i)
|
||||
|
|
|
@ -681,7 +681,7 @@ SWBOOL MNU_KeySetupCustom(UserCall call, MenuItem *item)
|
|||
{
|
||||
KB_ClearKeyDown(KB_GetLastScanCode());
|
||||
|
||||
KeyboardKeys[currentkey][currentcol] = KB_GetLastScanCode();
|
||||
//KeyboardKeys[currentkey][currentcol] = KB_GetLastScanCode();
|
||||
if (currentkey != gamefunc_Show_Console)
|
||||
{
|
||||
#if 0 // [JM] Re-do this shit !CHECKME!
|
||||
|
@ -738,13 +738,8 @@ SWBOOL MNU_KeySetupCustom(UserCall call, MenuItem *item)
|
|||
KB_ClearKeyDown(sc_Delete);
|
||||
if (currentkey != gamefunc_Show_Console)
|
||||
{
|
||||
KeyboardKeys[currentkey][currentcol] = 0xff;
|
||||
#if 0 // [JM] Re-do this shit !CHECKME!
|
||||
CONTROL_MapKey(currentkey,
|
||||
KeyboardKeys[currentkey][0],
|
||||
KeyboardKeys[currentkey][1]);
|
||||
#endif
|
||||
}
|
||||
//Bindings.UnbindACommand(CONFIG_FunctionNumToName(M_KEYBOARDKEYS.currentEntry));
|
||||
}
|
||||
}
|
||||
else if (KB_KeyPressed(sc_Home))
|
||||
{
|
||||
|
@ -810,6 +805,7 @@ SWBOOL MNU_KeySetupCustom(UserCall call, MenuItem *item)
|
|||
}
|
||||
ds[j] = 0;
|
||||
|
||||
#if 0
|
||||
j = OPT_LINE(0)+(i-topitem)*8;
|
||||
MNU_DrawSmallString(OPT_XS, j, ds, (i==currentkey) ? 0 : 12, 16);
|
||||
|
||||
|
@ -824,6 +820,7 @@ SWBOOL MNU_KeySetupCustom(UserCall call, MenuItem *item)
|
|||
if (!p || KeyboardKeys[i][1]==0xff) p = " -";
|
||||
MNU_DrawSmallString(OPT_XSIDE + 4*14, j, p, (i==currentkey) ? -5 : 12,
|
||||
(i==currentkey && currentcol==1) ? 14 : 16);
|
||||
#endif
|
||||
}
|
||||
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue