Add OSD_PROTECTED flag, set when gamefunc_Show_Console has been undefined from CON. Currently just requires you hold down shift when pressing the console key to open the console.

git-svn-id: https://svn.eduke32.com/eduke32@6325 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2017-07-05 05:42:37 +00:00
parent 6af5f3b478
commit a9e513ecaf
4 changed files with 12 additions and 10 deletions

View file

@ -197,7 +197,8 @@ enum osdflags_t
OSD_OVERTYPE = 0x00000008, OSD_OVERTYPE = 0x00000008,
OSD_SHIFT = 0x00000010, OSD_SHIFT = 0x00000010,
OSD_CTRL = 0x00000020, OSD_CTRL = 0x00000020,
OSD_CAPS = 0x00000040 OSD_CAPS = 0x00000040,
OSD_PROTECTED = 0x00000080,
}; };
#define OSD_ALIAS (int32_t (*)(const osdfuncparm_t*))0x1337 #define OSD_ALIAS (int32_t (*)(const osdfuncparm_t*))0x1337
@ -242,7 +243,7 @@ void OSD_SetFunctions(void (*drawchar)(int32_t, int32_t, char, int32_t, int32_t)
// sets the parameters for presenting the text // sets the parameters for presenting the text
void OSD_SetParameters(int32_t promptShade, int32_t promptPal, int32_t editShade, int32_t editPal, int32_t textShade, int32_t textPal, void OSD_SetParameters(int32_t promptShade, int32_t promptPal, int32_t editShade, int32_t editPal, int32_t textShade, int32_t textPal,
char const *const errorStr, char const *const highlight); char const *const errorStr, char const *const highlight, uint32_t flags);
// sets the scancode for the key which activates the onscreen display // sets the scancode for the key which activates the onscreen display
void OSD_CaptureKey(uint8_t scanCode); void OSD_CaptureKey(uint8_t scanCode);

View file

@ -767,7 +767,7 @@ void OSD_SetFunctions(void (*drawchar)(int32_t, int32_t, char, int32_t, int32_t)
// OSD_SetParameters() -- Sets the parameters for presenting the text // OSD_SetParameters() -- Sets the parameters for presenting the text
// //
void OSD_SetParameters(int32_t promptShade, int32_t promptPal, int32_t editShade, int32_t editPal, int32_t textShade, int32_t textPal, void OSD_SetParameters(int32_t promptShade, int32_t promptPal, int32_t editShade, int32_t editPal, int32_t textShade, int32_t textPal,
char const * const errorStr, char const * const highlight) char const *const errorStr, char const *const highlight, uint32_t flags)
{ {
osddraw_t &draw = osd->draw; osddraw_t &draw = osd->draw;
@ -779,6 +779,8 @@ void OSD_SetParameters(int32_t promptShade, int32_t promptPal, int32_t editShade
draw.textpal = textPal; draw.textpal = textPal;
draw.errorfmt = errorStr; draw.errorfmt = errorStr;
draw.highlight = highlight; draw.highlight = highlight;
osd->flags |= flags;
} }
@ -1191,7 +1193,7 @@ int OSD_HandleScanCode(uint8_t scanCode, int keyDown)
osddraw_t &draw = osd->draw; osddraw_t &draw = osd->draw;
if (scanCode == osd->keycode) if (scanCode == osd->keycode && (keystatus[sc_LeftShift] || (osd->flags & OSD_CAPTURE) || (osd->flags & OSD_PROTECTED) != OSD_PROTECTED))
{ {
if (keyDown) if (keyDown)
{ {

View file

@ -9974,7 +9974,7 @@ int32_t ExtInit(void)
{ {
int32_t rv = 0; int32_t rv = 0;
OSD_SetParameters(0, 2, 0, 0, 4, 0, OSD_ERROR, OSDTEXT_RED); OSD_SetParameters(0, 2, 0, 0, 4, 0, OSD_ERROR, OSDTEXT_RED, 0);
set_memerr_handler(&M32_HandleMemErr); set_memerr_handler(&M32_HandleMemErr);

View file

@ -6103,8 +6103,6 @@ int app_main(int argc, char const * const * argv)
G_ExtPreInit(argc, argv); G_ExtPreInit(argc, argv);
OSD_SetParameters(0,0, 0,12, 2,12, OSD_ERROR, OSDTEXT_RED);
#ifdef __APPLE__ #ifdef __APPLE__
if (!g_useCwd) if (!g_useCwd)
{ {
@ -6394,6 +6392,7 @@ int app_main(int argc, char const * const * argv)
Bsprintf(tempbuf, HEAD2 " %s", s_buildRev); Bsprintf(tempbuf, HEAD2 " %s", s_buildRev);
OSD_SetVersion(tempbuf, 10,0); OSD_SetVersion(tempbuf, 10,0);
OSD_SetParameters(0, 0, 0, 12, 2, 12, OSD_ERROR, OSDTEXT_RED, gamefunctions[gamefunc_Show_Console][0] == '\0' ? OSD_PROTECTED : 0);
registerosdcommands(); registerosdcommands();
if (g_networkMode != NET_DEDICATED_SERVER) if (g_networkMode != NET_DEDICATED_SERVER)