mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +00:00
- backend update
This commit is contained in:
parent
570897005c
commit
273ad5e133
8 changed files with 81 additions and 71 deletions
|
@ -77,9 +77,6 @@ void C_HideConsole (void);
|
|||
void C_AdjustBottom (void);
|
||||
void C_FlushDisplay (void);
|
||||
|
||||
class FFont;
|
||||
void C_MidPrint (FFont *font, const char *message, bool bold = false);
|
||||
|
||||
bool C_Responder (event_t *ev);
|
||||
|
||||
void C_SetNotifyFontScale(double scale);
|
||||
|
|
|
@ -26,6 +26,7 @@ struct SystemCallbacks
|
|||
int (*GetGender)();
|
||||
void (*MenuClosed)();
|
||||
bool (*CheckMenudefOption)(const char* opt);
|
||||
void (*ConsoleToggled)(int state);
|
||||
};
|
||||
|
||||
extern SystemCallbacks sysCallbacks;
|
||||
|
|
|
@ -637,18 +637,6 @@ DEFINE_ACTION_FUNCTION(DOptionMenuItemCommand, DoCommand)
|
|||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Console, MidPrint)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_POINTER(fnt, FFont);
|
||||
PARAM_STRING(text);
|
||||
PARAM_BOOL(bold);
|
||||
|
||||
const char* txt = text[0] == '$' ? GStrings(&text[1]) : text.GetChars();
|
||||
C_MidPrint(fnt, txt, bold);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(_Console, HideConsole)
|
||||
{
|
||||
C_HideConsole();
|
||||
|
|
|
@ -1012,37 +1012,25 @@ void C_DrawConsole ()
|
|||
|
||||
void C_FullConsole ()
|
||||
{
|
||||
/*
|
||||
if (hud_toggled)
|
||||
D_ToggleHud();
|
||||
if (demoplayback)
|
||||
G_CheckDemoStatus ();
|
||||
D_QuitNetGame ();
|
||||
advancedemo = false;
|
||||
*/
|
||||
ConsoleState = c_down;
|
||||
HistPos = NULL;
|
||||
TabbedLast = false;
|
||||
TabbedList = false;
|
||||
if (gamestate != GS_STARTUP)
|
||||
{
|
||||
gamestate = GS_FULLCONSOLE;
|
||||
Mus_Stop();
|
||||
}
|
||||
C_AdjustBottom ();
|
||||
}
|
||||
|
||||
|
||||
void C_ToggleConsole ()
|
||||
{
|
||||
int togglestate;
|
||||
if (gamestate == GS_INTRO) // blocked
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (gamestate == GS_MENUSCREEN)
|
||||
{
|
||||
gamestate = GS_FULLCONSOLE;
|
||||
C_FullConsole();
|
||||
gameaction = ga_fullconsole;
|
||||
togglestate = c_down;
|
||||
}
|
||||
else if (!chatmodeon && (ConsoleState == c_up || ConsoleState == c_rising) && menuactive == MENU_Off)
|
||||
{
|
||||
|
@ -1050,13 +1038,17 @@ void C_ToggleConsole ()
|
|||
HistPos = NULL;
|
||||
TabbedLast = false;
|
||||
TabbedList = false;
|
||||
|
||||
togglestate = c_falling;
|
||||
}
|
||||
else if (gamestate != GS_FULLCONSOLE && gamestate != GS_STARTUP)
|
||||
{
|
||||
ConsoleState = c_rising;
|
||||
C_FlushDisplay ();
|
||||
C_FlushDisplay();
|
||||
togglestate = c_rising;
|
||||
}
|
||||
else return;
|
||||
// This must be done as an event callback because the client code does not control the console toggling.
|
||||
if (sysCallbacks.ConsoleToggled) sysCallbacks.ConsoleToggled(togglestate);
|
||||
}
|
||||
|
||||
void C_HideConsole ()
|
||||
|
@ -1500,40 +1492,3 @@ CCMD(toggleconsole)
|
|||
C_ToggleConsole();
|
||||
}
|
||||
|
||||
/* Printing in the middle of the screen */
|
||||
|
||||
CVAR(Float, con_midtime, 3.f, CVAR_ARCHIVE)
|
||||
|
||||
const char *console_bar = "----------------------------------------";
|
||||
|
||||
void C_MidPrint (FFont *font, const char *msg, bool bold)
|
||||
{
|
||||
#if 0 // The Build engine cannot do this at the moment. Q: Implement and redirect some messages here?
|
||||
if (StatusBar == nullptr || screen == nullptr)
|
||||
return;
|
||||
|
||||
// [MK] allow the status bar to take over MidPrint
|
||||
IFVIRTUALPTR(StatusBar, DBaseStatusBar, ProcessMidPrint)
|
||||
{
|
||||
FString msgstr = msg;
|
||||
VMValue params[] = { (DObject*)StatusBar, font, &msgstr, bold };
|
||||
int rv;
|
||||
VMReturn ret(&rv);
|
||||
VMCall(func, params, countof(params), &ret, 1);
|
||||
if (!!rv) return;
|
||||
}
|
||||
|
||||
if (msg != nullptr)
|
||||
{
|
||||
auto color = (EColorRange)PrintColors[bold? PRINTLEVELS+1 : PRINTLEVELS];
|
||||
Printf(PRINT_HIGH|PRINT_NONOTIFY, TEXTCOLOR_ESCAPESTR "%c%s\n%s\n%s\n", color, console_bar, msg, console_bar);
|
||||
|
||||
StatusBar->AttachMessage (Create<DHUDMessage>(font, msg, 1.5f, 0.375f, 0, 0, color, con_midtime), MAKE_ID('C','N','T','R'));
|
||||
}
|
||||
else
|
||||
{
|
||||
StatusBar->DetachMessage (MAKE_ID('C','N','T','R'));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,8 @@ enum gameaction_t : int
|
|||
ga_nextlevel, // Actually start the next level.
|
||||
ga_loadgamehidecon,
|
||||
ga_newgamenostopsound, // start a new game
|
||||
|
||||
ga_fullconsole,
|
||||
};
|
||||
extern gamestate_t gamestate;
|
||||
extern gameaction_t gameaction;
|
||||
|
|
|
@ -244,6 +244,12 @@ static void GameTicker()
|
|||
gamestate = GS_INTERMISSION;
|
||||
break;
|
||||
|
||||
case ga_fullconsole:
|
||||
C_FullConsole();
|
||||
Mus_Stop();
|
||||
gameaction = ga_nothing;
|
||||
break;
|
||||
|
||||
// for later
|
||||
// case ga_recordgame, // start a new demo recording (later)
|
||||
// case ga_loadgameplaydemo, // load a savegame and play a demo.
|
||||
|
|
|
@ -493,7 +493,6 @@ struct Font native
|
|||
struct Console native
|
||||
{
|
||||
native static void HideConsole();
|
||||
native static void MidPrint(Font fontname, string textlabel, bool bold = false);
|
||||
native static vararg void Printf(string fmt, ...);
|
||||
}
|
||||
|
||||
|
|
|
@ -1234,3 +1234,65 @@ class OptionMenuItemScaleSlider : OptionMenuItemSlider
|
|||
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// Flag option by Accensus
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
class OptionMenuItemFlagOption : OptionMenuItemOption
|
||||
{
|
||||
int mBitShift;
|
||||
|
||||
OptionMenuItemFlagOption Init(String label, Name command, Name values, int bitShift, CVar greycheck = null, int center = 0)
|
||||
{
|
||||
Super.Init(label, command, values, greycheck, center);
|
||||
mBitShift = bitShift;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
override int GetSelection()
|
||||
{
|
||||
int Selection = 0;
|
||||
int cnt = OptionValues.GetCount(mValues);
|
||||
if (cnt > 0 && mCVar != null)
|
||||
{
|
||||
if (OptionValues.GetTextValue(mValues, 0).Length() == 0)
|
||||
{
|
||||
int CurrentFlags = mCVar.GetInt();
|
||||
|
||||
for (int i = 0; i < cnt; i++)
|
||||
{
|
||||
int OptionValue = int(OptionValues.GetValue(mValues, i));
|
||||
if (CurrentFlags & (OptionValue << mBitShift))
|
||||
{
|
||||
Selection = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Selection;
|
||||
}
|
||||
|
||||
override void SetSelection(int Selection)
|
||||
{
|
||||
int cnt = OptionValues.GetCount(mValues);
|
||||
if (cnt > 0 && mCVar != null)
|
||||
{
|
||||
if (OptionValues.GetTextValue(mValues, 0).Length() == 0)
|
||||
{
|
||||
int OptionValue = int(OptionValues.GetValue(mValues, Selection));
|
||||
int CurrentFlags = mCVar.GetInt();
|
||||
|
||||
switch (OptionValue)
|
||||
{
|
||||
case 0: CurrentFlags &= ~(1 << mBitShift); break;
|
||||
case 1: CurrentFlags |= (1 << mBitShift); break;
|
||||
}
|
||||
mCVar.SetInt(CurrentFlags);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue