mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
- cleaned up the input code a bit.
This commit is contained in:
parent
bcb48d8441
commit
d464017363
18 changed files with 122 additions and 126 deletions
|
@ -1194,9 +1194,7 @@ RESTART:
|
||||||
gRestartGame = 0;
|
gRestartGame = 0;
|
||||||
if (gGameOptions.nGameType > 0)
|
if (gGameOptions.nGameType > 0)
|
||||||
{
|
{
|
||||||
inputState.ClearKeysDown();
|
inputState.ClearAllInput();
|
||||||
inputState.keyFlushChars();
|
|
||||||
inputState.keyFlushScans();
|
|
||||||
}
|
}
|
||||||
else if (gDemo.at1 && !bAddUserMap && !bNoDemo)
|
else if (gDemo.at1 && !bAddUserMap && !bNoDemo)
|
||||||
gDemo.Playback();
|
gDemo.Playback();
|
||||||
|
|
|
@ -38,6 +38,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "seq.h"
|
#include "seq.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
|
#include "menu/menu.h"
|
||||||
|
|
||||||
extern bool gHaveNetworking;
|
extern bool gHaveNetworking;
|
||||||
|
|
||||||
|
@ -542,7 +543,10 @@ void netGetPackets(void)
|
||||||
gStartNewGame = 1;
|
gStartNewGame = 1;
|
||||||
break;
|
break;
|
||||||
case 255:
|
case 255:
|
||||||
inputState.SetKeyStatus(sc_Escape);
|
// What are we trying to do here? Opening the menu, maybe?
|
||||||
|
//inputState.SetKeyStatus(sc_Escape);
|
||||||
|
M_StartControlPanel(false);
|
||||||
|
M_SetMenu(NAME_MainMenu);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,47 @@
|
||||||
|
/*
|
||||||
|
** Main input handler
|
||||||
|
**
|
||||||
|
**---------------------------------------------------------------------------
|
||||||
|
** Copyright 2019 Christoph Oelckers
|
||||||
|
** All rights reserved.
|
||||||
|
**
|
||||||
|
** Redistribution and use in source and binary forms, with or without
|
||||||
|
** modification, are permitted provided that the following conditions
|
||||||
|
** are met:
|
||||||
|
**
|
||||||
|
** 1. Redistributions of source code must retain the above copyright
|
||||||
|
** notice, this list of conditions and the following disclaimer.
|
||||||
|
** 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
** notice, this list of conditions and the following disclaimer in the
|
||||||
|
** documentation and/or other materials provided with the distribution.
|
||||||
|
** 3. The name of the author may not be used to endorse or promote products
|
||||||
|
** derived from this software without specific prior written permission.
|
||||||
|
**
|
||||||
|
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||||
|
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
**---------------------------------------------------------------------------
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
|
||||||
#include "inputstate.h"
|
#include "inputstate.h"
|
||||||
#include "v_draw.h"
|
#include "v_draw.h"
|
||||||
#include "build.h"
|
#include "build.h"
|
||||||
#include "gamecvars.h"
|
#include "gamecvars.h"
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
void InputState::GetMouseDelta(ControlInfo * info)
|
void InputState::GetMouseDelta(ControlInfo * info)
|
||||||
{
|
{
|
||||||
vec2_t input;
|
vec2_t input;
|
||||||
|
@ -54,15 +93,50 @@ void InputState::GetMouseDelta(ControlInfo * info)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void InputState::keySetState(int32_t key, int32_t state)
|
||||||
|
{
|
||||||
|
KeyStatus[key] = (uint8_t)state;
|
||||||
|
|
||||||
|
if (state)
|
||||||
|
{
|
||||||
|
g_keyFIFO[g_keyFIFOend] = key;
|
||||||
|
g_keyFIFO[(g_keyFIFOend + 1) & (KEYFIFOSIZ - 1)] = state;
|
||||||
|
g_keyFIFOend = ((g_keyFIFOend + 2) & (KEYFIFOSIZ - 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
void InputState::AddEvent(const event_t *ev)
|
void InputState::AddEvent(const event_t *ev)
|
||||||
{
|
{
|
||||||
if (ev->type == EV_KeyDown || ev->type == EV_KeyUp)
|
if (ev->type == EV_KeyDown || ev->type == EV_KeyUp)
|
||||||
{
|
{
|
||||||
keySetState(ev->data1, ev->type == EV_KeyDown);
|
keySetState(ev->data1, ev->type == EV_KeyDown);
|
||||||
if (ev->data2) keySetChar(ev->data2);
|
if (ev->data2)
|
||||||
|
{
|
||||||
|
g_keyAsciiFIFO[g_keyAsciiEnd] = (char16_t)ev->data2;
|
||||||
|
g_keyAsciiEnd = ((g_keyAsciiEnd + 1) & (KEYFIFOSIZ - 1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
void I_StartTic();
|
void I_StartTic();
|
||||||
|
|
||||||
int32_t handleevents(void)
|
int32_t handleevents(void)
|
||||||
|
@ -111,6 +185,12 @@ int32_t handleevents(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
void CONTROL_GetInput(ControlInfo* info)
|
void CONTROL_GetInput(ControlInfo* info)
|
||||||
{
|
{
|
||||||
memset(info, 0, sizeof(ControlInfo));
|
memset(info, 0, sizeof(ControlInfo));
|
||||||
|
|
|
@ -46,10 +46,10 @@ class InputState
|
||||||
uint8_t g_keyAsciiPos;
|
uint8_t g_keyAsciiPos;
|
||||||
uint8_t g_keyAsciiEnd;
|
uint8_t g_keyAsciiEnd;
|
||||||
|
|
||||||
kb_scancode KB_LastScan;
|
|
||||||
|
|
||||||
vec2_t g_mousePos;
|
vec2_t g_mousePos;
|
||||||
|
|
||||||
|
void keySetState(int32_t key, int32_t state);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
uint8_t GetKeyStatus(int key)
|
uint8_t GetKeyStatus(int key)
|
||||||
|
@ -57,21 +57,11 @@ public:
|
||||||
return KeyStatus[key];
|
return KeyStatus[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetKeyStatus(int key, int state = 1)
|
|
||||||
{
|
|
||||||
KeyStatus[key] = (uint8_t)state;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClearKeyStatus(int key)
|
void ClearKeyStatus(int key)
|
||||||
{
|
{
|
||||||
KeyStatus[key] = 0;
|
KeyStatus[key] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearAllKeyStatus()
|
|
||||||
{
|
|
||||||
memset(KeyStatus, 0, sizeof(KeyStatus));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AltPressed()
|
bool AltPressed()
|
||||||
{
|
{
|
||||||
return KeyStatus[sc_LeftAlt] || KeyStatus[sc_RightAlt];
|
return KeyStatus[sc_LeftAlt] || KeyStatus[sc_RightAlt];
|
||||||
|
@ -111,22 +101,6 @@ public:
|
||||||
return ((g_keyAsciiEnd + 1) & (KEYFIFOSIZ - 1)) == g_keyAsciiPos;
|
return ((g_keyAsciiEnd + 1) & (KEYFIFOSIZ - 1)) == g_keyAsciiPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void keySetState(int32_t key, int32_t state)
|
|
||||||
{
|
|
||||||
if (state && !GetKeyStatus(key))
|
|
||||||
{
|
|
||||||
KB_LastScan = key;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetKeyStatus(key, state);
|
|
||||||
if (state)
|
|
||||||
{
|
|
||||||
g_keyFIFO[g_keyFIFOend] = key;
|
|
||||||
g_keyFIFO[(g_keyFIFOend + 1) & (KEYFIFOSIZ - 1)] = state;
|
|
||||||
g_keyFIFOend = ((g_keyFIFOend + 2) & (KEYFIFOSIZ - 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
kb_scancode keyGetScan()
|
kb_scancode keyGetScan()
|
||||||
{
|
{
|
||||||
if (g_keyFIFOpos == g_keyFIFOend)
|
if (g_keyFIFOpos == g_keyFIFOend)
|
||||||
|
@ -157,12 +131,6 @@ public:
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
void keySetChar(int key)
|
|
||||||
{
|
|
||||||
g_keyAsciiFIFO[g_keyAsciiEnd] = (char16_t)key;
|
|
||||||
g_keyAsciiEnd = ((g_keyAsciiEnd + 1) & (KEYFIFOSIZ - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
void keyFlushChars(void)
|
void keyFlushChars(void)
|
||||||
{
|
{
|
||||||
memset(&g_keyAsciiFIFO, 0, sizeof(g_keyAsciiFIFO));
|
memset(&g_keyAsciiFIFO, 0, sizeof(g_keyAsciiFIFO));
|
||||||
|
@ -174,28 +142,6 @@ public:
|
||||||
return (GetKeyStatus(scan) != 0 && Bindings.GetBind(scan) == nullptr);
|
return (GetKeyStatus(scan) != 0 && Bindings.GetBind(scan) == nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
kb_scancode GetLastScanCode()
|
|
||||||
{
|
|
||||||
return (KB_LastScan);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetLastScanCode(kb_scancode scancode)
|
|
||||||
{
|
|
||||||
KB_LastScan = (scancode);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClearLastScanCode()
|
|
||||||
{
|
|
||||||
KB_LastScan = sc_None;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClearKeysDown(void)
|
|
||||||
{
|
|
||||||
ClearLastScanCode();
|
|
||||||
ClearAllKeyStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddEvent(const event_t* ev);
|
void AddEvent(const event_t* ev);
|
||||||
|
|
||||||
void MouseSetPos(int x, int y)
|
void MouseSetPos(int x, int y)
|
||||||
|
@ -217,7 +163,7 @@ public:
|
||||||
|
|
||||||
void ClearAllInput()
|
void ClearAllInput()
|
||||||
{
|
{
|
||||||
ClearKeysDown();
|
memset(KeyStatus, 0, sizeof(KeyStatus));
|
||||||
keyFlushChars();
|
keyFlushChars();
|
||||||
keyFlushScans();
|
keyFlushScans();
|
||||||
buttonMap.ResetButtonStates(); // this is important. If all input is cleared, the buttons must be cleared as well.
|
buttonMap.ResetButtonStates(); // this is important. If all input is cleared, the buttons must be cleared as well.
|
||||||
|
|
|
@ -370,8 +370,7 @@ void M_StartControlPanel (bool makeSound)
|
||||||
gi->MenuOpened();
|
gi->MenuOpened();
|
||||||
if (makeSound) gi->MenuSound(ActivateSound);
|
if (makeSound) gi->MenuSound(ActivateSound);
|
||||||
|
|
||||||
buttonMap.ResetButtonStates ();
|
inputState.ClearAllInput();
|
||||||
inputState.ClearAllKeyStatus();
|
|
||||||
for (int i = 0; i < NUM_MKEYS; ++i)
|
for (int i = 0; i < NUM_MKEYS; ++i)
|
||||||
{
|
{
|
||||||
MenuButtons[i].ReleaseKey(0);
|
MenuButtons[i].ReleaseKey(0);
|
||||||
|
|
|
@ -325,7 +325,7 @@ void G_DoCheats(void)
|
||||||
// cheat string matching logic below.
|
// cheat string matching logic below.
|
||||||
Bassert(g_cheatBufLen < (signed)sizeof(cheatbuf));
|
Bassert(g_cheatBufLen < (signed)sizeof(cheatbuf));
|
||||||
cheatbuf[g_cheatBufLen] = 0;
|
cheatbuf[g_cheatBufLen] = 0;
|
||||||
// inputState.ClearKeysDown();
|
// inputState.ClearAllInput();
|
||||||
|
|
||||||
for (cheatNum=0; cheatNum < NUMCHEATCODES; cheatNum++)
|
for (cheatNum=0; cheatNum < NUMCHEATCODES; cheatNum++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1080,7 +1080,7 @@ static int32_t VM_ResetPlayer(int const playerNum, int32_t vmFlags, int32_t cons
|
||||||
if (resetFlags & 4)
|
if (resetFlags & 4)
|
||||||
{
|
{
|
||||||
inputState.keyFlushChars();
|
inputState.keyFlushChars();
|
||||||
inputState.ClearKeysDown();
|
inputState.ClearAllInput();
|
||||||
FX_StopAllSounds();
|
FX_StopAllSounds();
|
||||||
if (G_LoadPlayerMaybeMulti(*g_quickload) != 0)
|
if (G_LoadPlayerMaybeMulti(*g_quickload) != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2030,8 +2030,7 @@ MENU:
|
||||||
bInDemo = kTrue;
|
bInDemo = kTrue;
|
||||||
bPlayback = kTrue;
|
bPlayback = kTrue;
|
||||||
|
|
||||||
inputState.keyFlushChars();
|
inputState.ClearAllInput();
|
||||||
inputState.ClearAllKeyStatus();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
STARTGAME1:
|
STARTGAME1:
|
||||||
|
@ -2228,8 +2227,7 @@ GAMELOOP:
|
||||||
// YELLOW
|
// YELLOW
|
||||||
if (((bInDemo && inputState.keyBufferWaiting()) || !ReadPlaybackInputs()) && inputState.keyGetChar())
|
if (((bInDemo && inputState.keyBufferWaiting()) || !ReadPlaybackInputs()) && inputState.keyGetChar())
|
||||||
{
|
{
|
||||||
inputState.keyFlushChars();
|
inputState.ClearAllInput();
|
||||||
inputState.ClearAllKeyStatus();
|
|
||||||
|
|
||||||
bPlayback = kFalse;
|
bPlayback = kFalse;
|
||||||
bInDemo = kFalse;
|
bInDemo = kFalse;
|
||||||
|
@ -2277,7 +2275,7 @@ GAMELOOP:
|
||||||
// loc_11FBC:
|
// loc_11FBC:
|
||||||
while (bPause)
|
while (bPause)
|
||||||
{
|
{
|
||||||
ClearAllKeys();
|
inputState.ClearAllInput();
|
||||||
if (WaitAnyKey(-1) != sc_Pause)
|
if (WaitAnyKey(-1) != sc_Pause)
|
||||||
{
|
{
|
||||||
bPause = kFalse;
|
bPause = kFalse;
|
||||||
|
@ -2492,7 +2490,7 @@ void KeyFn1()
|
||||||
void DoGameOverScene()
|
void DoGameOverScene()
|
||||||
{
|
{
|
||||||
FadeOut(0);
|
FadeOut(0);
|
||||||
ClearAllKeys();
|
inputState.ClearAllInput();
|
||||||
|
|
||||||
if (LoadCinemaPalette(16) < 0) {
|
if (LoadCinemaPalette(16) < 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -2529,7 +2527,7 @@ void DoTitle()
|
||||||
if (videoGetRenderMode() == REND_CLASSIC)
|
if (videoGetRenderMode() == REND_CLASSIC)
|
||||||
FadeIn();
|
FadeIn();
|
||||||
|
|
||||||
ClearAllKeys();
|
inputState.ClearAllInput();
|
||||||
|
|
||||||
WaitAnyKey(2);
|
WaitAnyKey(2);
|
||||||
|
|
||||||
|
@ -2551,7 +2549,7 @@ void DoTitle()
|
||||||
|
|
||||||
if (videoGetRenderMode() == REND_CLASSIC)
|
if (videoGetRenderMode() == REND_CLASSIC)
|
||||||
FadeOut(0);
|
FadeOut(0);
|
||||||
ClearAllKeys();
|
inputState.ClearAllInput();
|
||||||
|
|
||||||
PlayMovie("book.mov");
|
PlayMovie("book.mov");
|
||||||
|
|
||||||
|
@ -2602,7 +2600,7 @@ void DoTitle()
|
||||||
|
|
||||||
var_18 += theArray[0];
|
var_18 += theArray[0];
|
||||||
|
|
||||||
inputState.ClearAllKeyStatus();
|
inputState.ClearAllInput();
|
||||||
while (LocalSoundPlaying())
|
while (LocalSoundPlaying())
|
||||||
{
|
{
|
||||||
HandleAsync();
|
HandleAsync();
|
||||||
|
|
|
@ -163,12 +163,6 @@ ClearSpaceBar_
|
||||||
faketimerhandler_
|
faketimerhandler_
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void ClearAllKeys()
|
|
||||||
{
|
|
||||||
inputState.ClearAllKeyStatus();
|
|
||||||
inputState.keyFlushChars();
|
|
||||||
}
|
|
||||||
|
|
||||||
void WaitNoKey(int nSecs, void (*pFunc) (void))
|
void WaitNoKey(int nSecs, void (*pFunc) (void))
|
||||||
{
|
{
|
||||||
int nTotalTime = (kTimerTicks * nSecs) + (int)totalclock;
|
int nTotalTime = (kTimerTicks * nSecs) + (int)totalclock;
|
||||||
|
|
|
@ -630,7 +630,7 @@ int menu_DrawTheMap(int nLevel, int nLevelNew, int nLevelBest)
|
||||||
|
|
||||||
int startTime = (int)totalclock;
|
int startTime = (int)totalclock;
|
||||||
|
|
||||||
ClearAllKeys();
|
inputState.ClearAllInput();
|
||||||
UnMaskStatus();
|
UnMaskStatus();
|
||||||
videoSetViewableArea(0, 0, xdim - 1, ydim - 1);
|
videoSetViewableArea(0, 0, xdim - 1, ydim - 1);
|
||||||
|
|
||||||
|
@ -1180,7 +1180,7 @@ void ComputeCinemaText(int nLine)
|
||||||
nCrawlY = 199;
|
nCrawlY = 199;
|
||||||
nHeight = linecount * 10;
|
nHeight = linecount * 10;
|
||||||
|
|
||||||
ClearAllKeys();
|
inputState.ClearAllInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReadyCinemaText(uint16_t nVal)
|
void ReadyCinemaText(uint16_t nVal)
|
||||||
|
@ -1359,7 +1359,7 @@ void GoToTheCinema(int nVal)
|
||||||
videoNextPage();
|
videoNextPage();
|
||||||
|
|
||||||
CinemaFadeIn();
|
CinemaFadeIn();
|
||||||
ClearAllKeys();
|
inputState.ClearAllInput();
|
||||||
|
|
||||||
int ebx = -1;
|
int ebx = -1;
|
||||||
int edx = -1;
|
int edx = -1;
|
||||||
|
@ -1518,11 +1518,7 @@ int FindGString(const char *str)
|
||||||
|
|
||||||
uint8_t CheckForEscape()
|
uint8_t CheckForEscape()
|
||||||
{
|
{
|
||||||
if (!inputState.keyBufferWaiting() || (inputState.keyGetChar() != 27)) {
|
return inputState.CheckAllInput();
|
||||||
return kFalse;
|
|
||||||
}
|
|
||||||
|
|
||||||
return kTrue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoStatic(int a, int b)
|
void DoStatic(int a, int b)
|
||||||
|
@ -1681,8 +1677,7 @@ void DoLastLevelCinema()
|
||||||
|
|
||||||
nString++;
|
nString++;
|
||||||
|
|
||||||
inputState.keyFlushChars();
|
inputState.ClearAllInput();
|
||||||
inputState.ClearAllKeyStatus();
|
|
||||||
|
|
||||||
int v11 = (kTimerTicks * (var_1C + 2)) + (int)totalclock;
|
int v11 = (kTimerTicks * (var_1C + 2)) + (int)totalclock;
|
||||||
|
|
||||||
|
|
|
@ -213,8 +213,7 @@ void PlayMovie(const char* fileName)
|
||||||
banktail = 0;
|
banktail = 0;
|
||||||
|
|
||||||
// clear keys
|
// clear keys
|
||||||
inputState.keyFlushChars();
|
inputState.ClearAllInput();
|
||||||
inputState.ClearAllKeyStatus();
|
|
||||||
|
|
||||||
if (bDoFade) {
|
if (bDoFade) {
|
||||||
StartFadeIn();
|
StartFadeIn();
|
||||||
|
|
|
@ -2637,7 +2637,7 @@ do_default_b:
|
||||||
FinishLevel();
|
FinishLevel();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
inputState.keySetState(32, 1);
|
//inputState.keySetState(32, 1); // Huh, what?
|
||||||
}
|
}
|
||||||
|
|
||||||
DestroyItemAnim(nValB);
|
DestroyItemAnim(nValB);
|
||||||
|
|
|
@ -52,7 +52,6 @@ struct PlayerInput // TODO consider adjusting this for demo compatibility
|
||||||
};
|
};
|
||||||
|
|
||||||
void InitInput();
|
void InitInput();
|
||||||
void ClearAllKeys();
|
|
||||||
void WaitNoKey(int nSecs, void (*pFunc) (void));
|
void WaitNoKey(int nSecs, void (*pFunc) (void));
|
||||||
int WaitAnyKey(int nSecs);
|
int WaitAnyKey(int nSecs);
|
||||||
|
|
||||||
|
|
|
@ -318,7 +318,7 @@ void G_DoCheats(void)
|
||||||
// cheat string matching logic below.
|
// cheat string matching logic below.
|
||||||
Bassert(cheatbuflen < (signed)sizeof(cheatbuf));
|
Bassert(cheatbuflen < (signed)sizeof(cheatbuf));
|
||||||
cheatbuf[cheatbuflen] = 0;
|
cheatbuf[cheatbuflen] = 0;
|
||||||
// inputState.ClearKeysDown();
|
// inputState.ClearAllInput();
|
||||||
|
|
||||||
for (cheatNum=0; cheatNum < NUMCHEATCODES; cheatNum++)
|
for (cheatNum=0; cheatNum < NUMCHEATCODES; cheatNum++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -232,8 +232,7 @@ playanm(short anim_num)
|
||||||
|
|
||||||
ANIMnum = anim_num;
|
ANIMnum = anim_num;
|
||||||
|
|
||||||
inputState.keyFlushChars();
|
inputState.ClearAllInput();
|
||||||
inputState.ClearKeysDown();
|
|
||||||
|
|
||||||
DSPRINTF(ds,"PlayAnm");
|
DSPRINTF(ds,"PlayAnm");
|
||||||
MONO_PRINT(ds);
|
MONO_PRINT(ds);
|
||||||
|
@ -332,8 +331,7 @@ ENDOFANIMLOOP:
|
||||||
|
|
||||||
videoSetPalette(0, BASEPAL, 2);
|
videoSetPalette(0, BASEPAL, 2);
|
||||||
|
|
||||||
inputState.keyFlushChars();
|
inputState.ClearAllInput();
|
||||||
inputState.ClearKeysDown();
|
|
||||||
ANIM_FreeAnim();
|
ANIM_FreeAnim();
|
||||||
}
|
}
|
||||||
END_SW_NS
|
END_SW_NS
|
||||||
|
|
|
@ -568,7 +568,7 @@ ScenePlayBack(void)
|
||||||
ready2send = 0;
|
ready2send = 0;
|
||||||
DemoDone = FALSE;
|
DemoDone = FALSE;
|
||||||
|
|
||||||
ResetKeys();
|
inputState.ClearAllInput();
|
||||||
|
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1399,14 +1399,6 @@ void NewLevel(void)
|
||||||
FinishAnim = 0;
|
FinishAnim = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
ResetKeys(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
inputState.ClearAllKeyStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t* KeyPressedRange(uint8_t* kb, uint8_t* ke)
|
uint8_t* KeyPressedRange(uint8_t* kb, uint8_t* ke)
|
||||||
{
|
{
|
||||||
|
@ -1475,7 +1467,7 @@ void LogoLevel(void)
|
||||||
videoNextPage();
|
videoNextPage();
|
||||||
//FadeIn(0, 3);
|
//FadeIn(0, 3);
|
||||||
|
|
||||||
ResetKeys();
|
inputState.ClearAllInput();
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
handleevents();
|
handleevents();
|
||||||
|
@ -1555,7 +1547,7 @@ void CreditsLevel(void)
|
||||||
totalclock = 0;
|
totalclock = 0;
|
||||||
ototalclock = 0;
|
ototalclock = 0;
|
||||||
|
|
||||||
ResetKeys();
|
inputState.ClearAllInput();
|
||||||
curpic = CREDITS1_PIC;
|
curpic = CREDITS1_PIC;
|
||||||
|
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
|
@ -1590,7 +1582,7 @@ void CreditsLevel(void)
|
||||||
// put up a blank screen while loading
|
// put up a blank screen while loading
|
||||||
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
|
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
|
||||||
videoNextPage();
|
videoNextPage();
|
||||||
ResetKeys();
|
inputState.ClearAllInput();
|
||||||
Mus_Stop();
|
Mus_Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1605,7 +1597,7 @@ void SybexScreen(void)
|
||||||
rotatesprite(0, 0, RS_SCALE, 0, 5261, 0, 0, TITLE_ROT_FLAGS, 0, 0, xdim - 1, ydim - 1);
|
rotatesprite(0, 0, RS_SCALE, 0, 5261, 0, 0, TITLE_ROT_FLAGS, 0, 0, xdim - 1, ydim - 1);
|
||||||
videoNextPage();
|
videoNextPage();
|
||||||
|
|
||||||
ResetKeys();
|
inputState.ClearAllInput();
|
||||||
while (!inputState.CheckAllInput()) handleevents();
|
while (!inputState.CheckAllInput()) handleevents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1637,7 +1629,7 @@ TitleLevel(void)
|
||||||
videoNextPage();
|
videoNextPage();
|
||||||
//FadeIn(0, 3);
|
//FadeIn(0, 3);
|
||||||
|
|
||||||
ResetKeys();
|
inputState.ClearAllInput();
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
handleevents();
|
handleevents();
|
||||||
|
@ -1762,7 +1754,7 @@ void MenuLevel(void)
|
||||||
// don't allow BorderAdjusting in these menus
|
// don't allow BorderAdjusting in these menus
|
||||||
BorderAdjust = FALSE;
|
BorderAdjust = FALSE;
|
||||||
|
|
||||||
ResetKeys();
|
inputState.ClearAllInput();
|
||||||
|
|
||||||
if (SW_SHAREWARE)
|
if (SW_SHAREWARE)
|
||||||
{
|
{
|
||||||
|
@ -1838,8 +1830,7 @@ void MenuLevel(void)
|
||||||
|
|
||||||
BorderAdjust = TRUE;
|
BorderAdjust = TRUE;
|
||||||
//LoadGameOutsideMoveLoop = FALSE;
|
//LoadGameOutsideMoveLoop = FALSE;
|
||||||
inputState.ClearKeyStatus(sc_Escape);
|
inputState.ClearAllInput();
|
||||||
inputState.ClearKeysDown();
|
|
||||||
M_ClearMenus();
|
M_ClearMenus();
|
||||||
InMenuLevel = FALSE;
|
InMenuLevel = FALSE;
|
||||||
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
|
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
|
||||||
|
@ -2070,7 +2061,7 @@ void BonusScreen(PLAYERp pp)
|
||||||
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
|
twod->AddColorOnlyQuad(0, 0, xdim, ydim, 0xff000000);
|
||||||
videoNextPage();
|
videoNextPage();
|
||||||
|
|
||||||
inputState.ClearKeysDown();
|
inputState.ClearAllInput();
|
||||||
|
|
||||||
totalclock = ototalclock = 0;
|
totalclock = ototalclock = 0;
|
||||||
limit = synctics;
|
limit = synctics;
|
||||||
|
@ -4004,8 +3995,7 @@ void GetMessageInput(PLAYERp pp)
|
||||||
case -1: // Cancel Input (pressed ESC) or Err
|
case -1: // Cancel Input (pressed ESC) or Err
|
||||||
MessageInputMode = FALSE;
|
MessageInputMode = FALSE;
|
||||||
InputMode = FALSE;
|
InputMode = FALSE;
|
||||||
inputState.ClearKeysDown();
|
inputState.ClearAllInput();
|
||||||
inputState.keyFlushChars();
|
|
||||||
break;
|
break;
|
||||||
case FALSE: // Input finished (RETURN)
|
case FALSE: // Input finished (RETURN)
|
||||||
if (MessageInputString[0] == '\0')
|
if (MessageInputString[0] == '\0')
|
||||||
|
@ -4013,8 +4003,7 @@ void GetMessageInput(PLAYERp pp)
|
||||||
// no input
|
// no input
|
||||||
MessageInputMode = FALSE;
|
MessageInputMode = FALSE;
|
||||||
InputMode = FALSE;
|
InputMode = FALSE;
|
||||||
inputState.ClearKeysDown();
|
inputState.ClearAllInput();
|
||||||
inputState.keyFlushChars();
|
|
||||||
buttonMap.ClearButton(gamefunc_Inventory);
|
buttonMap.ClearButton(gamefunc_Inventory);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -4041,9 +4030,7 @@ void GetMessageInput(PLAYERp pp)
|
||||||
// broadcast message
|
// broadcast message
|
||||||
MessageInputMode = FALSE;
|
MessageInputMode = FALSE;
|
||||||
InputMode = FALSE;
|
InputMode = FALSE;
|
||||||
inputState.ClearKeysDown();
|
inputState.ClearAllInput();
|
||||||
inputState.keyFlushChars();
|
|
||||||
buttonMap.ClearButton(gamefunc_Inventory);
|
|
||||||
|
|
||||||
for (i = 0; i < NUMGAMEFUNCTIONS; i++)
|
for (i = 0; i < NUMGAMEFUNCTIONS; i++)
|
||||||
buttonMap.ClearButton(i);
|
buttonMap.ClearButton(i);
|
||||||
|
|
|
@ -2339,7 +2339,6 @@ void AnimateCacheCursor(void); // game.c
|
||||||
void MapSetAll2D(uint8_t fill); // game.c
|
void MapSetAll2D(uint8_t fill); // game.c
|
||||||
void TerminateGame(void); // game.c
|
void TerminateGame(void); // game.c
|
||||||
void TerminateLevel(void); // game.c
|
void TerminateLevel(void); // game.c
|
||||||
void ResetKeys(void); // game.c
|
|
||||||
void drawoverheadmap(int cposx,int cposy,int czoom,short cang); // game.c
|
void drawoverheadmap(int cposx,int cposy,int czoom,short cang); // game.c
|
||||||
void COVERsetbrightness(int bright, unsigned char *pal); // game.c
|
void COVERsetbrightness(int bright, unsigned char *pal); // game.c
|
||||||
void DrawMenuLevelScreen(void); // game.c
|
void DrawMenuLevelScreen(void); // game.c
|
||||||
|
|
Loading…
Reference in a new issue