From 1b9a2f5932a972655812e2e9d31530567bece260 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 24 Dec 2019 13:21:36 +0100 Subject: [PATCH] - disabled the message entering code. This needs to be replaced with the game independent ZDoom version and hooked up properly, but it of low priority because it's a multiplayer only feature. --- source/CMakeLists.txt | 1 - source/blood/src/controls.cpp | 19 +- source/common/input/input.cpp | 136 -------- source/common/input/input.h | 49 --- source/duke3d/src/anim.cpp | 2 +- source/duke3d/src/d_menu.cpp | 2 +- source/duke3d/src/demo.cpp | 9 +- source/duke3d/src/game.cpp | 60 +++- source/duke3d/src/gameexec.cpp | 2 +- source/duke3d/src/menus.cpp | 2 +- source/duke3d/src/network.cpp | 40 +-- source/duke3d/src/screens.cpp | 2 +- source/duke3d/src/sector.cpp | 2 +- .../input => platform/unix}/i_input.cpp | 0 .../input => platform/unix}/i_joystick.cpp | 0 source/rr/src/anim.cpp | 2 +- source/rr/src/d_menu.cpp | 2 +- source/rr/src/demo.cpp | 9 +- source/rr/src/game.cpp | 11 +- source/rr/src/gameexec.cpp | 2 +- source/rr/src/menus.cpp | 2 +- source/rr/src/net.cpp | 39 +-- source/rr/src/screens.cpp | 2 +- source/rr/src/sector.cpp | 2 +- source/sw/src/anim.cpp | 2 +- source/sw/src/game.cpp | 312 +++++++++--------- source/sw/src/menus.cpp | 2 +- 27 files changed, 237 insertions(+), 476 deletions(-) delete mode 100644 source/common/input/input.cpp delete mode 100644 source/common/input/input.h rename source/{common/input => platform/unix}/i_input.cpp (100%) rename source/{common/input => platform/unix}/i_joystick.cpp (100%) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 81e6f144a..40acb40e8 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -828,7 +828,6 @@ set (PCH_SOURCES #common/input/i_joystick.cpp #common/input/i_input.cpp common/input/m_joy.cpp - common/input/input.cpp common/rendering/v_video.cpp common/rendering/v_framebuffer.cpp diff --git a/source/blood/src/controls.cpp b/source/blood/src/controls.cpp index d689ab47f..eb152ae8a 100644 --- a/source/blood/src/controls.cpp +++ b/source/blood/src/controls.cpp @@ -107,14 +107,6 @@ void ctrlGetInput(void) if (gQuitRequest) gInput.keyFlags.quit = 1; - if (gGameStarted && gInputMode != kInputMessage - && buttonMap.ButtonDown(gamefunc_SendMessage)) - { - buttonMap.ClearButton(gamefunc_SendMessage); - inputState.keyFlushScans(); - gInputMode = kInputMessage; - } - if (buttonMap.ButtonDown(gamefunc_Map_Toggle)) { buttonMap.ClearButton(gamefunc_Map_Toggle); @@ -365,4 +357,15 @@ void ctrlGetInput(void) gInput.strafe = strafe; } +#if 0 +if (gGameStarted && gInputMode != kInputMessage + && buttonMap.ButtonDown(gamefunc_SendMessage)) +{ + buttonMap.ClearButton(gamefunc_SendMessage); + inputState.keyFlushScans(); + gInputMode = kInputMessage; +} + +#endif + END_BLD_NS diff --git a/source/common/input/input.cpp b/source/common/input/input.cpp deleted file mode 100644 index 0fa32494c..000000000 --- a/source/common/input/input.cpp +++ /dev/null @@ -1,136 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ -//------------------------------------------------------------------------- - -#include "gamecontrol.h" -#include "input.h" -#include "inputstate.h" - -char typebuf[TYPEBUFSIZE]; - - -bool mouseInactiveConditional(bool condition) -{ - return condition; -} - -int32_t I_TextSubmit(void) -{ - return - inputState.GetKeyStatus(sc_Enter) - || inputState.GetKeyStatus(sc_kpad_Enter) - || inputState.GetKeyStatus(KEY_MOUSE1) - /*|| (JOYSTICK_GetGameControllerButtons()&(1< 0) - { - inputloc--; - *(t+inputloc) = 0; - } - } - else - { - if (ch == asc_Enter) - { - I_AdvanceTriggerClear(); - return 1; - } - else if (ch == asc_Escape) - { - I_ReturnTriggerClear(); - return -1; - } - else if (ch >= 32 && inputloc < maxlength && ch < 127) - { - if (!(flags & INPUT_NUMERIC) || (ch >= '0' && ch <= '9')) - { - // JBF 20040508: so we can have numeric only if we want - *(t+inputloc) = ch; - *(t+inputloc+1) = 0; - inputloc++; - } - } - } - } - - if (I_TextSubmit()) - { - I_TextSubmitClear(); - return 1; - } - if (I_ReturnTrigger()) - { - I_ReturnTriggerClear(); - return -1; - } - - return 0; -} - diff --git a/source/common/input/input.h b/source/common/input/input.h deleted file mode 100644 index 3e27bcf8a..000000000 --- a/source/common/input/input.h +++ /dev/null @@ -1,49 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ -//------------------------------------------------------------------------- - -#ifndef input_h_ -#define input_h_ - - -enum { - TYPEBUFSIZE = 141 -}; -extern char typebuf[TYPEBUFSIZE]; - - - -// Advance = Selecting a menu option || Saying "Yes" || Going forward in Help/Credits -// Return = Closing a sub-menu || Saying "No" -// General = Advance + Return = Skipping screens -// Escape = Opening the menu in-game (should not be any gamefuncs) - -extern int32_t I_AdvanceTrigger(void); -extern void I_AdvanceTriggerClear(void); - - -enum EnterTextFlags_t { - INPUT_NUMERIC = 0x00000001, -}; - -extern int32_t I_EnterText(char *t, int32_t maxlength, int32_t flags); - -#endif diff --git a/source/duke3d/src/anim.cpp b/source/duke3d/src/anim.cpp index 5486be86a..4b1ed8b2d 100644 --- a/source/duke3d/src/anim.cpp +++ b/source/duke3d/src/anim.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "duke3d.h" #include "animlib.h" #include "compat.h" -#include "input.h" + #include "anim.h" diff --git a/source/duke3d/src/d_menu.cpp b/source/duke3d/src/d_menu.cpp index eb1a93fa6..1fba2d603 100644 --- a/source/duke3d/src/d_menu.cpp +++ b/source/duke3d/src/d_menu.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "compat.h" #include "demo.h" #include "duke3d.h" -#include "input.h" + #include "menus.h" #include "osdcmds.h" #include "savegame.h" diff --git a/source/duke3d/src/demo.cpp b/source/duke3d/src/demo.cpp index c592df775..2f018cb6d 100644 --- a/source/duke3d/src/demo.cpp +++ b/source/duke3d/src/demo.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "demo.h" #include "duke3d.h" -#include "input.h" + #include "menus.h" #include "savegame.h" #include "screens.h" @@ -879,13 +879,6 @@ nextdemo_nomenu: { ControlInfo noshareinfo; CONTROL_GetInput(&noshareinfo); - if (buttonMap.ButtonDown(gamefunc_SendMessage)) - { - inputState.keyFlushChars(); - buttonMap.ClearButton(gamefunc_SendMessage); - g_player[myconnectindex].ps->gm = MODE_TYPE; - typebuf[0] = 0; - } } } diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index 47efa7cc1..e5d221aca 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "savegame.h" #include "anim.h" #include "demo.h" -#include "input.h" + #include "colmatch.h" #include "cheats.h" #include "sbar.h" @@ -4637,14 +4637,6 @@ void G_HandleLocalKeys(void) } else { - if ((g_netServer || ud.multimode > 1) && buttonMap.ButtonDown(gamefunc_SendMessage)) - { - inputState.keyFlushChars(); - buttonMap.ClearButton(gamefunc_SendMessage); - myplayer.gm |= MODE_TYPE; - typebuf[0] = 0; - } - if (buttonMap.ButtonDown(gamefunc_Third_Person_View)) { buttonMap.ClearButton(gamefunc_Third_Person_View); @@ -6431,6 +6423,56 @@ void A_SpawnRandomGlass(int spriteNum, int wallNum, int glassCnt) } #endif +#if 0 +void GameInterface::SendMessage(const char* msg) +{ + if ((g_netServer || ud.multimode > 1) && buttonMap.ButtonDown(gamefunc_SendMessage)) + { + inputState.keyFlushChars(); + buttonMap.ClearButton(gamefunc_SendMessage); + myplayer.gm |= MODE_TYPE; + typebuf[0] = 0; + } +} + else + { + int32_t const hitstate = I_EnterText(typebuf, 120, 0); + + int32_t const y = ud.screen_size > 1 ? (200 - 58) << 16 : (200 - 35) << 16; + + int32_t const width = mpgametextsize(typebuf, TEXT_LITERALESCAPE).x; + int32_t const fullwidth = width + textsc((tilesiz[SPINNINGNUKEICON].x << 15) + (2 << 16)); + int32_t const text_x = fullwidth >= (320 << 16) ? (320 << 16) - fullwidth : mpgametext_x; + mpgametext(text_x, y, typebuf, 1, 2 | 8 | 16 | ROTATESPRITE_FULL16, 0, TEXT_YCENTER | TEXT_LITERALESCAPE); + int32_t const cursor_x = text_x + width + textsc((tilesiz[SPINNINGNUKEICON].x << 14) + (1 << 16)); + rotatesprite_fs(cursor_x, y, textsc(32768), 0, SPINNINGNUKEICON + (((int32_t)totalclock >> 3) % 7), + 4 - (sintable[((int32_t)totalclock << 4) & 2047] >> 11), 0, 2 | 8); + + if (hitstate == 1) + { + inputState.ClearKeyStatus(sc_Enter); + if (Bstrlen(typebuf) == 0) + { + g_player[myconnectindex].ps->gm &= ~(MODE_TYPE | MODE_SENDTOWHOM); + return; + } + if (cl_automsg) + { + if (SHIFTS_IS_PRESSED) + g_chatPlayer = -1; + else + g_chatPlayer = ud.multimode; + } + g_player[myconnectindex].ps->gm |= MODE_SENDTOWHOM; + } + else if (hitstate == -1) + g_player[myconnectindex].ps->gm &= ~(MODE_TYPE | MODE_SENDTOWHOM); + else + pub = NUMPAGES; + } + +#endif + ::GameInterface* CreateInterface() { return new GameInterface; diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index 665ba2390..c74162c37 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "colmatch.h" #include "compat.h" #include "duke3d.h" -#include "input.h" + #include "menus.h" #include "osdcmds.h" #include "savegame.h" diff --git a/source/duke3d/src/menus.cpp b/source/duke3d/src/menus.cpp index a57589d3c..caa23f7f9 100644 --- a/source/duke3d/src/menus.cpp +++ b/source/duke3d/src/menus.cpp @@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "compat.h" #include "demo.h" #include "duke3d.h" -#include "input.h" + #include "menus.h" #include "osdcmds.h" #include "savegame.h" diff --git a/source/duke3d/src/network.cpp b/source/duke3d/src/network.cpp index 614b1a817..e374aed02 100644 --- a/source/duke3d/src/network.cpp +++ b/source/duke3d/src/network.cpp @@ -35,7 +35,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "network.h" #include "premap.h" #include "savegame.h" -#include "input.h" + #include "gamecvars.h" #include "mapinfo.h" @@ -4998,6 +4998,7 @@ void Net_SendClientUpdate(void) void Net_SendMessage(void) { +#if 0 if (g_player[myconnectindex].ps->gm & MODE_SENDTOWHOM) { int32_t i, j; @@ -5110,42 +5111,7 @@ void Net_SendMessage(void) } } } - else - { - int32_t const hitstate = I_EnterText(typebuf, 120, 0); - - int32_t const y = ud.screen_size > 1 ? (200 - 58) << 16 : (200 - 35) << 16; - - int32_t const width = mpgametextsize(typebuf, TEXT_LITERALESCAPE).x; - int32_t const fullwidth = width + textsc((tilesiz[SPINNINGNUKEICON].x << 15) + (2 << 16)); - int32_t const text_x = fullwidth >= (320 << 16) ? (320 << 16) - fullwidth : mpgametext_x; - mpgametext(text_x, y, typebuf, 1, 2 | 8 | 16 | ROTATESPRITE_FULL16, 0, TEXT_YCENTER | TEXT_LITERALESCAPE); - int32_t const cursor_x = text_x + width + textsc((tilesiz[SPINNINGNUKEICON].x << 14) + (1 << 16)); - rotatesprite_fs(cursor_x, y, textsc(32768), 0, SPINNINGNUKEICON + (((int32_t) totalclock >> 3) % 7), - 4 - (sintable[((int32_t) totalclock << 4) & 2047] >> 11), 0, 2 | 8); - - if (hitstate == 1) - { - inputState.ClearKeyStatus(sc_Enter); - if (Bstrlen(typebuf) == 0) - { - g_player[myconnectindex].ps->gm &= ~(MODE_TYPE | MODE_SENDTOWHOM); - return; - } - if (cl_automsg) - { - if (SHIFTS_IS_PRESSED) - g_chatPlayer = -1; - else - g_chatPlayer = ud.multimode; - } - g_player[myconnectindex].ps->gm |= MODE_SENDTOWHOM; - } - else if (hitstate == -1) - g_player[myconnectindex].ps->gm &= ~(MODE_TYPE | MODE_SENDTOWHOM); - else - pub = NUMPAGES; - } +#endif } diff --git a/source/duke3d/src/screens.cpp b/source/duke3d/src/screens.cpp index b5d5b8ec6..eae273ae9 100644 --- a/source/duke3d/src/screens.cpp +++ b/source/duke3d/src/screens.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "compat.h" #include "demo.h" #include "duke3d.h" -#include "input.h" + #include "mdsprite.h" #include "sbar.h" #include "screens.h" diff --git a/source/duke3d/src/sector.cpp b/source/duke3d/src/sector.cpp index 917df5c27..da4559472 100644 --- a/source/duke3d/src/sector.cpp +++ b/source/duke3d/src/sector.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define sector_c_ #include "duke3d.h" -#include "input.h" + #include "printf.h" #include "secrets.h" diff --git a/source/common/input/i_input.cpp b/source/platform/unix/i_input.cpp similarity index 100% rename from source/common/input/i_input.cpp rename to source/platform/unix/i_input.cpp diff --git a/source/common/input/i_joystick.cpp b/source/platform/unix/i_joystick.cpp similarity index 100% rename from source/common/input/i_joystick.cpp rename to source/platform/unix/i_joystick.cpp diff --git a/source/rr/src/anim.cpp b/source/rr/src/anim.cpp index d89e9f8be..abc2e0bd7 100644 --- a/source/rr/src/anim.cpp +++ b/source/rr/src/anim.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "duke3d.h" #include "animlib.h" #include "compat.h" -#include "input.h" + #include "anim.h" diff --git a/source/rr/src/d_menu.cpp b/source/rr/src/d_menu.cpp index 65471e76d..003a35135 100644 --- a/source/rr/src/d_menu.cpp +++ b/source/rr/src/d_menu.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "compat.h" #include "demo.h" #include "duke3d.h" -#include "input.h" + #include "menus.h" #include "osdcmds.h" #include "savegame.h" diff --git a/source/rr/src/demo.cpp b/source/rr/src/demo.cpp index d167beb46..048a681de 100644 --- a/source/rr/src/demo.cpp +++ b/source/rr/src/demo.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "demo.h" #include "duke3d.h" -#include "input.h" + #include "menus.h" #include "savegame.h" #include "screens.h" @@ -884,13 +884,6 @@ nextdemo_nomenu: { ControlInfo noshareinfo; CONTROL_GetInput(&noshareinfo); - if (buttonMap.ButtonDown(gamefunc_SendMessage)) - { - inputState.keyFlushChars(); - buttonMap.ClearButton(gamefunc_SendMessage); - g_player[myconnectindex].ps->gm = MODE_TYPE; - typebuf[0] = 0; - } } } diff --git a/source/rr/src/game.cpp b/source/rr/src/game.cpp index ece7b710e..419e845e5 100644 --- a/source/rr/src/game.cpp +++ b/source/rr/src/game.cpp @@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "savegame.h" #include "anim.h" #include "demo.h" -#include "input.h" + #include "colmatch.h" #include "cheats.h" #include "sbar.h" @@ -6190,15 +6190,6 @@ void G_HandleLocalKeys(void) } else { - if ((g_netServer || ud.multimode > 1) && buttonMap.ButtonDown(gamefunc_SendMessage)) - { - inputState.keyFlushChars(); - buttonMap.ClearButton(gamefunc_SendMessage); - g_player[myconnectindex].ps->gm |= MODE_TYPE; - typebuf[0] = 0; - } - - if (buttonMap.ButtonDown(gamefunc_Third_Person_View)) { buttonMap.ClearButton(gamefunc_Third_Person_View); diff --git a/source/rr/src/gameexec.cpp b/source/rr/src/gameexec.cpp index 426515789..39b36ee33 100644 --- a/source/rr/src/gameexec.cpp +++ b/source/rr/src/gameexec.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "duke3d.h" #include "anim.h" -#include "input.h" + #include "menus.h" #include "osdcmds.h" #include "savegame.h" diff --git a/source/rr/src/menus.cpp b/source/rr/src/menus.cpp index 06cd11de8..502cb4895 100644 --- a/source/rr/src/menus.cpp +++ b/source/rr/src/menus.cpp @@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "osdcmds.h" #include "savegame.h" #include "demo.h" -#include "input.h" + #include "menus.h" #include "cheats.h" #include "gamecvars.h" diff --git a/source/rr/src/net.cpp b/source/rr/src/net.cpp index d5bde0bfd..5a7b0000f 100644 --- a/source/rr/src/net.cpp +++ b/source/rr/src/net.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "net.h" #include "premap.h" #include "savegame.h" -#include "input.h" + #include "m_crc32.h" #include "mapinfo.h" @@ -3188,7 +3188,7 @@ void Net_ReceiveUserMapName(uint8_t *pbuf, int32_t packbufleng) void Net_SendMessage(void) { - +#if 0 if (g_player[myconnectindex].ps->gm&MODE_SENDTOWHOM) { int32_t i, j; @@ -3299,40 +3299,7 @@ void Net_SendMessage(void) } } } - else - { -#define MAXCHATLENGTH 120 - EDUKE32_STATIC_ASSERT(MAXCHATLENGTH < TYPEBUFSIZE); - int32_t const hitstate = I_EnterText(typebuf, MAXCHATLENGTH, 0); - - int32_t const y = ud.screen_size > 1 ? (200-58)<<16 : (200-35)<<16; - - int32_t const width = mpgametextsize(typebuf, TEXT_LITERALESCAPE).x; - int32_t const fullwidth = width + textsc((tilesiz[SPINNINGNUKEICON].x<<15)+(2<<16)); - int32_t const text_x = fullwidth >= (320<<16) ? (320<<16) - fullwidth : mpgametext_x; - mpgametext(text_x, y, typebuf, 1, 2|8|16|ROTATESPRITE_FULL16, 0, TEXT_YCENTER|TEXT_LITERALESCAPE); - int32_t const cursor_x = text_x + width + textsc((tilesiz[SPINNINGNUKEICON].x<<14)+(1<<16)); - rotatesprite_fs(cursor_x, y, textsc(32768), 0, SPINNINGNUKEICON+(((int32_t) totalclock>>3)%7), 4-(sintable[((int32_t) totalclock<<4)&2047]>>11), 0, 2|8); - - if (hitstate == 1) - { - inputState.ClearKeyStatus(sc_Enter); - if (Bstrlen(typebuf) == 0) - { - g_player[myconnectindex].ps->gm &= ~(MODE_TYPE|MODE_SENDTOWHOM); - return; - } - if (cl_automsg) - { - if (SHIFTS_IS_PRESSED) g_chatPlayer = -1; - else g_chatPlayer = ud.multimode; - } - g_player[myconnectindex].ps->gm |= MODE_SENDTOWHOM; - } - else if (hitstate == -1) - g_player[myconnectindex].ps->gm &= ~(MODE_TYPE|MODE_SENDTOWHOM); - else pub = NUMPAGES; - } +#endif } void Net_ReceiveMessage(uint8_t *pbuf, int32_t packbufleng) diff --git a/source/rr/src/screens.cpp b/source/rr/src/screens.cpp index e6d4b1a99..10a5a6649 100644 --- a/source/rr/src/screens.cpp +++ b/source/rr/src/screens.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "compat.h" #include "screens.h" #include "colmatch.h" -#include "input.h" + #include "anim.h" #include "sbar.h" #include "menus.h" diff --git a/source/rr/src/sector.cpp b/source/rr/src/sector.cpp index bae6f1abf..f445b51a2 100644 --- a/source/rr/src/sector.cpp +++ b/source/rr/src/sector.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define sector_c_ #include "duke3d.h" -#include "input.h" + #include "secrets.h" BEGIN_RR_NS diff --git a/source/sw/src/anim.cpp b/source/sw/src/anim.cpp index 561d8f70b..477b64b4a 100644 --- a/source/sw/src/anim.cpp +++ b/source/sw/src/anim.cpp @@ -42,7 +42,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #include "animlib.h" #include "anim.h" -#include "input.h" + #include "common_game.h" diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index 4cab482a3..e9166f7d2 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -60,7 +60,7 @@ Things required to make savegames work: #include "lists.h" #include "network.h" #include "pal.h" -#include "input.h" + #include "mytypes.h" //#include "config.h" @@ -3121,160 +3121,6 @@ void PauseKey(PLAYERp pp) } } - - -void GetMessageInput(PLAYERp pp) -{ - int pnum = myconnectindex; - short w,h; - static SWBOOL cur_show; - static SWBOOL TeamSendAll, TeamSendTeam; -#define TEAM_MENU "A - Send to ALL, T - Send to TEAM" - static char HoldMessageInputString[256]; - int i; - - if (!MessageInputMode && !ConInputMode) - { - if (buttonMap.ButtonDown(gamefunc_SendMessage)) - { - buttonMap.ClearButton(gamefunc_SendMessage); - inputState.keyFlushChars(); - MessageInputMode = TRUE; - InputMode = TRUE; - TeamSendTeam = FALSE; - TeamSendAll = FALSE; - - if (MessageInputMode) - { - memset(MessageInputString, '\0', sizeof(MessageInputString)); - } - } - } -#if 0 // the message input needs to be moved out of the game code! - else if (MessageInputMode && !ConInputMode) - { - if (gs.BorderNum > BORDER_BAR+1) - SetRedrawScreen(pp); - - // get input - switch (MNU_InputSmallString(MessageInputString, 320-20)) - { - case -1: // Cancel Input (pressed ESC) or Err - MessageInputMode = FALSE; - InputMode = FALSE; - inputState.ClearKeysDown(); - inputState.keyFlushChars(); - break; - case FALSE: // Input finished (RETURN) - if (MessageInputString[0] == '\0') - { - // no input - MessageInputMode = FALSE; - InputMode = FALSE; - inputState.ClearKeysDown(); - inputState.keyFlushChars(); - buttonMap.ClearButton(gamefunc_Inventory); - } - else - { - if (gNet.TeamPlay) - { - if (memcmp(MessageInputString, TEAM_MENU, sizeof(TEAM_MENU)) != 0) - { - // see if its a command - if (IsCommand(MessageInputString)) - { - TeamSendAll = TRUE; - } - else - { - strcpy(HoldMessageInputString, MessageInputString); - strcpy(MessageInputString, TEAM_MENU); - break; - } - } - else if (memcmp(MessageInputString, TEAM_MENU, sizeof(TEAM_MENU)) == 0) - { - strcpy(MessageInputString, HoldMessageInputString); - TeamSendAll = TRUE; - } - } - -SEND_MESSAGE: - - // broadcast message - MessageInputMode = FALSE; - InputMode = FALSE; - inputState.ClearKeysDown(); - inputState.keyFlushChars(); - buttonMap.ClearButton(gamefunc_Inventory); - CON_ProcessUserCommand(); // Check to see if it's a cheat or command - - for (i = 0; i < NUMGAMEFUNCTIONS; i++) - buttonMap.ClearButton(i); - - // Put who sent this - sprintf(ds,"%s: %s",pp->PlayerName,MessageInputString); - - if (gNet.TeamPlay) - { - TRAVERSE_CONNECT(pnum) - { - if (pnum != myconnectindex) - { - if (TeamSendAll) - SW_SendMessage(pnum, ds); - else if (User[pp->PlayerSprite]->spal == User[Player[pnum].PlayerSprite]->spal) - SW_SendMessage(pnum, ds); - } - } - } - else - TRAVERSE_CONNECT(pnum) - { - if (pnum != myconnectindex) - { - SW_SendMessage(pnum, ds); - } - } - adduserquote(MessageInputString); - quotebot += 8; - quotebotgoal = quotebot; - } - break; - - case TRUE: // Got input - - if (gNet.TeamPlay) - { - if (memcmp(MessageInputString, TEAM_MENU "a", sizeof(TEAM_MENU)+1) == 0) - { - strcpy(MessageInputString, HoldMessageInputString); - TeamSendAll = TRUE; - goto SEND_MESSAGE; - } - else if (memcmp(MessageInputString, TEAM_MENU "t", sizeof(TEAM_MENU)+1) == 0) - { - strcpy(MessageInputString, HoldMessageInputString); - TeamSendTeam = TRUE; - goto SEND_MESSAGE; - } - else - { - // reset the string if anything else is typed - if (strlen(MessageInputString)+1 > sizeof(TEAM_MENU)) - { - strcpy(MessageInputString, TEAM_MENU); - } - } - } - - break; - } - } -#endif -} - short MirrorDelay; void getinput(SW_PACKET *loc) @@ -3344,11 +3190,6 @@ void getinput(SW_PACKET *loc) if (PauseKeySet) return; - if (!M_Active()) - { - GetMessageInput(pp); - } - // MAP KEY if (buttonMap.ButtonDown(gamefunc_Map)) { @@ -4194,6 +4035,157 @@ GameStats GameInterface::getStats() return { pp->Kills, TotalKillable, pp->SecretsFound, LevelSecrets, PlayClock / 120, 0 }; } +#if 0 // the message input needs to be moved out of the game code! +void GetMessageInput(PLAYERp pp) +{ + int pnum = myconnectindex; + short w, h; + static SWBOOL cur_show; + static SWBOOL TeamSendAll, TeamSendTeam; +#define TEAM_MENU "A - Send to ALL, T - Send to TEAM" + static char HoldMessageInputString[256]; + int i; + if (!MessageInputMode && !ConInputMode) + { + if (buttonMap.ButtonDown(gamefunc_SendMessage)) + { + buttonMap.ClearButton(gamefunc_SendMessage); + inputState.keyFlushChars(); + MessageInputMode = TRUE; + InputMode = TRUE; + TeamSendTeam = FALSE; + TeamSendAll = FALSE; + + if (MessageInputMode) + { + memset(MessageInputString, '\0', sizeof(MessageInputString)); + } + } + } + + else if (MessageInputMode && !ConInputMode) + { + if (gs.BorderNum > BORDER_BAR + 1) + SetRedrawScreen(pp); + + // get input + switch (MNU_InputSmallString(MessageInputString, 320 - 20)) + { + case -1: // Cancel Input (pressed ESC) or Err + MessageInputMode = FALSE; + InputMode = FALSE; + inputState.ClearKeysDown(); + inputState.keyFlushChars(); + break; + case FALSE: // Input finished (RETURN) + if (MessageInputString[0] == '\0') + { + // no input + MessageInputMode = FALSE; + InputMode = FALSE; + inputState.ClearKeysDown(); + inputState.keyFlushChars(); + buttonMap.ClearButton(gamefunc_Inventory); + } + else + { + if (gNet.TeamPlay) + { + if (memcmp(MessageInputString, TEAM_MENU, sizeof(TEAM_MENU)) != 0) + { + // see if its a command + if (IsCommand(MessageInputString)) + { + TeamSendAll = TRUE; + } + else + { + strcpy(HoldMessageInputString, MessageInputString); + strcpy(MessageInputString, TEAM_MENU); + break; + } + } + else if (memcmp(MessageInputString, TEAM_MENU, sizeof(TEAM_MENU)) == 0) + { + strcpy(MessageInputString, HoldMessageInputString); + TeamSendAll = TRUE; + } + } + + SEND_MESSAGE: + + // broadcast message + MessageInputMode = FALSE; + InputMode = FALSE; + inputState.ClearKeysDown(); + inputState.keyFlushChars(); + buttonMap.ClearButton(gamefunc_Inventory); + CON_ProcessUserCommand(); // Check to see if it's a cheat or command + + for (i = 0; i < NUMGAMEFUNCTIONS; i++) + buttonMap.ClearButton(i); + + // Put who sent this + sprintf(ds, "%s: %s", pp->PlayerName, MessageInputString); + + if (gNet.TeamPlay) + { + TRAVERSE_CONNECT(pnum) + { + if (pnum != myconnectindex) + { + if (TeamSendAll) + SW_SendMessage(pnum, ds); + else if (User[pp->PlayerSprite]->spal == User[Player[pnum].PlayerSprite]->spal) + SW_SendMessage(pnum, ds); + } + } + } + else + TRAVERSE_CONNECT(pnum) + { + if (pnum != myconnectindex) + { + SW_SendMessage(pnum, ds); + } + } + adduserquote(MessageInputString); + quotebot += 8; + quotebotgoal = quotebot; + } + break; + + case TRUE: // Got input + + if (gNet.TeamPlay) + { + if (memcmp(MessageInputString, TEAM_MENU "a", sizeof(TEAM_MENU) + 1) == 0) + { + strcpy(MessageInputString, HoldMessageInputString); + TeamSendAll = TRUE; + goto SEND_MESSAGE; + } + else if (memcmp(MessageInputString, TEAM_MENU "t", sizeof(TEAM_MENU) + 1) == 0) + { + strcpy(MessageInputString, HoldMessageInputString); + TeamSendTeam = TRUE; + goto SEND_MESSAGE; + } + else + { + // reset the string if anything else is typed + if (strlen(MessageInputString) + 1 > sizeof(TEAM_MENU)) + { + strcpy(MessageInputString, TEAM_MENU); + } + } + } + + break; + } + } +} +#endif END_SW_NS diff --git a/source/sw/src/menus.cpp b/source/sw/src/menus.cpp index 81e11b632..daa835ae1 100644 --- a/source/sw/src/menus.cpp +++ b/source/sw/src/menus.cpp @@ -42,7 +42,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms #include "sw_strs.h" #include "pal.h" #include "demo.h" -#include "input.h" + #include "keydef.h" #include "gamecontrol.h"