mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
- consolidate the 3 instances of input.cpp.
Some stuff had to be disabled to make it work but that's hardly relevant considering that the goal is to transition off MACT for input handling.
This commit is contained in:
parent
954d3b14dc
commit
5148fc877d
18 changed files with 23 additions and 1018 deletions
|
@ -739,6 +739,7 @@ set (PCH_SOURCES
|
|||
mact/src/control.cpp
|
||||
mact/src/joystick.cpp
|
||||
mact/src/keyboard.cpp
|
||||
mact/src/input.cpp
|
||||
|
||||
thirdparty/src/sjson.cpp
|
||||
thirdparty/src/crc32.cpp
|
||||
|
|
|
@ -81,7 +81,6 @@ set( PCH_SOURCES
|
|||
src/gib.cpp
|
||||
src/globals.cpp
|
||||
src/inifile.cpp
|
||||
src/input.cpp
|
||||
src/iob.cpp
|
||||
src/levels.cpp
|
||||
src/loadsave.cpp
|
||||
|
|
|
@ -1,411 +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 "ns.h" // Must come before everything else!
|
||||
//#include "global.h"
|
||||
//#include "game.h"
|
||||
#include "gamecontrol.h"
|
||||
#include "keyboard.h"
|
||||
#include "mouse.h"
|
||||
#include "joystick.h"
|
||||
#include "control.h"
|
||||
#include "input.h"
|
||||
#include "menus.h"
|
||||
#include "gamemenu.h"
|
||||
#include "inputstate.h"
|
||||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
|
||||
int32_t I_CheckAllInput(void)
|
||||
{
|
||||
return
|
||||
KB_KeyWaiting()
|
||||
|| MOUSE_GetButtons()
|
||||
|| JOYSTICK_GetButtons()
|
||||
#if defined EDUKE32_IOS
|
||||
|| g_mouseClickState == MOUSE_PRESSED
|
||||
#endif
|
||||
;
|
||||
}
|
||||
void I_ClearAllInput(void)
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeysDown();
|
||||
MOUSE_ClearAllButtons();
|
||||
JOYSTICK_ClearAllButtons();
|
||||
inputState.ClearAllButtons();
|
||||
#if defined EDUKE32_IOS
|
||||
mouseAdvanceClickState();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int32_t I_TextSubmit(void)
|
||||
{
|
||||
return
|
||||
KB_KeyPressed(sc_Enter)
|
||||
|| KB_KeyPressed(sc_kpad_Enter)
|
||||
#if !defined EDUKE32_TOUCH_DEVICES
|
||||
|| MOUSEINACTIVECONDITIONAL(MOUSE_GetButtons()&LEFT_MOUSE)
|
||||
#endif
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_A))
|
||||
#if defined(GEKKO)
|
||||
|| MOUSEINACTIVECONDITIONAL(JOYSTICK_GetButtons()&WII_A)
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
void I_TextSubmitClear(void)
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeyDown(sc_kpad_Enter);
|
||||
KB_ClearKeyDown(sc_Enter);
|
||||
MOUSE_ClearButton(LEFT_MOUSE);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_A);
|
||||
#if defined(GEKKO)
|
||||
JOYSTICK_ClearButton(WII_A);
|
||||
#endif
|
||||
}
|
||||
|
||||
int32_t I_AdvanceTrigger(void)
|
||||
{
|
||||
return
|
||||
I_TextSubmit()
|
||||
|| KB_KeyPressed(sc_Space);
|
||||
}
|
||||
|
||||
void I_AdvanceTriggerClear(void)
|
||||
{
|
||||
I_TextSubmitClear();
|
||||
KB_ClearKeyDown(sc_Space);
|
||||
}
|
||||
|
||||
int32_t I_ReturnTrigger(void)
|
||||
{
|
||||
return
|
||||
KB_KeyPressed(sc_Escape)
|
||||
|| (MOUSE_GetButtons()&RIGHT_MOUSE)
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_B))
|
||||
#if defined(GEKKO)
|
||||
|| (JOYSTICK_GetButtons()&(WII_B|WII_HOME))
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
void I_ReturnTriggerClear(void)
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeyDown(sc_Escape);
|
||||
MOUSE_ClearButton(RIGHT_MOUSE);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_B);
|
||||
#if defined(GEKKO)
|
||||
JOYSTICK_ClearButton(WII_B);
|
||||
JOYSTICK_ClearButton(WII_HOME);
|
||||
#endif
|
||||
}
|
||||
|
||||
int32_t I_GeneralTrigger(void)
|
||||
{
|
||||
return
|
||||
I_AdvanceTrigger()
|
||||
|| I_ReturnTrigger()
|
||||
#if !defined GEKKO
|
||||
|| BUTTON(gamefunc_Open)
|
||||
# if !defined EDUKE32_TOUCH_DEVICES
|
||||
|| MOUSEINACTIVECONDITIONAL(BUTTON(gamefunc_Weapon_Fire))
|
||||
# else
|
||||
|| BUTTON(gamefunc_Fire)
|
||||
# endif
|
||||
#endif
|
||||
|| BUTTON(gamefunc_Crouch)
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_START))
|
||||
;
|
||||
}
|
||||
|
||||
void I_GeneralTriggerClear(void)
|
||||
{
|
||||
I_AdvanceTriggerClear();
|
||||
I_ReturnTriggerClear();
|
||||
#if !defined GEKKO
|
||||
inputState.ClearButton(gamefunc_Open);
|
||||
inputState.ClearButton(gamefunc_Weapon_Fire);
|
||||
#endif
|
||||
inputState.ClearButton(gamefunc_Crouch);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_START);
|
||||
}
|
||||
|
||||
|
||||
int32_t I_EscapeTrigger(void)
|
||||
{
|
||||
return
|
||||
KB_KeyPressed(sc_Escape)
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_START))
|
||||
#if defined(GEKKO)
|
||||
|| (JOYSTICK_GetButtons()&WII_HOME)
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
void I_EscapeTriggerClear(void)
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeyDown(sc_Escape);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_START);
|
||||
#if defined(GEKKO)
|
||||
JOYSTICK_ClearButton(WII_HOME);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int32_t I_MenuUp(void)
|
||||
{
|
||||
return
|
||||
KB_KeyPressed(sc_UpArrow)
|
||||
|| KB_KeyPressed(sc_kpad_8)
|
||||
|| (MOUSE_GetButtons()&WHEELUP_MOUSE)
|
||||
|| BUTTON(gamefunc_Move_Forward)
|
||||
|| (JOYSTICK_GetHat(0)&HAT_UP)
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_DPAD_UP))
|
||||
|| CONTROL_GetGameControllerDigitalAxisNeg(GAMECONTROLLER_AXIS_LEFTY)
|
||||
;
|
||||
}
|
||||
|
||||
void I_MenuUpClear(void)
|
||||
{
|
||||
KB_ClearKeyDown(sc_UpArrow);
|
||||
KB_ClearKeyDown(sc_kpad_8);
|
||||
MOUSE_ClearButton(WHEELUP_MOUSE);
|
||||
inputState.ClearButton(gamefunc_Move_Forward);
|
||||
JOYSTICK_ClearHat(0);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_DPAD_UP);
|
||||
CONTROL_ClearGameControllerDigitalAxisNeg(GAMECONTROLLER_AXIS_LEFTY);
|
||||
}
|
||||
|
||||
|
||||
int32_t I_MenuDown(void)
|
||||
{
|
||||
return
|
||||
KB_KeyPressed(sc_DownArrow)
|
||||
|| KB_KeyPressed(sc_kpad_2)
|
||||
|| (MOUSE_GetButtons()&WHEELDOWN_MOUSE)
|
||||
|| BUTTON(gamefunc_Move_Backward)
|
||||
|| (JOYSTICK_GetHat(0)&HAT_DOWN)
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_DPAD_DOWN))
|
||||
|| CONTROL_GetGameControllerDigitalAxisPos(GAMECONTROLLER_AXIS_LEFTY)
|
||||
;
|
||||
}
|
||||
|
||||
void I_MenuDownClear(void)
|
||||
{
|
||||
KB_ClearKeyDown(sc_DownArrow);
|
||||
KB_ClearKeyDown(sc_kpad_2);
|
||||
KB_ClearKeyDown(sc_PgDn);
|
||||
MOUSE_ClearButton(WHEELDOWN_MOUSE);
|
||||
inputState.ClearButton(gamefunc_Move_Backward);
|
||||
JOYSTICK_ClearHat(0);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_DPAD_DOWN);
|
||||
CONTROL_ClearGameControllerDigitalAxisPos(GAMECONTROLLER_AXIS_LEFTY);
|
||||
}
|
||||
|
||||
|
||||
int32_t I_MenuLeft(void)
|
||||
{
|
||||
return
|
||||
KB_KeyPressed(sc_LeftArrow)
|
||||
|| KB_KeyPressed(sc_kpad_4)
|
||||
|| (SHIFTS_IS_PRESSED && KB_KeyPressed(sc_Tab))
|
||||
|| BUTTON(gamefunc_Turn_Left)
|
||||
|| BUTTON(gamefunc_Strafe_Left)
|
||||
|| (JOYSTICK_GetHat(0)&HAT_LEFT)
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_DPAD_LEFT))
|
||||
|| CONTROL_GetGameControllerDigitalAxisNeg(GAMECONTROLLER_AXIS_LEFTX)
|
||||
;
|
||||
}
|
||||
|
||||
void I_MenuLeftClear(void)
|
||||
{
|
||||
KB_ClearKeyDown(sc_LeftArrow);
|
||||
KB_ClearKeyDown(sc_kpad_4);
|
||||
KB_ClearKeyDown(sc_Tab);
|
||||
inputState.ClearButton(gamefunc_Turn_Left);
|
||||
inputState.ClearButton(gamefunc_Strafe_Left);
|
||||
JOYSTICK_ClearHat(0);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_DPAD_LEFT);
|
||||
CONTROL_ClearGameControllerDigitalAxisNeg(GAMECONTROLLER_AXIS_LEFTX);
|
||||
}
|
||||
|
||||
|
||||
int32_t I_MenuRight(void)
|
||||
{
|
||||
return
|
||||
KB_KeyPressed(sc_RightArrow)
|
||||
|| KB_KeyPressed(sc_kpad_6)
|
||||
|| (!SHIFTS_IS_PRESSED && KB_KeyPressed(sc_Tab))
|
||||
|| BUTTON(gamefunc_Turn_Right)
|
||||
|| BUTTON(gamefunc_Strafe_Right)
|
||||
|| (MOUSE_GetButtons()&MIDDLE_MOUSE)
|
||||
|| (JOYSTICK_GetHat(0)&HAT_RIGHT)
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_DPAD_RIGHT))
|
||||
|| CONTROL_GetGameControllerDigitalAxisPos(GAMECONTROLLER_AXIS_LEFTX)
|
||||
;
|
||||
}
|
||||
|
||||
void I_MenuRightClear(void)
|
||||
{
|
||||
KB_ClearKeyDown(sc_RightArrow);
|
||||
KB_ClearKeyDown(sc_kpad_6);
|
||||
KB_ClearKeyDown(sc_Tab);
|
||||
inputState.ClearButton(gamefunc_Turn_Right);
|
||||
inputState.ClearButton(gamefunc_Strafe_Right);
|
||||
MOUSE_ClearButton(MIDDLE_MOUSE);
|
||||
JOYSTICK_ClearHat(0);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_DPAD_RIGHT);
|
||||
CONTROL_ClearGameControllerDigitalAxisPos(GAMECONTROLLER_AXIS_LEFTX);
|
||||
}
|
||||
|
||||
|
||||
int32_t I_PanelUp(void)
|
||||
{
|
||||
return
|
||||
I_MenuUp()
|
||||
|| I_MenuLeft()
|
||||
|| KB_KeyPressed(sc_PgUp)
|
||||
;
|
||||
}
|
||||
|
||||
void I_PanelUpClear(void)
|
||||
{
|
||||
I_MenuUpClear();
|
||||
I_MenuLeftClear();
|
||||
KB_ClearKeyDown(sc_PgUp);
|
||||
}
|
||||
|
||||
|
||||
int32_t I_PanelDown(void)
|
||||
{
|
||||
return
|
||||
I_MenuDown()
|
||||
|| I_MenuRight()
|
||||
|| KB_KeyPressed(sc_PgDn)
|
||||
|| I_AdvanceTrigger()
|
||||
;
|
||||
}
|
||||
|
||||
void I_PanelDownClear(void)
|
||||
{
|
||||
I_MenuDownClear();
|
||||
I_MenuRightClear();
|
||||
KB_ClearKeyDown(sc_PgDn);
|
||||
I_AdvanceTriggerClear();
|
||||
}
|
||||
|
||||
|
||||
int32_t I_SliderLeft(void)
|
||||
{
|
||||
return
|
||||
I_MenuLeft()
|
||||
#if !defined EDUKE32_TOUCH_DEVICES
|
||||
|| MOUSEINACTIVECONDITIONAL((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELUP_MOUSE))
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
void I_SliderLeftClear(void)
|
||||
{
|
||||
I_MenuLeftClear();
|
||||
MOUSE_ClearButton(WHEELUP_MOUSE);
|
||||
}
|
||||
|
||||
|
||||
int32_t I_SliderRight(void)
|
||||
{
|
||||
return
|
||||
I_MenuRight()
|
||||
#if !defined EDUKE32_TOUCH_DEVICES
|
||||
|| MOUSEINACTIVECONDITIONAL((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELDOWN_MOUSE))
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
void I_SliderRightClear(void)
|
||||
{
|
||||
I_MenuRightClear();
|
||||
MOUSE_ClearButton(WHEELDOWN_MOUSE);
|
||||
}
|
||||
|
||||
|
||||
int32_t I_EnterText(char *t, int32_t maxlength, int32_t flags)
|
||||
{
|
||||
char ch;
|
||||
int32_t inputloc = Bstrlen(typebuf);
|
||||
|
||||
while ((ch = KB_GetCh()) != 0)
|
||||
{
|
||||
if (ch == asc_BackSpace)
|
||||
{
|
||||
if (inputloc > 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;
|
||||
}
|
||||
|
||||
END_BLD_NS
|
|
@ -1,77 +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_
|
||||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
#define WIN_IS_PRESSED ( inputState.WinPressed() )
|
||||
#define ALT_IS_PRESSED ( inputState.AltPressed() )
|
||||
#define SHIFTS_IS_PRESSED ( inputState.ShiftPressed() )
|
||||
|
||||
extern int32_t I_CheckAllInput(void);
|
||||
extern void I_ClearAllInput(void);
|
||||
|
||||
// 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);
|
||||
extern int32_t I_ReturnTrigger(void);
|
||||
extern void I_ReturnTriggerClear(void);
|
||||
extern int32_t I_GeneralTrigger(void);
|
||||
extern void I_GeneralTriggerClear(void);
|
||||
extern int32_t I_EscapeTrigger(void);
|
||||
extern void I_EscapeTriggerClear(void);
|
||||
|
||||
extern int32_t I_MenuUp(void);
|
||||
extern void I_MenuUpClear(void);
|
||||
extern int32_t I_MenuDown(void);
|
||||
extern void I_MenuDownClear(void);
|
||||
extern int32_t I_MenuLeft(void);
|
||||
extern void I_MenuLeftClear(void);
|
||||
extern int32_t I_MenuRight(void);
|
||||
extern void I_MenuRightClear(void);
|
||||
|
||||
extern int32_t I_PanelUp(void);
|
||||
extern void I_PanelUpClear(void);
|
||||
extern int32_t I_PanelDown(void);
|
||||
extern void I_PanelDownClear(void);
|
||||
|
||||
extern int32_t I_SliderLeft(void);
|
||||
extern void I_SliderLeftClear(void);
|
||||
extern int32_t I_SliderRight(void);
|
||||
extern void I_SliderRightClear(void);
|
||||
|
||||
|
||||
enum EnterTextFlags_t {
|
||||
INPUT_NUMERIC = 0x00000001,
|
||||
};
|
||||
|
||||
extern int32_t I_EnterText(char *t, int32_t maxlength, int32_t flags);
|
||||
|
||||
END_BLD_NS
|
||||
|
||||
#endif
|
|
@ -532,9 +532,6 @@ extern MenuGameplayStemEntry g_MenuGameplayEntries[MAXMENUGAMEPLAYENTRIES];
|
|||
extern MenuEntry_t ME_NEWGAMECUSTOMENTRIES[MAXMENUGAMEPLAYENTRIES];
|
||||
extern MenuEntry_t ME_NEWGAMECUSTOMSUBENTRIES[MAXMENUGAMEPLAYENTRIES][MAXMENUGAMEPLAYENTRIES];
|
||||
|
||||
#define TYPEBUFSIZE 141
|
||||
extern char typebuf[TYPEBUFSIZE];
|
||||
|
||||
END_BLD_NS
|
||||
|
||||
#endif
|
||||
|
|
|
@ -56,7 +56,6 @@ set( PCH_SOURCES
|
|||
src/gamevars.cpp
|
||||
src/global.cpp
|
||||
src/grpscan.cpp
|
||||
src/input.cpp
|
||||
src/menus.cpp
|
||||
src/namesdyn.cpp
|
||||
src/network.cpp
|
||||
|
|
|
@ -76,8 +76,6 @@ G_EXTERN char pus,pub;
|
|||
G_EXTERN char ready2send;
|
||||
#define MAXPLAYERNAME 32
|
||||
G_EXTERN char tempbuf[MAXSECTORS<<1],packbuf[PACKBUF_SIZE],buf[1024];
|
||||
#define TYPEBUFSIZE 141
|
||||
G_EXTERN char typebuf[TYPEBUFSIZE];
|
||||
|
||||
|
||||
G_EXTERN input_t localInput;
|
||||
|
|
|
@ -23,7 +23,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#ifndef input_h_
|
||||
#define input_h_
|
||||
|
||||
BEGIN_DUKE_NS
|
||||
|
||||
enum {
|
||||
TYPEBUFSIZE = 141
|
||||
};
|
||||
extern char typebuf[TYPEBUFSIZE];
|
||||
|
||||
|
||||
extern int32_t I_CheckAllInput(void);
|
||||
|
@ -69,6 +73,4 @@ enum EnterTextFlags_t {
|
|||
|
||||
extern int32_t I_EnterText(char *t, int32_t maxlength, int32_t flags);
|
||||
|
||||
END_DUKE_NS
|
||||
|
||||
#endif
|
|
@ -20,20 +20,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#include "ns.h" // Must come before everything else!
|
||||
|
||||
#include "global.h"
|
||||
#include "game.h"
|
||||
#include "gamecontrol.h"
|
||||
#include "keyboard.h"
|
||||
#include "mouse.h"
|
||||
#include "joystick.h"
|
||||
#include "control.h"
|
||||
#include "input.h"
|
||||
#include "menus.h"
|
||||
#include "inputstate.h"
|
||||
|
||||
BEGIN_DUKE_NS
|
||||
char typebuf[TYPEBUFSIZE];
|
||||
|
||||
|
||||
|
||||
int32_t I_CheckAllInput(void)
|
||||
|
@ -41,11 +37,7 @@ int32_t I_CheckAllInput(void)
|
|||
return
|
||||
KB_KeyWaiting()
|
||||
|| MOUSE_GetButtons()
|
||||
|| JOYSTICK_GetButtons()
|
||||
#if defined EDUKE32_IOS
|
||||
|| g_mouseClickState == MOUSE_PRESSED
|
||||
#endif
|
||||
;
|
||||
|| JOYSTICK_GetButtons();
|
||||
}
|
||||
void I_ClearAllInput(void)
|
||||
{
|
||||
|
@ -54,9 +46,6 @@ void I_ClearAllInput(void)
|
|||
MOUSE_ClearAllButtons();
|
||||
JOYSTICK_ClearAllButtons();
|
||||
inputState.ClearAllButtons();
|
||||
#if defined EDUKE32_IOS
|
||||
mouseAdvanceClickState();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -65,14 +54,8 @@ int32_t I_TextSubmit(void)
|
|||
return
|
||||
KB_KeyPressed(sc_Enter)
|
||||
|| KB_KeyPressed(sc_kpad_Enter)
|
||||
#if !defined EDUKE32_TOUCH_DEVICES
|
||||
|| MOUSEINACTIVECONDITIONAL(MOUSE_GetButtons()&LEFT_MOUSE)
|
||||
#endif
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_A))
|
||||
#if defined(GEKKO)
|
||||
|| MOUSEINACTIVECONDITIONAL(JOYSTICK_GetButtons()&WII_A)
|
||||
#endif
|
||||
;
|
||||
//|| MOUSEINACTIVECONDITIONAL(MOUSE_GetButtons()&LEFT_MOUSE)
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_A));
|
||||
}
|
||||
|
||||
void I_TextSubmitClear(void)
|
||||
|
@ -82,9 +65,6 @@ void I_TextSubmitClear(void)
|
|||
KB_ClearKeyDown(sc_Enter);
|
||||
MOUSE_ClearButton(LEFT_MOUSE);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_A);
|
||||
#if defined(GEKKO)
|
||||
JOYSTICK_ClearButton(WII_A);
|
||||
#endif
|
||||
}
|
||||
|
||||
int32_t I_AdvanceTrigger(void)
|
||||
|
@ -105,11 +85,7 @@ int32_t I_ReturnTrigger(void)
|
|||
return
|
||||
KB_KeyPressed(sc_Escape)
|
||||
|| (MOUSE_GetButtons()&RIGHT_MOUSE)
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_B))
|
||||
#if defined(GEKKO)
|
||||
|| (JOYSTICK_GetButtons()&(WII_B|WII_HOME))
|
||||
#endif
|
||||
;
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_B));
|
||||
}
|
||||
|
||||
void I_ReturnTriggerClear(void)
|
||||
|
@ -118,10 +94,6 @@ void I_ReturnTriggerClear(void)
|
|||
KB_ClearKeyDown(sc_Escape);
|
||||
MOUSE_ClearButton(RIGHT_MOUSE);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_B);
|
||||
#if defined(GEKKO)
|
||||
JOYSTICK_ClearButton(WII_B);
|
||||
JOYSTICK_ClearButton(WII_HOME);
|
||||
#endif
|
||||
}
|
||||
|
||||
int32_t I_GeneralTrigger(void)
|
||||
|
@ -129,27 +101,18 @@ int32_t I_GeneralTrigger(void)
|
|||
return
|
||||
I_AdvanceTrigger()
|
||||
|| I_ReturnTrigger()
|
||||
#if !defined GEKKO
|
||||
|| BUTTON(gamefunc_Open)
|
||||
# if !defined EDUKE32_TOUCH_DEVICES
|
||||
|| MOUSEINACTIVECONDITIONAL(BUTTON(gamefunc_Fire))
|
||||
# else
|
||||
|| BUTTON(gamefunc_Fire)
|
||||
# endif
|
||||
#endif
|
||||
//|| MOUSEINACTIVECONDITIONAL(BUTTON(gamefunc_Fire))
|
||||
|| BUTTON(gamefunc_Crouch)
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_START))
|
||||
;
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_START));
|
||||
}
|
||||
|
||||
void I_GeneralTriggerClear(void)
|
||||
{
|
||||
I_AdvanceTriggerClear();
|
||||
I_ReturnTriggerClear();
|
||||
#if !defined GEKKO
|
||||
inputState.ClearButton(gamefunc_Open);
|
||||
inputState.ClearButton(gamefunc_Fire);
|
||||
#endif
|
||||
inputState.ClearButton(gamefunc_Crouch);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_START);
|
||||
}
|
||||
|
@ -159,11 +122,7 @@ int32_t I_EscapeTrigger(void)
|
|||
{
|
||||
return
|
||||
KB_KeyPressed(sc_Escape)
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_START))
|
||||
#if defined(GEKKO)
|
||||
|| (JOYSTICK_GetButtons()&WII_HOME)
|
||||
#endif
|
||||
;
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_START));
|
||||
}
|
||||
|
||||
void I_EscapeTriggerClear(void)
|
||||
|
@ -171,9 +130,6 @@ void I_EscapeTriggerClear(void)
|
|||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeyDown(sc_Escape);
|
||||
JOYSTICK_ClearGameControllerButton(1<<GAMECONTROLLER_BUTTON_START);
|
||||
#if defined(GEKKO)
|
||||
JOYSTICK_ClearButton(WII_HOME);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -186,8 +142,7 @@ int32_t I_MenuUp(void)
|
|||
|| BUTTON(gamefunc_Move_Forward)
|
||||
|| (JOYSTICK_GetHat(0)&HAT_UP)
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_DPAD_UP))
|
||||
|| CONTROL_GetGameControllerDigitalAxisNeg(GAMECONTROLLER_AXIS_LEFTY)
|
||||
;
|
||||
|| CONTROL_GetGameControllerDigitalAxisNeg(GAMECONTROLLER_AXIS_LEFTY);
|
||||
}
|
||||
|
||||
void I_MenuUpClear(void)
|
||||
|
@ -211,8 +166,7 @@ int32_t I_MenuDown(void)
|
|||
|| BUTTON(gamefunc_Move_Backward)
|
||||
|| (JOYSTICK_GetHat(0)&HAT_DOWN)
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_DPAD_DOWN))
|
||||
|| CONTROL_GetGameControllerDigitalAxisPos(GAMECONTROLLER_AXIS_LEFTY)
|
||||
;
|
||||
|| CONTROL_GetGameControllerDigitalAxisPos(GAMECONTROLLER_AXIS_LEFTY);
|
||||
}
|
||||
|
||||
void I_MenuDownClear(void)
|
||||
|
@ -233,13 +187,12 @@ int32_t I_MenuLeft(void)
|
|||
return
|
||||
KB_KeyPressed(sc_LeftArrow)
|
||||
|| KB_KeyPressed(sc_kpad_4)
|
||||
|| (SHIFTS_IS_PRESSED && KB_KeyPressed(sc_Tab))
|
||||
|| (inputState.ShiftPressed() && KB_KeyPressed(sc_Tab))
|
||||
|| BUTTON(gamefunc_Turn_Left)
|
||||
|| BUTTON(gamefunc_Strafe_Left)
|
||||
|| (JOYSTICK_GetHat(0)&HAT_LEFT)
|
||||
|| (JOYSTICK_GetGameControllerButtons()&(1<<GAMECONTROLLER_BUTTON_DPAD_LEFT))
|
||||
|| CONTROL_GetGameControllerDigitalAxisNeg(GAMECONTROLLER_AXIS_LEFTX)
|
||||
;
|
||||
|| CONTROL_GetGameControllerDigitalAxisNeg(GAMECONTROLLER_AXIS_LEFTX);
|
||||
}
|
||||
|
||||
void I_MenuLeftClear(void)
|
||||
|
@ -260,7 +213,7 @@ int32_t I_MenuRight(void)
|
|||
return
|
||||
KB_KeyPressed(sc_RightArrow)
|
||||
|| KB_KeyPressed(sc_kpad_6)
|
||||
|| (!SHIFTS_IS_PRESSED && KB_KeyPressed(sc_Tab))
|
||||
|| (!inputState.ShiftPressed() && KB_KeyPressed(sc_Tab))
|
||||
|| BUTTON(gamefunc_Turn_Right)
|
||||
|| BUTTON(gamefunc_Strafe_Right)
|
||||
|| (MOUSE_GetButtons()&MIDDLE_MOUSE)
|
||||
|
@ -325,7 +278,7 @@ int32_t I_SliderLeft(void)
|
|||
return
|
||||
I_MenuLeft()
|
||||
#if !defined EDUKE32_TOUCH_DEVICES
|
||||
|| MOUSEINACTIVECONDITIONAL((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELUP_MOUSE))
|
||||
//|| MOUSEINACTIVECONDITIONAL((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELUP_MOUSE))
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
@ -342,7 +295,7 @@ int32_t I_SliderRight(void)
|
|||
return
|
||||
I_MenuRight()
|
||||
#if !defined EDUKE32_TOUCH_DEVICES
|
||||
|| MOUSEINACTIVECONDITIONAL((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELDOWN_MOUSE))
|
||||
//|| MOUSEINACTIVECONDITIONAL((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELDOWN_MOUSE))
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
@ -357,7 +310,7 @@ void I_SliderRightClear(void)
|
|||
int32_t I_EnterText(char *t, int32_t maxlength, int32_t flags)
|
||||
{
|
||||
char ch;
|
||||
int32_t inputloc = Bstrlen(typebuf);
|
||||
int32_t inputloc = strlen(typebuf);
|
||||
|
||||
while ((ch = KB_GetCh()) != 0)
|
||||
{
|
||||
|
@ -408,4 +361,3 @@ int32_t I_EnterText(char *t, int32_t maxlength, int32_t flags)
|
|||
return 0;
|
||||
}
|
||||
|
||||
END_DUKE_NS
|
|
@ -37,7 +37,6 @@ set( PLAT_SOURCES
|
|||
endif()
|
||||
|
||||
set( NOT_COMPILED_SOURCE_FILES
|
||||
src/gamestructures.cpp
|
||||
)
|
||||
|
||||
set_source_files_properties( ${NOT_COMPILED_SOURCE_FILES} PROPERTIES HEADER_FILE_ONLY TRUE )
|
||||
|
@ -53,10 +52,8 @@ set( PCH_SOURCES
|
|||
src/game.cpp
|
||||
src/gamedef.cpp
|
||||
src/gameexec.cpp
|
||||
src/gamevars.cpp
|
||||
src/global.cpp
|
||||
src/grpscan.cpp
|
||||
src/input.cpp
|
||||
src/menus.cpp
|
||||
src/namesdyn.cpp
|
||||
src/net.cpp
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
|
||||
#ifndef EDUKE32_EVENTS_DEFS_H_
|
||||
#define EDUKE32_EVENTS_DEFS_H_
|
||||
|
||||
#endif
|
|
@ -67,8 +67,6 @@ double g_actorTotalMs[MAXTILES], g_actorMinMs[MAXTILES], g_actorMaxMs[MAXTILES];
|
|||
|
||||
GAMEEXEC_STATIC void VM_Execute(native_t loop);
|
||||
|
||||
# include "gamestructures.cpp"
|
||||
|
||||
#define VM_CONDITIONAL(xxx) \
|
||||
{ \
|
||||
if ((xxx) || ((insptr = (intptr_t *)*(insptr + 1)) && (((*insptr) & VM_INSTMASK) == CON_ELSE))) \
|
||||
|
|
|
@ -26,7 +26,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "build.h"
|
||||
#include "sector.h" // mapstate_t
|
||||
#include "gamedef.h" // vmstate_t
|
||||
#include "events_defs.h"
|
||||
|
||||
BEGIN_RR_NS
|
||||
|
||||
|
|
|
@ -1,21 +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.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
|
@ -83,8 +83,6 @@ G_EXTERN char ready2send;
|
|||
#define MAXPLAYERNAME 32
|
||||
G_EXTERN char tempbuf[MAXSECTORS<<1],buf[1024];
|
||||
G_EXTERN uint8_t packbuf[PACKBUF_SIZE];
|
||||
#define TYPEBUFSIZE 141
|
||||
G_EXTERN char typebuf[TYPEBUFSIZE];
|
||||
|
||||
|
||||
G_EXTERN input_t localInput;
|
||||
|
|
|
@ -1,351 +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 "ns.h" // Must come before everything else!
|
||||
|
||||
#include "global.h"
|
||||
#include "game.h"
|
||||
#include "gamecontrol.h"
|
||||
#include "keyboard.h"
|
||||
#include "mouse.h"
|
||||
#include "joystick.h"
|
||||
#include "control.h"
|
||||
#include "input.h"
|
||||
#include "menus.h"
|
||||
|
||||
BEGIN_RR_NS
|
||||
|
||||
|
||||
int32_t I_CheckAllInput(void)
|
||||
{
|
||||
return (
|
||||
#if defined EDUKE32_IOS
|
||||
g_mouseClickState == MOUSE_PRESSED ||
|
||||
#endif
|
||||
KB_KeyWaiting() ||
|
||||
MOUSE_GetButtons() ||
|
||||
JOYSTICK_GetButtons()
|
||||
);
|
||||
}
|
||||
void I_ClearAllInput(void)
|
||||
{
|
||||
#if defined EDUKE32_IOS
|
||||
mouseAdvanceClickState();
|
||||
#endif
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeysDown();
|
||||
MOUSE_ClearAllButtons();
|
||||
JOYSTICK_ClearAllButtons();
|
||||
}
|
||||
|
||||
|
||||
int32_t I_AdvanceTrigger(void)
|
||||
{
|
||||
return (
|
||||
KB_KeyPressed(sc_kpad_Enter) ||
|
||||
KB_KeyPressed(sc_Enter) ||
|
||||
#if !defined EDUKE32_TOUCH_DEVICES
|
||||
MOUSEINACTIVECONDITIONAL(MOUSE_GetButtons()&LEFT_MOUSE) ||
|
||||
#endif
|
||||
#if defined(GEKKO)
|
||||
MOUSEINACTIVECONDITIONAL(JOYSTICK_GetButtons()&WII_A)
|
||||
#else
|
||||
BUTTON(gamefunc_Open) ||
|
||||
# if !defined EDUKE32_TOUCH_DEVICES
|
||||
MOUSEINACTIVECONDITIONAL(BUTTON(gamefunc_Fire))
|
||||
# else
|
||||
BUTTON(gamefunc_Fire)
|
||||
# endif
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
void I_AdvanceTriggerClear(void)
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeyDown(sc_kpad_Enter);
|
||||
KB_ClearKeyDown(sc_Enter);
|
||||
MOUSE_ClearButton(LEFT_MOUSE);
|
||||
#if defined(GEKKO)
|
||||
JOYSTICK_ClearButton(WII_A);
|
||||
#else
|
||||
inputState.ClearButton(gamefunc_Open);
|
||||
inputState.ClearButton(gamefunc_Fire);
|
||||
#endif
|
||||
}
|
||||
|
||||
int32_t I_ReturnTrigger(void)
|
||||
{
|
||||
return (
|
||||
KB_KeyPressed(sc_Escape) ||
|
||||
(MOUSE_GetButtons()&RIGHT_MOUSE) ||
|
||||
BUTTON(gamefunc_Crouch)
|
||||
#if defined(GEKKO)
|
||||
|| (JOYSTICK_GetButtons()&(WII_B|WII_HOME))
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
void I_ReturnTriggerClear(void)
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeyDown(sc_Escape);
|
||||
MOUSE_ClearButton(RIGHT_MOUSE);
|
||||
inputState.ClearButton(gamefunc_Crouch);
|
||||
#if defined(GEKKO)
|
||||
JOYSTICK_ClearButton(WII_B);
|
||||
JOYSTICK_ClearButton(WII_HOME);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int32_t I_EscapeTrigger(void)
|
||||
{
|
||||
return (
|
||||
KB_KeyPressed(sc_Escape)
|
||||
#if defined(GEKKO)
|
||||
|| (JOYSTICK_GetButtons()&WII_HOME)
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
void I_EscapeTriggerClear(void)
|
||||
{
|
||||
KB_FlushKeyboardQueue();
|
||||
KB_ClearKeyDown(sc_Escape);
|
||||
#if defined(GEKKO)
|
||||
JOYSTICK_ClearButton(WII_HOME);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int32_t I_MenuUp(void)
|
||||
{
|
||||
return (
|
||||
KB_KeyPressed(sc_UpArrow) ||
|
||||
KB_KeyPressed(sc_kpad_8) ||
|
||||
(MOUSE_GetButtons()&WHEELUP_MOUSE) ||
|
||||
BUTTON(gamefunc_Move_Forward) ||
|
||||
(JOYSTICK_GetHat(0)&HAT_UP)
|
||||
);
|
||||
}
|
||||
|
||||
void I_MenuUpClear(void)
|
||||
{
|
||||
KB_ClearKeyDown(sc_UpArrow);
|
||||
KB_ClearKeyDown(sc_kpad_8);
|
||||
MOUSE_ClearButton(WHEELUP_MOUSE);
|
||||
inputState.ClearButton(gamefunc_Move_Forward);
|
||||
JOYSTICK_ClearHat(0);
|
||||
}
|
||||
|
||||
|
||||
int32_t I_MenuDown(void)
|
||||
{
|
||||
return (
|
||||
KB_KeyPressed(sc_DownArrow) ||
|
||||
KB_KeyPressed(sc_kpad_2) ||
|
||||
(MOUSE_GetButtons()&WHEELDOWN_MOUSE) ||
|
||||
BUTTON(gamefunc_Move_Backward) ||
|
||||
(JOYSTICK_GetHat(0)&HAT_DOWN)
|
||||
);
|
||||
}
|
||||
|
||||
void I_MenuDownClear(void)
|
||||
{
|
||||
KB_ClearKeyDown(sc_DownArrow);
|
||||
KB_ClearKeyDown(sc_kpad_2);
|
||||
KB_ClearKeyDown(sc_PgDn);
|
||||
MOUSE_ClearButton(WHEELDOWN_MOUSE);
|
||||
inputState.ClearButton(gamefunc_Move_Backward);
|
||||
JOYSTICK_ClearHat(0);
|
||||
}
|
||||
|
||||
|
||||
int32_t I_MenuLeft(void)
|
||||
{
|
||||
return (
|
||||
KB_KeyPressed(sc_LeftArrow) ||
|
||||
KB_KeyPressed(sc_kpad_4) ||
|
||||
(SHIFTS_IS_PRESSED && KB_KeyPressed(sc_Tab)) ||
|
||||
BUTTON(gamefunc_Turn_Left) ||
|
||||
BUTTON(gamefunc_Strafe_Left) ||
|
||||
(JOYSTICK_GetHat(0)&HAT_LEFT)
|
||||
);
|
||||
}
|
||||
|
||||
void I_MenuLeftClear(void)
|
||||
{
|
||||
KB_ClearKeyDown(sc_LeftArrow);
|
||||
KB_ClearKeyDown(sc_kpad_4);
|
||||
KB_ClearKeyDown(sc_Tab);
|
||||
inputState.ClearButton(gamefunc_Turn_Left);
|
||||
inputState.ClearButton(gamefunc_Strafe_Left);
|
||||
JOYSTICK_ClearHat(0);
|
||||
}
|
||||
|
||||
|
||||
int32_t I_MenuRight(void)
|
||||
{
|
||||
return (
|
||||
KB_KeyPressed(sc_RightArrow) ||
|
||||
KB_KeyPressed(sc_kpad_6) ||
|
||||
(!SHIFTS_IS_PRESSED && KB_KeyPressed(sc_Tab)) ||
|
||||
BUTTON(gamefunc_Turn_Right) ||
|
||||
BUTTON(gamefunc_Strafe_Right) ||
|
||||
(MOUSE_GetButtons()&MIDDLE_MOUSE) ||
|
||||
(JOYSTICK_GetHat(0)&HAT_RIGHT)
|
||||
);
|
||||
}
|
||||
|
||||
void I_MenuRightClear(void)
|
||||
{
|
||||
KB_ClearKeyDown(sc_RightArrow);
|
||||
KB_ClearKeyDown(sc_kpad_6);
|
||||
KB_ClearKeyDown(sc_Tab);
|
||||
inputState.ClearButton(gamefunc_Turn_Right);
|
||||
inputState.ClearButton(gamefunc_Strafe_Right);
|
||||
MOUSE_ClearButton(MIDDLE_MOUSE);
|
||||
JOYSTICK_ClearHat(0);
|
||||
}
|
||||
|
||||
|
||||
int32_t I_PanelUp(void)
|
||||
{
|
||||
return (
|
||||
KB_KeyPressed(sc_PgUp) ||
|
||||
I_MenuUp() ||
|
||||
I_MenuLeft()
|
||||
);
|
||||
}
|
||||
|
||||
void I_PanelUpClear(void)
|
||||
{
|
||||
KB_ClearKeyDown(sc_PgUp);
|
||||
I_MenuUpClear();
|
||||
I_MenuLeftClear();
|
||||
}
|
||||
|
||||
|
||||
int32_t I_PanelDown(void)
|
||||
{
|
||||
return (
|
||||
KB_KeyPressed(sc_PgDn) ||
|
||||
I_MenuDown() ||
|
||||
I_MenuRight() ||
|
||||
I_AdvanceTrigger()
|
||||
);
|
||||
}
|
||||
|
||||
void I_PanelDownClear(void)
|
||||
{
|
||||
KB_ClearKeyDown(sc_PgDn);
|
||||
I_MenuDownClear();
|
||||
I_MenuRightClear();
|
||||
I_AdvanceTriggerClear();
|
||||
}
|
||||
|
||||
|
||||
int32_t I_SliderLeft(void)
|
||||
{
|
||||
return (
|
||||
#if !defined EDUKE32_TOUCH_DEVICES
|
||||
MOUSEINACTIVECONDITIONAL((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELUP_MOUSE)) ||
|
||||
#endif
|
||||
I_MenuLeft()
|
||||
);
|
||||
}
|
||||
|
||||
void I_SliderLeftClear(void)
|
||||
{
|
||||
I_MenuLeftClear();
|
||||
MOUSE_ClearButton(WHEELUP_MOUSE);
|
||||
}
|
||||
|
||||
|
||||
int32_t I_SliderRight(void)
|
||||
{
|
||||
return (
|
||||
#if !defined EDUKE32_TOUCH_DEVICES
|
||||
MOUSEINACTIVECONDITIONAL((MOUSE_GetButtons()&LEFT_MOUSE) && (MOUSE_GetButtons()&WHEELDOWN_MOUSE)) ||
|
||||
#endif
|
||||
I_MenuRight()
|
||||
);
|
||||
}
|
||||
|
||||
void I_SliderRightClear(void)
|
||||
{
|
||||
I_MenuRightClear();
|
||||
MOUSE_ClearButton(WHEELDOWN_MOUSE);
|
||||
}
|
||||
|
||||
|
||||
int32_t I_EnterText(char *t, int32_t maxlength, int32_t flags)
|
||||
{
|
||||
char ch;
|
||||
int32_t inputloc = Bstrlen(typebuf);
|
||||
|
||||
while ((ch = KB_GetCh()) != 0)
|
||||
{
|
||||
if (ch == asc_BackSpace)
|
||||
{
|
||||
if (inputloc > 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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// All gamefuncs (and *only* _gamefuncs_) in I_ReturnTriggerClear() should be replicated here.
|
||||
inputState.ClearButton(gamefunc_Crouch);
|
||||
if (I_ReturnTrigger())
|
||||
{
|
||||
I_ReturnTriggerClear();
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
END_RR_NS
|
|
@ -1,70 +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_
|
||||
|
||||
BEGIN_RR_NS
|
||||
|
||||
extern int32_t I_CheckAllInput(void);
|
||||
extern void I_ClearAllInput(void);
|
||||
|
||||
// Advance = Selecting a menu option || Saying "Yes" || Going forward in Help/Credits
|
||||
// Return = Closing a sub-menu || Saying "No"
|
||||
// Escape = Opening the menu in-game (should not be any gamefuncs)
|
||||
|
||||
extern int32_t I_AdvanceTrigger(void);
|
||||
extern void I_AdvanceTriggerClear(void);
|
||||
extern int32_t I_ReturnTrigger(void);
|
||||
extern void I_ReturnTriggerClear(void);
|
||||
extern int32_t I_EscapeTrigger(void);
|
||||
extern void I_EscapeTriggerClear(void);
|
||||
|
||||
extern int32_t I_MenuUp(void);
|
||||
extern void I_MenuUpClear(void);
|
||||
extern int32_t I_MenuDown(void);
|
||||
extern void I_MenuDownClear(void);
|
||||
extern int32_t I_MenuLeft(void);
|
||||
extern void I_MenuLeftClear(void);
|
||||
extern int32_t I_MenuRight(void);
|
||||
extern void I_MenuRightClear(void);
|
||||
|
||||
extern int32_t I_PanelUp(void);
|
||||
extern void I_PanelUpClear(void);
|
||||
extern int32_t I_PanelDown(void);
|
||||
extern void I_PanelDownClear(void);
|
||||
|
||||
extern int32_t I_SliderLeft(void);
|
||||
extern void I_SliderLeftClear(void);
|
||||
extern int32_t I_SliderRight(void);
|
||||
extern void I_SliderRightClear(void);
|
||||
|
||||
|
||||
enum EnterTextFlags_t {
|
||||
INPUT_NUMERIC = 0x00000001,
|
||||
};
|
||||
|
||||
extern int32_t I_EnterText(char *t, int32_t maxlength, int32_t flags);
|
||||
|
||||
END_RR_NS
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue