mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-01-31 04:50:48 +00:00
- update of console code.
Backports con_pulsetext and toggle messages for CVARs from Raze.
This commit is contained in:
parent
c415518066
commit
700304bf46
10 changed files with 44 additions and 7 deletions
|
@ -739,7 +739,7 @@ void C_SetDefaultKeys(const char* baseconfig)
|
|||
//
|
||||
//
|
||||
//=============================================================================
|
||||
CVAR(Int, cl_defaultconfiguration, 2, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CVAR(Int, cl_defaultconfiguration, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
||||
|
||||
void C_BindDefaults()
|
||||
|
|
|
@ -87,7 +87,6 @@ public:
|
|||
extern FKeyBindings Bindings;
|
||||
extern FKeyBindings DoubleBindings;
|
||||
extern FKeyBindings AutomapBindings;
|
||||
extern FKeyBindings MenuBindings;
|
||||
|
||||
|
||||
bool C_DoKey (event_t *ev, FKeyBindings *binds, FKeyBindings *doublebinds);
|
||||
|
|
|
@ -57,6 +57,7 @@ extern constate_e ConsoleState;
|
|||
void C_InitConsole (int width, int height, bool ingame);
|
||||
void C_DeinitConsole ();
|
||||
void C_InitConback();
|
||||
void C_ClearMessages();
|
||||
|
||||
// Adjust the console for a new screen mode
|
||||
void C_NewModeAdjust (void);
|
||||
|
@ -83,6 +84,7 @@ bool C_Responder (event_t *ev);
|
|||
void C_AddTabCommand (const char *name);
|
||||
void C_RemoveTabCommand (const char *name);
|
||||
void C_ClearTabCommands(); // Removes all tab commands
|
||||
void C_SetNotifyFontScale(double scale);
|
||||
|
||||
extern const char *console_bar;
|
||||
|
||||
|
|
|
@ -1519,7 +1519,12 @@ CCMD (toggle)
|
|||
val = var->GetGenericRep (CVAR_Bool);
|
||||
val.Bool = !val.Bool;
|
||||
var->SetGenericRep (val, CVAR_Bool);
|
||||
Printf ("\"%s\" = \"%s\"\n", var->GetName(),
|
||||
auto msg = var->GetToggleMessage(val.Bool);
|
||||
if (msg.IsNotEmpty())
|
||||
{
|
||||
Printf(PRINT_NOTIFY, "%s\n", msg.GetChars());
|
||||
}
|
||||
else Printf ("\"%s\" = \"%s\"\n", var->GetName(),
|
||||
val.Bool ? "true" : "false");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -176,6 +176,13 @@ public:
|
|||
static void ListVars (const char *filter, bool plain);
|
||||
|
||||
const FString &GetDescription() const { return Description; };
|
||||
const FString& GetToggleMessage(int which) { return ToggleMessages[which]; }
|
||||
void SetToggleMessages(const char* on, const char* off)
|
||||
{
|
||||
ToggleMessages[0] = off;
|
||||
ToggleMessages[1] = on;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
virtual void DoSet (UCVarValue value, ECVarType type) = 0;
|
||||
|
@ -192,13 +199,13 @@ protected:
|
|||
FString VarName;
|
||||
FString SafeValue;
|
||||
FString Description;
|
||||
FString ToggleMessages[2];
|
||||
uint32_t Flags;
|
||||
bool inCallback = false;
|
||||
|
||||
private:
|
||||
FBaseCVar (const FBaseCVar &var) = delete;
|
||||
FBaseCVar (const char *name, uint32_t flags);
|
||||
|
||||
void (*m_Callback)(FBaseCVar &);
|
||||
FBaseCVar *m_Next;
|
||||
|
||||
|
|
|
@ -1123,7 +1123,7 @@ int C_RegisterFunction(const char* pszName, const char* pszDesc, int (*func)(CCm
|
|||
{
|
||||
if (args.argc() > 0) args.operator[](0);
|
||||
CCmdFuncParm param = { args.argc() - 1, nname.GetChars(), (const char**)args._argv + 1, args.cmd };
|
||||
if (func(¶m) != CCMD_OK)
|
||||
if (func(¶m) != CCMD_OK && pszDesc)
|
||||
{
|
||||
Printf("%s\n", pszDesc);
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ extern bool ParsingKeyConf, UnsafeExecutionContext;
|
|||
extern FString StoredWarp; // [RH] +warp at the command line
|
||||
|
||||
|
||||
extern bool CheckCheatmode (bool printmsg = true);
|
||||
extern bool CheckCheatmode (bool printmsg = true, bool sponly = false);
|
||||
|
||||
FExecList *C_ParseCmdLineParams(FExecList *exec);
|
||||
|
||||
|
|
|
@ -53,6 +53,9 @@ enum EKeyCodes
|
|||
KEY_PGUP = 0xc9, // DIK_PRIOR
|
||||
KEY_PGDN = 0xd1, // DIK_NEXT
|
||||
|
||||
KEY_VOLUMEDOWN = 0xAE, // DIK_VOLUMEDOWN
|
||||
KEY_VOLUMEUP = 0xB0, // DIK_VOLUMEUP
|
||||
|
||||
KEY_FIRSTMOUSEBUTTON = 0x100,
|
||||
KEY_MOUSE1 = 0x100,
|
||||
KEY_MOUSE2 = 0x101,
|
||||
|
|
|
@ -87,8 +87,13 @@ CCMD (toggleconsole)
|
|||
C_ToggleConsole();
|
||||
}
|
||||
|
||||
bool CheckCheatmode (bool printmsg)
|
||||
bool CheckCheatmode (bool printmsg, bool sponly)
|
||||
{
|
||||
if (sponly && netgame)
|
||||
{
|
||||
if (printmsg) Printf("Not in a singleplayer game.\n");
|
||||
return true;
|
||||
}
|
||||
if ((G_SkillProperty(SKILLP_DisableCheats) || netgame || deathmatch) && (!sv_cheats))
|
||||
{
|
||||
if (printmsg) Printf ("sv_cheats must be true to enable this command.\n");
|
||||
|
|
|
@ -114,6 +114,12 @@ int ConBottom, ConScroll, RowAdjust;
|
|||
uint64_t CursorTicker;
|
||||
constate_e ConsoleState = c_up;
|
||||
|
||||
double NotifyFontScale = 1;
|
||||
|
||||
void C_SetNotifyFontScale(double scale)
|
||||
{
|
||||
NotifyFontScale = scale;
|
||||
}
|
||||
|
||||
static int TopLine, InsertLine;
|
||||
|
||||
|
@ -145,6 +151,7 @@ CUSTOM_CVAR(Int, con_scaletext, 0, CVAR_ARCHIVE) // Scale notify text at high r
|
|||
{
|
||||
if (self < 0) self = 0;
|
||||
}
|
||||
CVAR(Bool, con_pulsetext, false, CVAR_ARCHIVE)
|
||||
|
||||
CUSTOM_CVAR(Int, con_scale, 0, CVAR_ARCHIVE)
|
||||
{
|
||||
|
@ -931,6 +938,11 @@ int PrintString (int iprintlevel, const char *outline)
|
|||
return 0; // Don't waste time on calculating this if nothing at all was printed...
|
||||
}
|
||||
|
||||
void C_ClearMessages()
|
||||
{
|
||||
NotifyStrings.Clear();
|
||||
}
|
||||
|
||||
int VPrintf (int printlevel, const char *format, va_list parms)
|
||||
{
|
||||
FString outline;
|
||||
|
@ -1107,6 +1119,10 @@ void FNotifyBuffer::Draw()
|
|||
continue;
|
||||
|
||||
double alpha = (j < NOTIFYFADETIME) ? 1. * j / NOTIFYFADETIME : 1;
|
||||
if (con_pulsetext)
|
||||
{
|
||||
alpha *= 0.7 + 0.3 * sin(I_msTime() / 100.);
|
||||
}
|
||||
|
||||
if (notify.PrintLevel >= PRINTLEVELS)
|
||||
color = CR_UNTRANSLATED;
|
||||
|
|
Loading…
Reference in a new issue