diff --git a/source/common/engine/d_event.cpp b/source/common/engine/d_event.cpp index b42761254..5f0db5418 100644 --- a/source/common/engine/d_event.cpp +++ b/source/common/engine/d_event.cpp @@ -77,8 +77,6 @@ void D_ProcessEvents (void) continue; // console ate the event if (M_Responder (ev)) continue; // menu ate the event - if (Cheat_Responder(ev)) - continue; G_Responder (ev); } } diff --git a/source/core/console/d_event.cpp b/source/core/console/d_event.cpp index 1dd17eae4..55b2f82c9 100644 --- a/source/core/console/d_event.cpp +++ b/source/core/console/d_event.cpp @@ -41,6 +41,7 @@ #include "menu.h" #include "gamestate.h" #include "gamecontrol.h" +#include "uiinput.h" //========================================================================== // @@ -76,7 +77,6 @@ bool AM_Responder (event_t *ev, bool last) } - //========================================================================== // // G_Responder @@ -86,6 +86,11 @@ bool AM_Responder (event_t *ev, bool last) bool G_Responder (event_t *ev) { + if (CT_Responder(ev)) + return true; // chat ate the event + if (Cheat_Responder(ev)) + return true; + if (gamestate == GS_LEVEL && automapMode != am_off && AM_Responder(ev, false)) return true; switch (ev->type) diff --git a/source/core/ct_chat.cpp b/source/core/ct_chat.cpp index 561111f2c..049178dd4 100644 --- a/source/core/ct_chat.cpp +++ b/source/core/ct_chat.cpp @@ -37,6 +37,8 @@ #include "c_buttons.h" #include "v_draw.h" #include "menu.h" +#include "gamestruct.h" +#include "gamecvars.h" enum { @@ -69,32 +71,8 @@ static bool DoSubstitution (FString &out, const char *in); static TArray ChatQueue; -#if 0 -CVAR (String, chatmacro1, "I'm ready to kick butt!", CVAR_ARCHIVE) -CVAR (String, chatmacro2, "I'm OK.", CVAR_ARCHIVE) -CVAR (String, chatmacro3, "I'm not looking too good!", CVAR_ARCHIVE) -CVAR (String, chatmacro4, "Help!", CVAR_ARCHIVE) -CVAR (String, chatmacro5, "You suck!", CVAR_ARCHIVE) -CVAR (String, chatmacro6, "Next time, scumbag...", CVAR_ARCHIVE) -CVAR (String, chatmacro7, "Come here!", CVAR_ARCHIVE) -CVAR (String, chatmacro8, "I'll take care of it.", CVAR_ARCHIVE) -CVAR (String, chatmacro9, "Yes", CVAR_ARCHIVE) -CVAR (String, chatmacro0, "No", CVAR_ARCHIVE) +extern FStringCVar* const CombatMacros[]; -FStringCVar *chat_macros[10] = -{ - &chatmacro0, - &chatmacro1, - &chatmacro2, - &chatmacro3, - &chatmacro4, - &chatmacro5, - &chatmacro6, - &chatmacro7, - &chatmacro8, - &chatmacro9 -}; -#endif CVAR (Bool, chat_substitution, false, CVAR_ARCHIVE) @@ -175,14 +153,12 @@ bool CT_Responder (event_t *ev) else if (ev->subtype == EV_GUI_Char) { // send a macro -#if 0 if (ev->data2 && (ev->data1 >= '0' && ev->data1 <= '9')) { - ShoveChatStr (*chat_macros[ev->data1 - '0'], chatmodeon - 1); + ShoveChatStr (*CombatMacros[ev->data1 - '0'], chatmodeon - 1); CT_Stop (); } else -#endif { CT_AddChar (ev->data1); } @@ -238,17 +214,15 @@ void CT_Drawer (void) FStringf prompt("%s ", GStrings("TXT_SAY")); int x, scalex, y, promptwidth; - y = -displayfont->GetHeight()-2; scalex = 1; int scale = active_con_scale(drawer); int screen_width = twod->GetWidth() / scale; int screen_height= twod->GetHeight() / scale; -#if 0 // stuff for later - int st_y = StatusBar->GetTopOfStatusbar() / scale; + + y = screen_height - displayfont->GetHeight()-2; + auto res = gi->GetReservedScreenSpace(hud_size); - y += ((twod->GetHeight() == viewheight && viewactive) || gamestate != GS_LEVEL) ? screen_height : st_y; -#endif promptwidth = displayfont->StringWidth (prompt) * scalex; x = displayfont->GetCharWidth (displayfont->GetCursor()) * scalex * 2 + promptwidth; @@ -264,6 +238,7 @@ void CT_Drawer (void) } printstr += displayfont->GetCursor(); + twod->AddColorOnlyQuad(0, y, screen_width, screen_height, 0x80000000); DrawText(drawer, displayfont, CR_GREEN, 0, y, prompt.GetChars(), DTA_VirtualWidth, screen_width, DTA_VirtualHeight, screen_height, DTA_KeepRatio, true, TAG_DONE); DrawText(drawer, displayfont, CR_GREY, promptwidth, y, printstr, @@ -358,6 +333,15 @@ static void ShoveChatStr (const char *str, uint8_t who) { Net_WriteString(MakeUTF8(substBuff)); } +#else + if (*str == '#') + { + C_DoCommand(FStringf("activatecheat %s", str + 1)); + } + else + { + Printf("%s %s\n", GStrings("TXT_SAY"), str); + } #endif } diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index 8ece80e17..e01ff0f9d 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -68,6 +68,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "menustate.h" #include "screenjob.h" #include "statusbar.h" +#include "uiinput.h" CVAR(Bool, autoloadlights, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR(Bool, autoloadbrightmaps, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) @@ -899,6 +900,7 @@ void app_loop() // Draw overlay elements to the 2D drawer FStat::PrintStat(twod); + CT_Drawer(); C_DrawConsole(); M_Drawer(); diff --git a/source/core/menu/menu.cpp b/source/core/menu/menu.cpp index 59c3a0e5a..7794c1dd2 100644 --- a/source/core/menu/menu.cpp +++ b/source/core/menu/menu.cpp @@ -660,12 +660,10 @@ bool M_DoResponder (event_t *ev) int mkey = NUM_MKEYS; bool fromcontroller = true; - /* if (chatmodeon) { return false; } - */ if (CurrentMenu != NULL && menuactive != MENU_Off) {