From 1ee4efebb06434aab75cbaefded2a38e4aef3f99 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 4 Nov 2019 17:58:18 +0100 Subject: [PATCH] - fixed compilation. --- source/blood/src/blood.cpp | 8 -------- source/blood/src/gamemenu.cpp | 2 +- source/build/include/baselayer.h | 6 ------ source/build/src/sdlayer.cpp | 6 ++++-- source/common/inputstate.h | 23 ++++++++++++++++++----- source/duke3d/src/game.cpp | 1 - source/duke3d/src/menus.cpp | 2 +- source/glbackend/glbackend.cpp | 2 +- source/rr/src/game.cpp | 1 - source/rr/src/menus.cpp | 2 +- source/sw/src/game.cpp | 5 ----- 11 files changed, 26 insertions(+), 32 deletions(-) diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index 4edb571ff..7b026e638 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -183,18 +183,10 @@ void ShutDown(void) sfxTerm(); scrUnInit(); CONTROL_Shutdown(); - KB_Shutdown(); OSD_Cleanup(); // PORT_TODO: Check argument if (syncstate) printf("A packet was lost! (syncstate)\n"); -#if 0 // never used anywhere. - for (int i = 0; i < 10; i++) - { - if (gSaveGamePic[i]) - Resource::Free(gSaveGamePic[i]); - } -#endif DO_FREE_AND_NULL(pUserTiles); DO_FREE_AND_NULL(pUserSoundRFF); DO_FREE_AND_NULL(pUserRFF); diff --git a/source/blood/src/gamemenu.cpp b/source/blood/src/gamemenu.cpp index 91b09fe4d..b7f01a033 100644 --- a/source/blood/src/gamemenu.cpp +++ b/source/blood/src/gamemenu.cpp @@ -175,7 +175,7 @@ void CGameMenuMgr::Draw(void) if (!MOUSEACTIVECONDITION) m_mousewake_watchpoint = 1; - if (MOUSEACTIVECONDITIONAL(mouseAdvanceClickState()) || m_mousepos.x != m_prevmousepos.x || m_mousepos.y != m_prevmousepos.y) + if (MOUSEACTIVECONDITIONAL(inputState.mouseAdvanceClickState()) || m_mousepos.x != m_prevmousepos.x || m_mousepos.y != m_prevmousepos.y) { m_prevmousepos = m_mousepos; m_mouselastactivity = (int)totalclock; diff --git a/source/build/include/baselayer.h b/source/build/include/baselayer.h index e9838870b..47e8c18e7 100644 --- a/source/build/include/baselayer.h +++ b/source/build/include/baselayer.h @@ -107,12 +107,6 @@ char CONSTEXPR const g_keyAsciiTableShift[128] = { }; // mouse -extern vec2_t g_mousePos; -extern vec2_t g_mouseAbs; -extern bool g_mouseGrabbed; -extern bool g_mouseEnabled; -extern bool g_mouseInsideWindow; -extern bool g_mouseLockedToWindow; // joystick diff --git a/source/build/src/sdlayer.cpp b/source/build/src/sdlayer.cpp index 4948bb273..88ca1dc66 100644 --- a/source/build/src/sdlayer.cpp +++ b/source/build/src/sdlayer.cpp @@ -1783,8 +1783,8 @@ int32_t handleevents_sdlcommon(SDL_Event *ev) if (j < 0) break; - event_t ev = { (ev->button.state == SDL_PRESSED)? EV_KeyDown : EV_KeyUp, 0, j}; - D_PostEvent(ev); + event_t evt = { (ev->button.state == SDL_PRESSED)? EV_KeyDown : EV_KeyUp, 0, j}; + D_PostEvent(&evt); break; } @@ -1867,7 +1867,9 @@ int32_t handleevents_sdlcommon(SDL_Event *ev) // Argh. This is just gross. int scancodetoasciihack(SDL_Event &ev) { + int sc = ev.key.keysym.scancode; SDL_Keycode keyvalue = ev.key.keysym.sym; + int code = keytranslation[sc]; // Modifiers that have to be held down to be effective // (excludes KMOD_NUM, for example). static const int MODIFIERS = diff --git a/source/common/inputstate.h b/source/common/inputstate.h index 26610af62..c15dd4e96 100644 --- a/source/common/inputstate.h +++ b/source/common/inputstate.h @@ -5,9 +5,13 @@ #include "scancodes.h" #include "c_bind.h" #include "d_event.h" +#include "osd.h" + +extern char appactive; typedef uint8_t kb_scancode; + typedef struct { const char* key; @@ -28,6 +32,14 @@ enum extern int32_t CONTROL_ButtonFlags[NUMKEYS]; extern bool CONTROL_BindsEnabled; +extern vec2_t g_mousePos; +extern vec2_t g_mouseAbs; +extern bool g_mouseGrabbed; +extern bool g_mouseEnabled; +extern bool g_mouseInsideWindow; +extern bool g_mouseLockedToWindow; + + // Order is that of EDuke32 by necessity because it exposes the key binds to scripting by index instead of by name. enum GameFunction_t { @@ -297,7 +309,7 @@ public: void keyFlushScans(void) { - Bmemset(&g_keyFIFO, 0, sizeof(g_keyFIFO)); + memset(&g_keyFIFO, 0, sizeof(g_keyFIFO)); g_keyFIFOpos = g_keyFIFOend = 0; } @@ -323,7 +335,7 @@ public: void keyFlushChars(void) { - Bmemset(&g_keyAsciiFIFO, 0, sizeof(g_keyAsciiFIFO)); + memset(&g_keyAsciiFIFO, 0, sizeof(g_keyAsciiFIFO)); g_keyAsciiPos = g_keyAsciiEnd = 0; } @@ -412,9 +424,10 @@ public: } return 0; } - static inline int32_t MouseGetButtons(void) { return mouseReadButtons(); } - static inline void MouseClearButton(int32_t b) { g_mouseBits &= ~b; } - static inline void MouseClearAllButtonss(void) { g_mouseBits = 0; } + + int32_t MouseGetButtons(void) { return mouseReadButtons(); } + inline void MouseClearButton(int32_t b) { g_mouseBits &= ~b; } + inline void MouseClearAllButtonss(void) { g_mouseBits = 0; } }; diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index b0cf9d407..c6800284c 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -5708,7 +5708,6 @@ void G_Shutdown(void) S_SoundShutdown(); S_MusicShutdown(); CONTROL_Shutdown(); - KB_Shutdown(); engineUnInit(); G_Cleanup(); OSD_Cleanup(); diff --git a/source/duke3d/src/menus.cpp b/source/duke3d/src/menus.cpp index 675cea8bc..b4aa013fc 100644 --- a/source/duke3d/src/menus.cpp +++ b/source/duke3d/src/menus.cpp @@ -7060,7 +7060,7 @@ void M_DisplayMenus(void) m_mousewake_watchpoint = 1; #endif - if (MOUSEACTIVECONDITIONAL(mouseAdvanceClickState()) || m_mousepos.x != m_prevmousepos.x || m_mousepos.y != m_prevmousepos.y) + if (MOUSEACTIVECONDITIONAL(inputState.mouseAdvanceClickState()) || m_mousepos.x != m_prevmousepos.x || m_mousepos.y != m_prevmousepos.y) { m_prevmousepos = m_mousepos; m_mouselastactivity = (int32_t) totalclock; diff --git a/source/glbackend/glbackend.cpp b/source/glbackend/glbackend.cpp index 46a16b755..d19a569c3 100644 --- a/source/glbackend/glbackend.cpp +++ b/source/glbackend/glbackend.cpp @@ -78,7 +78,7 @@ void GLInstance::Init() glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glinfo.maxanisotropy); if (!glinfo.dumped) { - osdcmd_glinfo(NULL); + //osdcmd_glinfo(NULL); glinfo.dumped = 1; } new(&renderState) PolymostRenderState; // reset to defaults. diff --git a/source/rr/src/game.cpp b/source/rr/src/game.cpp index d21031383..b27abf05c 100644 --- a/source/rr/src/game.cpp +++ b/source/rr/src/game.cpp @@ -7075,7 +7075,6 @@ void G_Shutdown(void) S_SoundShutdown(); S_MusicShutdown(); CONTROL_Shutdown(); - KB_Shutdown(); G_SetFog(0); engineUnInit(); G_Cleanup(); diff --git a/source/rr/src/menus.cpp b/source/rr/src/menus.cpp index f634a6021..d5018b6df 100644 --- a/source/rr/src/menus.cpp +++ b/source/rr/src/menus.cpp @@ -7540,7 +7540,7 @@ void M_DisplayMenus(void) m_mousewake_watchpoint = 1; #endif - if (MOUSEACTIVECONDITIONAL(mouseAdvanceClickState()) || m_mousepos.x != m_prevmousepos.x || m_mousepos.y != m_prevmousepos.y) + if (MOUSEACTIVECONDITIONAL(inputState.mouseAdvanceClickState()) || m_mousepos.x != m_prevmousepos.x || m_mousepos.y != m_prevmousepos.y) { m_prevmousepos = m_mousepos; m_mouselastactivity = (int32_t) totalclock; diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index d2ba1adc2..4ea41dac1 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -662,10 +662,6 @@ TerminateGame(void) //TenScreen(); } - ////--->>>> sound stuff was there - //uninitkeys(); - KB_Shutdown(); - engineUnInit(); G_SaveConfig(); @@ -774,7 +770,6 @@ void MultiSharewareCheck(void) //uninitmultiplayers(); //uninitkeys(); G_SaveConfig(); - KB_Shutdown(); engineUnInit(); UnInitSound(); timerUninit();