- uncouple console's cursor blinking from the game ticker.

This is now done in real time by the drawer.
This commit is contained in:
Christoph Oelckers 2020-04-11 18:06:13 +02:00
parent 31fbff85f4
commit 756a743974
4 changed files with 11 additions and 12 deletions

View file

@ -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;
}

View file

@ -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

View file

@ -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;
}

View file

@ -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;