mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- hooked up the chat display.
Currently not really useful, aside from being usable to enter cheats. For this the cheat must be prefixed with a '#' to be recognized.
This commit is contained in:
parent
cf36e7d770
commit
a55da24277
5 changed files with 25 additions and 38 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<uint8_t> 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
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue