commit a72890d4d15a8b5b316c23ff68def3c8b805b4df
Author: Simon Howard <fraggle@soulsphere.org>
AuthorDate: Tue Jan 5 22:33:02 2016 +0100
Commit: Simon Howard <fraggle@soulsphere.org>
CommitDate: Tue Jan 5 22:33:02 2016 +0100
heretic: Convert chat/menu to use new input interface.
Call I_StartTextInput(), etc.
---
src/heretic/ct_chat.c | 7 +++++--
src/heretic/mn_menu.c | 21 ++++++++++++++++++++-
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/src/heretic/ct_chat.c b/src/heretic/ct_chat.c
index 66611890..6e2763f8 100644
--- a/src/heretic/ct_chat.c
+++ b/src/heretic/ct_chat.c
@@ -24,6 +24,7 @@
#include "doomkeys.h"
#include "deh_str.h"
+#include "i_input.h"
#include "m_controls.h"
#include "m_misc.h"
#include "p_local.h"
@@ -115,6 +116,7 @@ void CT_Init(void)
void CT_Stop(void)
{
chatmodeon = false;
+ I_StopTextInput();
return;
}
@@ -191,6 +193,7 @@ boolean CT_Responder(event_t * ev)
}
CT_queueChatChar(sendto);
chatmodeon = true;
+ I_StartTextInput(25, 10, SCREENWIDTH, 18);
return true;
}
else
@@ -232,9 +235,9 @@ boolean CT_Responder(event_t * ev)
CT_queueChatChar(KEY_BACKSPACE);
return true;
}
- else if (ValidChatChar(ev->data2))
+ else if (ValidChatChar(ev->data3))
{
- CT_queueChatChar(toupper(ev->data2));
+ CT_queueChatChar(toupper(ev->data3));
return true;
}
}
diff --git a/src/heretic/mn_menu.c b/src/heretic/mn_menu.c
index 4cd52a0d..16d97d64 100644
--- a/src/heretic/mn_menu.c
+++ b/src/heretic/mn_menu.c
@@ -22,6 +22,7 @@
#include "deh_str.h"
#include "doomdef.h"
#include "doomkeys.h"
+#include "i_input.h"
#include "i_system.h"
#include "i_swap.h"
#include "m_controls.h"
@@ -847,7 +848,15 @@ static boolean SCSaveGame(int option)
if (!FileMenuKeySteal)
{
+ int x, y;
+
FileMenuKeySteal = true;
+ // We need to activate the text input interface to type the save
+ // game name:
+ x = SaveMenu.x + 1;
+ y = SaveMenu.y + 1 + option * ITEM_HEIGHT;
+ I_StartTextInput(x, y, x + 190, y + ITEM_HEIGHT - 2);
+
M_StringCopy(oldSlotText, SlotText[option], sizeof(oldSlotText));
ptr = SlotText[option];
while (*ptr)
@@ -865,6 +874,7 @@ static boolean SCSaveGame(int option)
{
G_SaveGame(option, SlotText[option]);
FileMenuKeySteal = false;
+ I_StopTextInput();
MN_DeactivateMenu();
}
BorderNeedRefresh = true;
@@ -1503,7 +1513,12 @@ boolean MN_Responder(event_t * event)
return (false);
}
else
- { // Editing file names
+ {
+ // Editing file names
+ // When typing a savegame name, we use the fully shifted and
+ // translated input value from event->data3.
+ charTyped = event->data3;
+
textBuffer = &SlotText[currentSlot][slotptr];
if (key == KEY_BACKSPACE)
{
@@ -1605,6 +1620,10 @@ void MN_DeactivateMenu(void)
CurrentMenu->oldItPos = CurrentItPos;
}
MenuActive = false;
+ if (FileMenuKeySteal)
+ {
+ I_StopTextInput();
+ }
if (!netgame)
{
paused = false;