ref: a72890d4d15a8b5b316c23ff68def3c8b805b4df
parent: 92bf6bef31891587d411dbec34452abd084dead9
author: Simon Howard <[email protected]>
date: Tue Jan 5 17:33:02 EST 2016
heretic: Convert chat/menu to use new input interface. Call I_StartTextInput(), etc.
--- 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_Stop(void)
{
chatmodeon = false;
+ I_StopTextInput();
return;
}
@@ -191,6 +193,7 @@
}
CT_queueChatChar(sendto);
chatmodeon = true;
+ I_StartTextInput(25, 10, SCREENWIDTH, 18);
return true;
}
else
@@ -232,9 +235,9 @@
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;
}
}
--- 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 @@
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 @@
{
G_SaveGame(option, SlotText[option]);
FileMenuKeySteal = false;
+ I_StopTextInput();
MN_DeactivateMenu();
}
BorderNeedRefresh = true;
@@ -1503,7 +1513,12 @@
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 @@
CurrentMenu->oldItPos = CurrentItPos;
}
MenuActive = false;
+ if (FileMenuKeySteal)
+ {
+ I_StopTextInput();
+ }
if (!netgame)
{
paused = false;