From 756a743974e9971a93d8d690c88550ae08ce8a55 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 11 Apr 2020 18:06:13 +0200 Subject: [PATCH] - uncouple console's cursor blinking from the game ticker. This is now done in real time by the drawer. --- src/console/c_console.cpp | 17 +++++++++-------- src/console/c_console.h | 2 -- src/console/c_dispatch.cpp | 3 ++- src/d_main.cpp | 1 - 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/console/c_console.cpp b/src/console/c_console.cpp index ad042f397..174461aaa 100644 --- a/src/console/c_console.cpp +++ b/src/console/c_console.cpp @@ -65,6 +65,7 @@ #include "vm.h" #include "utf8.h" #include "s_music.h" +#include "i_time.h" #include "gi.h" @@ -108,7 +109,7 @@ int ConWidth; bool vidactive = false; bool cursoron = false; int ConBottom, ConScroll, RowAdjust; -int CursorTicker; +uint64_t CursorTicker; constate_e ConsoleState = c_up; @@ -1036,12 +1037,6 @@ void C_Ticker() } } - if (--CursorTicker <= 0) - { - cursoron ^= 1; - CursorTicker = C_BLINKRATE; - } - lasttic = consoletic; NotifyStrings.Tick(); } @@ -1239,6 +1234,12 @@ void C_DrawConsole () { if (gamestate != GS_STARTUP) { + auto now = I_msTime(); + if (now > CursorTicker) + { + CursorTicker = now + 500; + cursoron = !cursoron; + } CmdLine.Draw(left, bottomline, textScale, cursoron); } if (RowAdjust && ConBottom >= CurrentConsoleFont->GetHeight()*7/2) @@ -1712,7 +1713,7 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer) buffer.AppendToYankBuffer = keepappending; // Ensure that the cursor is always visible while typing - CursorTicker = C_BLINKRATE; + CursorTicker = I_msTime() + 500; cursoron = 1; return true; } diff --git a/src/console/c_console.h b/src/console/c_console.h index eea8c98ca..e88ef0aa6 100644 --- a/src/console/c_console.h +++ b/src/console/c_console.h @@ -39,8 +39,6 @@ struct event_t; -#define C_BLINKRATE (TICRATE/2) - typedef enum cstate_t { c_up=0, c_down=1, c_falling=2, c_rising=3 diff --git a/src/console/c_dispatch.cpp b/src/console/c_dispatch.cpp index 520ab0fad..5193cb104 100644 --- a/src/console/c_dispatch.cpp +++ b/src/console/c_dispatch.cpp @@ -171,6 +171,7 @@ static FConsoleCommand *ScanChainForName (FConsoleCommand *start, const char *na // PUBLIC DATA DEFINITIONS ------------------------------------------------- bool ParsingKeyConf, UnsafeExecutionContext; +FString StoredWarp; FConsoleCommand* Commands[FConsoleCommand::HASH_SIZE]; @@ -1087,7 +1088,7 @@ bool C_ExecFile (const char *file) exec->ExecCommands(); if (exec->Pullins.Size() > 0) { - Printf(TEXTCOLOR_RED "Notice: Pullin files were ignored.\n"); + Printf(TEXTCOLOR_BOLD "Notice: Pullin files were ignored.\n"); } delete exec; } diff --git a/src/d_main.cpp b/src/d_main.cpp index 498e6edaf..78025c2ac 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -252,7 +252,6 @@ int NoWipe; // [RH] Allow wipe? (Needs to be set each time) bool singletics = false; // debug flag to cancel adaptiveness FString startmap; bool autostart; -FString StoredWarp; bool advancedemo; FILE *debugfile; FILE *hashfile;