From 34b18815286938176b0462ba5a97ea03195409fb Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 22 Mar 2020 17:23:40 +0300 Subject: CGame::Initialise --- src/render/Console.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/render/Console.cpp (limited to 'src/render/Console.cpp') diff --git a/src/render/Console.cpp b/src/render/Console.cpp new file mode 100644 index 00000000..b4a10e54 --- /dev/null +++ b/src/render/Console.cpp @@ -0,0 +1,43 @@ +#include "Console.h" + +#include "Font.h" +#include "Timer.h" + +#define CONSOLE_MESSAGE_SHOW_TIME 20000 +#define CONSOLE_MESSAGE_HEIGHT 12.0f +#define CONSOLE_MESSAGE_X_OFFSET 30.0f +#define CONSOLE_MESSAGE_Y_OFFSET 10.0f +#define CONSOLE_MESSAGE_X_SHADOW_OFFSET 1.0f +#define CONSOLE_MESSAGE_Y_SHADOW_OFFSET 1.0f + +CConsole& TheConsole = *(CConsole*)0x8F6498; + +void CConsole::Display() +{ + CFont::SetPropOn(); + CFont::SetBackgroundOff(); + CFont::SetScale(0.6f, 0.6f); + CFont::SetCentreOff(); + CFont::SetRightJustifyOff(); + CFont::SetBackGroundOnlyTextOff(); + CFont::SetFontStyle(0); + CFont::SetPropOff(); + CFont::SetWrapx(RsGlobal.width); + while (m_nActiveMessages != 0 && CTimer::GetTimeInMilliseconds() - m_anTimeStart[m_nCurrentMessage] > CONSOLE_MESSAGE_SHOW_TIME) { + m_nActiveMessages--; + m_nCurrentMessage = (m_nCurrentMessage + 1) % NUM_CONSOLEMESSAGES; + } + for (int i = 0; i < m_nActiveMessages; i++) { + int actualIndex = (i + m_nCurrentMessage) % NUM_CONSOLEMESSAGES; + CFont::SetColor(CRGBA(0, 0, 0, 200)); + CFont::PrintString( + CONSOLE_MESSAGE_X_OFFSET + CONSOLE_MESSAGE_X_SHADOW_OFFSET, + CONSOLE_MESSAGE_Y_OFFSET + CONSOLE_MESSAGE_Y_SHADOW_OFFSET + i * CONSOLE_MESSAGE_HEIGHT, + m_asMessages[actualIndex]); + CFont::SetColor(CRGBA(m_anColourRed[actualIndex], m_anColourGreen[actualIndex], m_anColourBlue[actualIndex], 200)); + CFont::PrintString( + CONSOLE_MESSAGE_X_OFFSET, + CONSOLE_MESSAGE_Y_OFFSET + i * CONSOLE_MESSAGE_HEIGHT, + m_asMessages[actualIndex]); + } +} \ No newline at end of file -- cgit v1.2.3 From d1d123dc6aeaa88702672c181377735e1b66125f Mon Sep 17 00:00:00 2001 From: Nikolay Korolev Date: Sun, 22 Mar 2020 19:19:07 +0300 Subject: missing endlines --- src/render/Console.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/render/Console.cpp') diff --git a/src/render/Console.cpp b/src/render/Console.cpp index 7f783264..d4940955 100644 --- a/src/render/Console.cpp +++ b/src/render/Console.cpp @@ -92,4 +92,4 @@ cprintf(char* format, ...) va_copy(vl2, vl1); vsprintf(s, format, vl1); TheConsole.AddLine(s, 255, 255, 128); -} \ No newline at end of file +} -- cgit v1.2.3