mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
Import screentext from eduke32
# Conflicts: # platform/Windows/nblood.vcxproj # platform/Windows/nblood.vcxproj.filters
This commit is contained in:
parent
9da7bb3f16
commit
90dc59749d
15 changed files with 9619 additions and 25 deletions
|
@ -1726,14 +1726,14 @@ RESTART:
|
|||
}
|
||||
netUpdate();
|
||||
MUSIC_Update();
|
||||
CONTROL_BindsEnabled = gInputMode == INPUT_MODE_0;
|
||||
CONTROL_BindsEnabled = gInputMode == kInputGame;
|
||||
switch (gInputMode)
|
||||
{
|
||||
case INPUT_MODE_1:
|
||||
case kInputMenu:
|
||||
if (gGameMenuMgr.m_bActive)
|
||||
gGameMenuMgr.Process();
|
||||
break;
|
||||
case INPUT_MODE_0:
|
||||
case kInputGame:
|
||||
LocalKeys();
|
||||
break;
|
||||
default:
|
||||
|
@ -1811,15 +1811,15 @@ RESTART:
|
|||
{
|
||||
switch (gInputMode)
|
||||
{
|
||||
case INPUT_MODE_1:
|
||||
case kInputMenu:
|
||||
if (gGameMenuMgr.m_bActive)
|
||||
gGameMenuMgr.Draw();
|
||||
break;
|
||||
case INPUT_MODE_2:
|
||||
case kInputMessage:
|
||||
gPlayerMsg.ProcessKeys();
|
||||
gPlayerMsg.Draw();
|
||||
break;
|
||||
case INPUT_MODE_3:
|
||||
case kInputEndGame:
|
||||
gEndGameMgr.ProcessKeys();
|
||||
gEndGameMgr.Draw();
|
||||
break;
|
||||
|
|
|
@ -45,10 +45,10 @@ extern INICHAIN *pINIChain;
|
|||
extern INICHAIN const*pINISelected;
|
||||
|
||||
enum INPUT_MODE {
|
||||
INPUT_MODE_0 = 0,
|
||||
INPUT_MODE_1,
|
||||
INPUT_MODE_2,
|
||||
INPUT_MODE_3,
|
||||
kInputGame = 0,
|
||||
kInputMenu,
|
||||
kInputMessage,
|
||||
kInputEndGame,
|
||||
};
|
||||
|
||||
extern INPUT_MODE gInputMode;
|
||||
|
|
|
@ -470,6 +470,10 @@ enum searchpathtypes_t {
|
|||
SEARCHPATH_REMOVE = 1<<0,
|
||||
};
|
||||
|
||||
#define NEG_ALPHA_TO_BLEND(alpha, blend, orientation) do { \
|
||||
if (alpha < 0) { blend = -alpha; alpha = 0; orientation |= RS_TRANS1; } \
|
||||
} while (0)
|
||||
|
||||
extern char *g_grpNamePtr;
|
||||
|
||||
extern int loaddefinitions_game(const char *fn, int32_t preload);
|
||||
|
@ -778,6 +782,14 @@ inline int approxDist(int dx, int dy)
|
|||
return dx+dy;
|
||||
}
|
||||
|
||||
// the point of this is to prevent re-running a function or calculation passed to potentialValue
|
||||
// without making a new variable under each individual circumstance
|
||||
inline void SetIfGreater(int32_t* variable, int32_t potentialValue)
|
||||
{
|
||||
if (potentialValue > * variable)
|
||||
* variable = potentialValue;
|
||||
}
|
||||
|
||||
class Rect {
|
||||
public:
|
||||
int x0, y0, x1, y1;
|
||||
|
|
|
@ -154,7 +154,7 @@ void ctrlGetInput(void)
|
|||
fix16_t turn = 0;
|
||||
memset(&gInput, 0, sizeof(gInput));
|
||||
|
||||
if (!gGameStarted || gInputMode != INPUT_MODE_0)
|
||||
if (!gGameStarted || gInputMode != kInputGame)
|
||||
{
|
||||
CONTROL_GetInput(&info);
|
||||
return;
|
||||
|
@ -215,12 +215,12 @@ void ctrlGetInput(void)
|
|||
if (gQuitRequest)
|
||||
gInput.keyFlags.quit = 1;
|
||||
|
||||
if (gGameStarted && gInputMode != INPUT_MODE_2 && gInputMode != INPUT_MODE_1
|
||||
if (gGameStarted && gInputMode != kInputMessage && gInputMode != kInputMenu
|
||||
&& BUTTON(gamefunc_Send_Message))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Send_Message);
|
||||
keyFlushScans();
|
||||
gInputMode = INPUT_MODE_2;
|
||||
gInputMode = kInputMessage;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_AutoRun))
|
||||
|
|
|
@ -285,13 +285,13 @@ void CDemo::ProcessKeys(void)
|
|||
{
|
||||
switch (gInputMode)
|
||||
{
|
||||
case INPUT_MODE_1:
|
||||
case kInputMenu:
|
||||
gGameMenuMgr.Process();
|
||||
break;
|
||||
case INPUT_MODE_2:
|
||||
case kInputMessage:
|
||||
gPlayerMsg.ProcessKeys();
|
||||
break;
|
||||
case INPUT_MODE_0:
|
||||
case kInputGame:
|
||||
{
|
||||
char nKey;
|
||||
while ((nKey = keyGetScan()) != 0)
|
||||
|
@ -317,7 +317,7 @@ void CDemo::ProcessKeys(void)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
gInputMode = INPUT_MODE_0;
|
||||
gInputMode = kInputGame;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -414,7 +414,7 @@ _DEMOPLAYBACK:
|
|||
if (viewFPSLimit())
|
||||
{
|
||||
viewDrawScreen();
|
||||
if (gInputMode == INPUT_MODE_1 && CGameMenuMgr::m_bActive)
|
||||
if (gInputMode == kInputMenu && CGameMenuMgr::m_bActive)
|
||||
gGameMenuMgr.Draw();
|
||||
videoNextPage();
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ extern void EndLevel(void);
|
|||
void CEndGameMgr::Setup(void)
|
||||
{
|
||||
at1 = gInputMode;
|
||||
gInputMode = INPUT_MODE_3;
|
||||
gInputMode = kInputEndGame;
|
||||
at0 = 1;
|
||||
EndLevel();
|
||||
sndStartSample(268, 128, -1, 1);
|
||||
|
|
|
@ -122,7 +122,7 @@ bool CGameMenuMgr::Push(CGameMenu *pMenu, int nItem)
|
|||
if (nItem >= 0)
|
||||
pMenu->SetFocusItem(nItem);
|
||||
m_bActive = true;
|
||||
gInputMode = INPUT_MODE_1;
|
||||
gInputMode = kInputMenu;
|
||||
InitializeMenu();
|
||||
m_menuchange_watchpoint = 1;
|
||||
m_mousecaught = 1;
|
||||
|
@ -297,7 +297,7 @@ void CGameMenuMgr::Deactivate(void)
|
|||
m_bActive = false;
|
||||
|
||||
mouseLockToWindow(1);
|
||||
gInputMode = INPUT_MODE_0;
|
||||
gInputMode = kInputGame;
|
||||
}
|
||||
|
||||
bool CGameMenuMgr::MouseOutsideBounds(vec2_t const * const pos, const int32_t x, const int32_t y, const int32_t width, const int32_t height)
|
||||
|
|
403
source/blood/src/input.cpp
Normal file
403
source/blood/src/input.cpp
Normal file
|
@ -0,0 +1,403 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
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 "global.h"
|
||||
//#include "game.h"
|
||||
#include "function.h"
|
||||
#include "keyboard.h"
|
||||
#include "mouse.h"
|
||||
#include "joystick.h"
|
||||
#include "control.h"
|
||||
#include "input.h"
|
||||
#include "menus.h"
|
||||
|
||||
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();
|
||||
CONTROL_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
|
||||
CONTROL_ClearButton(gamefunc_Open);
|
||||
CONTROL_ClearButton(gamefunc_Weapon_Fire);
|
||||
#endif
|
||||
CONTROL_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);
|
||||
CONTROL_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);
|
||||
CONTROL_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);
|
||||
CONTROL_ClearButton(gamefunc_Turn_Left);
|
||||
CONTROL_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);
|
||||
CONTROL_ClearButton(gamefunc_Turn_Right);
|
||||
CONTROL_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;
|
||||
}
|
73
source/blood/src/input.h
Normal file
73
source/blood/src/input.h
Normal file
|
@ -0,0 +1,73 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
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_
|
||||
|
||||
#define WIN_IS_PRESSED ( KB_KeyPressed( sc_RightWin ) || KB_KeyPressed( sc_LeftWin ) )
|
||||
#define ALT_IS_PRESSED ( KB_KeyPressed( sc_RightAlt ) || KB_KeyPressed( sc_LeftAlt ) )
|
||||
#define SHIFTS_IS_PRESSED ( KB_KeyPressed( sc_RightShift ) || KB_KeyPressed( sc_LeftShift ) )
|
||||
|
||||
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);
|
||||
|
||||
#endif
|
7353
source/blood/src/menus.cpp
Normal file
7353
source/blood/src/menus.cpp
Normal file
File diff suppressed because it is too large
Load diff
542
source/blood/src/menus.h
Normal file
542
source/blood/src/menus.h
Normal file
|
@ -0,0 +1,542 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2016 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 menus_h_
|
||||
#define menus_h_
|
||||
|
||||
#include "compat.h"
|
||||
#include "cache1d.h"
|
||||
#include "pragmas.h"
|
||||
#include "common.h"
|
||||
#include "blood.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined EDUKE32_TOUCH_DEVICES
|
||||
# define EDUKE32_SIMPLE_MENU
|
||||
# define EDUKE32_ANDROID_MENU
|
||||
#endif
|
||||
|
||||
// #define EDUKE32_SIMPLE_MENU
|
||||
|
||||
enum MenuIndex_t {
|
||||
MENU_NULL = INT32_MIN, // sentinel for "do nothing"
|
||||
MENU_CLOSE = -2, // sentinel for "close the menu"/"no menu"
|
||||
MENU_PREVIOUS = -1, // sentinel for "go to previous menu"
|
||||
MENU_MAIN = 0,
|
||||
MENU_MAIN_INGAME = 50,
|
||||
MENU_EPISODE = 100,
|
||||
MENU_USERMAP = 101,
|
||||
MENU_NEWGAMECUSTOM = 102,
|
||||
MENU_NEWGAMECUSTOMSUB = 103,
|
||||
MENU_SKILL = 110,
|
||||
MENU_GAMESETUP = 200,
|
||||
MENU_OPTIONS = 202,
|
||||
MENU_VIDEOSETUP = 203,
|
||||
MENU_KEYBOARDSETUP = 204,
|
||||
MENU_MOUSESETUP = 205,
|
||||
MENU_JOYSTICKSETUP = 206,
|
||||
MENU_JOYSTICKBTNS = 207,
|
||||
MENU_JOYSTICKAXES = 208,
|
||||
MENU_KEYBOARDKEYS = 209,
|
||||
MENU_MOUSEBTNS = 210,
|
||||
MENU_MOUSEADVANCED = 212,
|
||||
MENU_JOYSTICKAXIS = 213,
|
||||
MENU_TOUCHSETUP = 214,
|
||||
MENU_TOUCHSENS = 215,
|
||||
MENU_TOUCHBUTTONS = 216,
|
||||
MENU_CONTROLS = 220,
|
||||
MENU_POLYMOST = 230,
|
||||
MENU_COLCORR = 231,
|
||||
MENU_COLCORR_INGAME = 232,
|
||||
MENU_SCREENSETUP = 233,
|
||||
MENU_DISPLAYSETUP = 234,
|
||||
MENU_POLYMER = 240,
|
||||
MENU_LOAD = 300,
|
||||
MENU_SAVE = 350,
|
||||
MENU_STORY = 400,
|
||||
MENU_F1HELP = 401,
|
||||
MENU_QUIT = 500,
|
||||
MENU_QUITTOTITLE = 501,
|
||||
MENU_QUIT_INGAME = 502,
|
||||
MENU_NETSETUP = 600,
|
||||
MENU_NETWAITMASTER = 601,
|
||||
MENU_NETWAITVOTES = 603,
|
||||
MENU_SOUND = 700,
|
||||
MENU_SOUND_INGAME = 701,
|
||||
MENU_ADVSOUND = 702,
|
||||
MENU_SAVESETUP = 750,
|
||||
MENU_SAVECLEANVERIFY = 751,
|
||||
MENU_RESETSTATSVERIFY = 752,
|
||||
MENU_CHEATS = 800,
|
||||
MENU_CHEATENTRY = 801,
|
||||
MENU_CHEAT_WARP = 802,
|
||||
MENU_CHEAT_SKILL = 803,
|
||||
MENU_CREDITS = 990,
|
||||
MENU_CREDITS2 = 991,
|
||||
MENU_CREDITS3 = 992,
|
||||
MENU_CREDITS4 = 993,
|
||||
MENU_CREDITS5 = 994,
|
||||
MENU_LOADVERIFY = 1000,
|
||||
MENU_LOADDELVERIFY = 1100,
|
||||
MENU_NEWVERIFY = 1500,
|
||||
MENU_SAVEVERIFY = 2000,
|
||||
MENU_SAVEDELVERIFY = 2100,
|
||||
MENU_COLCORRRESETVERIFY = 2200,
|
||||
MENU_KEYSRESETVERIFY = 2201,
|
||||
MENU_KEYSCLASSICVERIFY = 2202,
|
||||
MENU_JOYSTANDARDVERIFY = 2203,
|
||||
MENU_JOYPROVERIFY = 2204,
|
||||
MENU_JOYCLEARVERIFY = 2205,
|
||||
MENU_ADULTPASSWORD = 10001,
|
||||
MENU_RESETPLAYER = 15000,
|
||||
MENU_BUYDUKE = 20000,
|
||||
MENU_NETWORK = 20001,
|
||||
MENU_PLAYER = 20002,
|
||||
MENU_MACROS = 20004,
|
||||
MENU_NETHOST = 20010,
|
||||
MENU_NETOPTIONS = 20011,
|
||||
MENU_NETUSERMAP = 20012,
|
||||
MENU_NETJOIN = 20020,
|
||||
};
|
||||
|
||||
|
||||
|
||||
typedef int32_t MenuID_t;
|
||||
|
||||
|
||||
typedef enum MenuAnimationType_t
|
||||
{ // Note: This enum is for logical categories, not visual types.
|
||||
MA_None,
|
||||
MA_Return,
|
||||
MA_Advance,
|
||||
} MenuAnimationType_t;
|
||||
|
||||
// a subset of screentext parameters, restricted because menus require accessibility
|
||||
typedef struct MenuFont_t
|
||||
{
|
||||
// int32_t xspace, yline;
|
||||
vec2_t emptychar, between;
|
||||
int32_t zoom;
|
||||
int32_t cursorLeftPosition, cursorCenterPosition, cursorScale;
|
||||
int32_t textflags;
|
||||
int16_t tilenum;
|
||||
// selected shade glows, deselected shade is used by Blood, disabled shade is used by SW
|
||||
int8_t shade_deselected, shade_disabled;
|
||||
uint8_t pal;
|
||||
uint8_t pal_selected, pal_deselected, pal_disabled;
|
||||
uint8_t pal_selected_right, pal_deselected_right, pal_disabled_right;
|
||||
|
||||
int32_t get_yline() const { return mulscale16(emptychar.y, zoom); }
|
||||
} MenuFont_t;
|
||||
|
||||
|
||||
|
||||
typedef enum MenuEntryType_t
|
||||
{
|
||||
Dummy,
|
||||
Link,
|
||||
Option,
|
||||
Custom2Col,
|
||||
RangeInt32,
|
||||
RangeFloat,
|
||||
#ifdef MENU_ENABLE_RANGEDOUBLE
|
||||
RangeDouble,
|
||||
#endif
|
||||
String,
|
||||
Spacer,
|
||||
} MenuEntryType_t;
|
||||
|
||||
typedef struct MenuEntryFormat_t
|
||||
{
|
||||
int32_t marginBottom;
|
||||
int32_t indent;
|
||||
int32_t width; // 0: center, >0: width of the label column (left-aligned options), <0: -width of everything (right-aligned)
|
||||
} MenuEntryFormat_t;
|
||||
|
||||
|
||||
typedef struct MenuMenuFormat_t
|
||||
{
|
||||
vec2_t pos;
|
||||
int32_t bottomcutoff; // >0: the bottom edge of the menu before automatic scrolling kicks in, <0: -total height for vertical justification
|
||||
} MenuMenuFormat_t;
|
||||
|
||||
typedef struct MenuLink_t
|
||||
{
|
||||
// traits
|
||||
MenuID_t linkID;
|
||||
MenuAnimationType_t animation;
|
||||
} MenuLink_t;
|
||||
typedef struct MenuOptionSet_t
|
||||
{
|
||||
// traits
|
||||
char const **optionNames;
|
||||
int32_t *optionValues; // If NULL, the identity of currentOption is assumed.
|
||||
|
||||
// pop-up list appearance
|
||||
MenuMenuFormat_t *menuFormat;
|
||||
MenuEntryFormat_t *entryFormat;
|
||||
MenuFont_t *font;
|
||||
|
||||
// traits
|
||||
int32_t numOptions;
|
||||
|
||||
// pop-up list state
|
||||
int32_t currentEntry;
|
||||
int32_t scrollPos;
|
||||
|
||||
// appearance
|
||||
uint8_t features; // bit 1 = disable left/right arrows, bit 2 = disable list
|
||||
|
||||
int32_t getMarginBottom() const { return mulscale16(entryFormat->marginBottom, font->zoom); }
|
||||
int32_t getIndent() const { return mulscale16(entryFormat->indent, font->zoom); }
|
||||
} MenuOptionSet_t;
|
||||
typedef struct MenuOption_t
|
||||
{
|
||||
// appearance
|
||||
MenuFont_t *font;
|
||||
|
||||
// traits
|
||||
MenuOptionSet_t *options; // so that common sets such as Yes/No, On/Off can be reused
|
||||
|
||||
// effect
|
||||
int32_t *data;
|
||||
|
||||
// state
|
||||
int32_t currentOption;
|
||||
} MenuOption_t;
|
||||
typedef struct MenuCustom2Col_t
|
||||
{
|
||||
// effect
|
||||
uint8_t *column[2];
|
||||
char const **key;
|
||||
|
||||
// appearance
|
||||
MenuFont_t *font;
|
||||
|
||||
// effect
|
||||
size_t numvalid;
|
||||
|
||||
// appearance
|
||||
int32_t columnWidth;
|
||||
|
||||
// state
|
||||
int8_t screenOpen;
|
||||
} MenuCustom2Col_t;
|
||||
|
||||
enum MenuRangeFlags_t
|
||||
{
|
||||
DisplayTypeInteger = 1,
|
||||
DisplayTypePercent = 2,
|
||||
DisplayTypeNormalizedDecimal = 3,
|
||||
DisplayTypeMask = (1<<0)|(1<<1),
|
||||
|
||||
EnforceIntervals = 1<<7,
|
||||
};
|
||||
typedef struct MenuRangeInt32_t
|
||||
{
|
||||
// effect
|
||||
int32_t *variable;
|
||||
|
||||
// appearance
|
||||
MenuFont_t *font;
|
||||
|
||||
// traits
|
||||
int32_t min;
|
||||
int32_t max;
|
||||
int32_t onehundredpercent; // 0 implies max
|
||||
int32_t steps;
|
||||
|
||||
uint8_t flags;
|
||||
} MenuRangeInt32_t;
|
||||
typedef struct MenuRangeFloat_t
|
||||
{
|
||||
// effect
|
||||
float *variable;
|
||||
|
||||
// appearance
|
||||
MenuFont_t *font;
|
||||
|
||||
// traits
|
||||
float min;
|
||||
float max;
|
||||
float onehundredpercent; // 0 implies 1.0
|
||||
int32_t steps;
|
||||
|
||||
uint8_t flags;
|
||||
} MenuRangeFloat_t;
|
||||
#ifdef MENU_ENABLE_RANGEDOUBLE
|
||||
typedef struct MenuRangeDouble_t
|
||||
{
|
||||
// effect
|
||||
double *variable;
|
||||
|
||||
// appearance
|
||||
MenuFont_t *font;
|
||||
|
||||
// traits
|
||||
double min;
|
||||
double max;
|
||||
double onehundredpercent; // 0 implies 1.0
|
||||
int32_t steps;
|
||||
|
||||
uint8_t flags;
|
||||
} MenuRangeDouble_t;
|
||||
#endif
|
||||
typedef struct MenuString_t
|
||||
{
|
||||
// state
|
||||
char* editfield;
|
||||
|
||||
// effect
|
||||
char* variable;
|
||||
|
||||
// appearance
|
||||
MenuFont_t *font;
|
||||
|
||||
// effect
|
||||
int32_t bufsize;
|
||||
int32_t flags;
|
||||
} MenuString_t;
|
||||
typedef struct MenuSpacer_t
|
||||
{
|
||||
int32_t height;
|
||||
} MenuSpacer_t;
|
||||
|
||||
// For internal use only.
|
||||
enum MenuEntryFlags_t
|
||||
{
|
||||
MEF_Disabled = 1<<0,
|
||||
MEF_LookDisabled = 1<<1,
|
||||
MEF_Hidden = 1<<2,
|
||||
};
|
||||
|
||||
typedef struct MenuEntry_t
|
||||
{
|
||||
// traits
|
||||
const char *name;
|
||||
|
||||
// appearance
|
||||
MenuFont_t *font;
|
||||
MenuEntryFormat_t *format;
|
||||
|
||||
void *entry;
|
||||
MenuEntryType_t type;
|
||||
|
||||
// state
|
||||
int32_t flags;
|
||||
int32_t ytop, ybottom;
|
||||
|
||||
int32_t getMarginBottom() const { return mulscale16(format->marginBottom, font->zoom); }
|
||||
int32_t getIndent() const { return mulscale16(format->indent, font->zoom); }
|
||||
int32_t getHeight() const
|
||||
{
|
||||
return type == Spacer ? mulscale16(((MenuSpacer_t *)entry)->height, font->zoom) : font->get_yline();
|
||||
}
|
||||
} MenuEntry_t;
|
||||
|
||||
|
||||
typedef enum MenuType_t
|
||||
{
|
||||
Menu,
|
||||
Panel,
|
||||
Verify,
|
||||
Message,
|
||||
TextForm,
|
||||
FileSelect,
|
||||
} MenuType_t;
|
||||
|
||||
typedef struct MenuMenu_t
|
||||
{
|
||||
const char *title;
|
||||
|
||||
MenuMenuFormat_t *format;
|
||||
|
||||
MenuEntry_t **entrylist;
|
||||
int32_t numEntries;
|
||||
|
||||
// state
|
||||
int32_t currentEntry, currentColumn;
|
||||
int32_t scrollPos;
|
||||
} MenuMenu_t;
|
||||
typedef struct MenuPanel_t
|
||||
{
|
||||
const char *title;
|
||||
|
||||
MenuID_t previousID;
|
||||
MenuAnimationType_t previousAnimation;
|
||||
MenuID_t nextID;
|
||||
MenuAnimationType_t nextAnimation;
|
||||
} MenuPanel_t;
|
||||
typedef struct MenuVerify_t
|
||||
{
|
||||
vec2_t cursorpos;
|
||||
|
||||
MenuID_t linkID;
|
||||
MenuAnimationType_t animation;
|
||||
} MenuVerify_t;
|
||||
typedef struct MenuMessage_t
|
||||
{
|
||||
vec2_t cursorpos;
|
||||
|
||||
MenuID_t linkID;
|
||||
MenuAnimationType_t animation;
|
||||
} MenuMessage_t;
|
||||
enum MenuTextFormFlags_t
|
||||
{
|
||||
MTF_Password = 1<<0,
|
||||
};
|
||||
typedef struct MenuTextForm_t
|
||||
{
|
||||
// state
|
||||
char *input;
|
||||
|
||||
// traits
|
||||
const char *instructions;
|
||||
int32_t bufsize;
|
||||
uint8_t flags;
|
||||
} MenuTextForm_t;
|
||||
typedef struct MenuFileSelect_t
|
||||
{
|
||||
const char *title;
|
||||
|
||||
// appearance
|
||||
MenuMenuFormat_t *format[2];
|
||||
MenuFont_t *font[2];
|
||||
|
||||
// traits
|
||||
const char * startdir;
|
||||
const char *pattern;
|
||||
char *destination;
|
||||
|
||||
// state
|
||||
CACHE1D_FIND_REC *findhigh[2];
|
||||
int32_t scrollPos[2];
|
||||
|
||||
// appearance
|
||||
int32_t marginBottom[2];
|
||||
|
||||
// state
|
||||
fnlist_t fnlist;
|
||||
int32_t currentList;
|
||||
|
||||
int32_t getMarginBottom(size_t index) const { return mulscale16(marginBottom[index], font[index]->zoom); }
|
||||
} MenuFileSelect_t;
|
||||
|
||||
typedef struct Menu_t
|
||||
{
|
||||
void *object;
|
||||
MenuID_t menuID;
|
||||
MenuID_t parentID;
|
||||
MenuAnimationType_t parentAnimation;
|
||||
MenuType_t type;
|
||||
} Menu_t;
|
||||
|
||||
typedef struct MenuAnimation_t
|
||||
{
|
||||
int32_t(*out)(struct MenuAnimation_t *);
|
||||
int32_t(*in)(struct MenuAnimation_t *);
|
||||
|
||||
Menu_t *previous;
|
||||
Menu_t *current;
|
||||
|
||||
int32_t start;
|
||||
int32_t length;
|
||||
} MenuAnimation_t;
|
||||
|
||||
extern MenuAnimation_t m_animation;
|
||||
|
||||
extern MenuID_t g_currentMenu;
|
||||
extern Menu_t *m_currentMenu;
|
||||
|
||||
extern int32_t g_quitDeadline;
|
||||
extern int32_t voting;
|
||||
int Menu_Change(MenuID_t cm);
|
||||
void Menu_AnimateChange(int32_t cm, MenuAnimationType_t animtype);
|
||||
int32_t Menu_IsTextInput(Menu_t *cm);
|
||||
int G_CheckPlayerColor(int color);
|
||||
void Menu_Init(void);
|
||||
void Menu_Open(uint8_t playerID);
|
||||
void Menu_Close(uint8_t playerID);
|
||||
void M_DisplayMenus(void);
|
||||
|
||||
extern MenuFont_t MF_Redfont, MF_Bluefont, MF_Minifont;
|
||||
|
||||
#define M_MOUSETIMEOUT 210
|
||||
extern int32_t m_mouselastactivity;
|
||||
|
||||
#if defined EDUKE32_TOUCH_DEVICES
|
||||
# define MOUSEALPHA 0
|
||||
# define CURSORALPHA (255/3)
|
||||
# define MOUSEACTIVECONDITIONAL(condition) (condition)
|
||||
# define MOUSEWATCHPOINTCONDITIONAL(condition) (condition)
|
||||
#else
|
||||
extern int32_t m_mousewake_watchpoint, m_menuchange_watchpoint;
|
||||
// alpha increments of 3 --> 255 / 3 = 85 --> round up to power of 2 --> 128 --> divide by 2 --> 64 alphatabs required
|
||||
// use 16 anyway :P
|
||||
# define MOUSEUSEALPHA (videoGetRenderMode() != REND_CLASSIC || numalphatabs >= 15)
|
||||
# define MOUSEALPHA (MOUSEUSEALPHA ? clamp(((int32_t) totalclock - m_mouselastactivity - 90)*3, 0, 255) : 0)
|
||||
# define CURSORALPHA (MOUSEUSEALPHA ? clamp(((int32_t) totalclock - m_mouselastactivity - 90)*2 + (255/3), (255/3), 255) : 255/3)
|
||||
# define MOUSEACTIVECONDITION (totalclock - m_mouselastactivity < M_MOUSETIMEOUT)
|
||||
# define MOUSEACTIVECONDITIONAL(condition) (MOUSEACTIVECONDITION && (condition))
|
||||
# define MOUSEINACTIVECONDITIONAL(condition) ((gInputMode != kInputMenu || !MOUSEACTIVECONDITION) && (condition))
|
||||
# define MOUSEWATCHPOINTCONDITIONAL(condition) ((condition) || m_mousewake_watchpoint || m_menuchange_watchpoint == 3)
|
||||
#endif
|
||||
|
||||
#define MAXMENUGAMEPLAYENTRIES 7
|
||||
|
||||
enum MenuGameplayEntryFlags
|
||||
{
|
||||
MGE_Locked = 1u<<0u,
|
||||
MGE_Hidden = 1u<<1u,
|
||||
MGE_UserContent = 1u<<2u,
|
||||
};
|
||||
|
||||
typedef struct MenuGameplayEntry
|
||||
{
|
||||
char name[64];
|
||||
uint8_t flags;
|
||||
|
||||
bool isValid() const { return name[0] != '\0'; }
|
||||
} MenuGameplayEntry;
|
||||
|
||||
typedef struct MenuGameplayStemEntry
|
||||
{
|
||||
MenuGameplayEntry entry;
|
||||
MenuGameplayEntry subentries[MAXMENUGAMEPLAYENTRIES];
|
||||
} MenuGameplayStemEntry;
|
||||
|
||||
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];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -366,7 +366,7 @@ void CGameMessageMgr::Display(void)
|
|||
{
|
||||
if (VanillaMode())
|
||||
{
|
||||
if (numberOfDisplayedMessages && this->state && gInputMode != INPUT_MODE_2)
|
||||
if (numberOfDisplayedMessages && this->state && gInputMode != kInputMessage)
|
||||
{
|
||||
int initialNrOfDisplayedMsgs = numberOfDisplayedMessages;
|
||||
int initialMessagesIndex = messagesIndex;
|
||||
|
@ -397,7 +397,7 @@ void CGameMessageMgr::Display(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (this->state && gInputMode != INPUT_MODE_2)
|
||||
if (this->state && gInputMode != kInputMessage)
|
||||
{
|
||||
messageStruct* currentMessages[kMessageLogSize];
|
||||
int currentMessagesCount = 0;
|
||||
|
@ -529,7 +529,7 @@ void CPlayerMsg::Clear(void)
|
|||
void CPlayerMsg::Term(void)
|
||||
{
|
||||
Clear();
|
||||
gInputMode = INPUT_MODE_0;
|
||||
gInputMode = kInputGame;
|
||||
}
|
||||
|
||||
void CPlayerMsg::Draw(void)
|
||||
|
|
|
@ -483,7 +483,7 @@ static int osdcmd_button(osdcmdptr_t parm)
|
|||
char const *p = parm->name + strlen_gamefunc_;
|
||||
|
||||
// if (g_player[myconnectindex].ps->gm == MODE_GAME) // only trigger these if in game
|
||||
if (gInputMode == INPUT_MODE_0)
|
||||
if (gInputMode == kInputGame)
|
||||
CONTROL_ButtonFlags[CONFIG_FunctionNameToNum(p)] = 1; // FIXME
|
||||
|
||||
return OSDCMD_OK;
|
||||
|
|
1109
source/blood/src/screentext.cpp
Normal file
1109
source/blood/src/screentext.cpp
Normal file
File diff suppressed because it is too large
Load diff
102
source/blood/src/screentext.h
Normal file
102
source/blood/src/screentext.h
Normal file
|
@ -0,0 +1,102 @@
|
|||
//-------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (C) 2016 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.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "menus.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define USERQUOTE_LEFTOFFSET 5
|
||||
#define USERQUOTE_RIGHTOFFSET 14
|
||||
|
||||
extern int32_t minitext_lowercase;
|
||||
extern int32_t minitext_yofs;
|
||||
|
||||
enum ScreenTextFlags_t {
|
||||
TEXT_XRIGHT = 0x00000001,
|
||||
TEXT_XCENTER = 0x00000002,
|
||||
TEXT_YBOTTOM = 0x00000004,
|
||||
TEXT_YCENTER = 0x00000008,
|
||||
TEXT_INTERNALSPACE = 0x00000010,
|
||||
TEXT_TILESPACE = 0x00000020,
|
||||
TEXT_INTERNALLINE = 0x00000040,
|
||||
TEXT_TILELINE = 0x00000080,
|
||||
TEXT_XOFFSETZERO = 0x00000100,
|
||||
TEXT_XJUSTIFY = 0x00000200,
|
||||
TEXT_YOFFSETZERO = 0x00000400,
|
||||
TEXT_YJUSTIFY = 0x00000800,
|
||||
TEXT_LINEWRAP = 0x00001000,
|
||||
TEXT_UPPERCASE = 0x00002000,
|
||||
TEXT_INVERTCASE = 0x00004000,
|
||||
TEXT_IGNOREESCAPE = 0x00008000,
|
||||
TEXT_LITERALESCAPE = 0x00010000,
|
||||
TEXT_BACKWARDS = 0x00020000,
|
||||
TEXT_GAMETEXTNUMHACK = 0x00040000,
|
||||
TEXT_DIGITALNUMBER = 0x00080000,
|
||||
// TEXT_BIGALPHANUM = 0x00100000,
|
||||
// TEXT_GRAYFONT = 0x00200000,
|
||||
};
|
||||
|
||||
extern int32_t minitext_(int32_t x, int32_t y, const char *t, int32_t s, int32_t p, int32_t sb);
|
||||
extern void menutext_(int32_t x, int32_t y, int32_t s, char const *t, int32_t o, int32_t f);
|
||||
extern void captionmenutext(int32_t x, int32_t y, char const *t);
|
||||
extern vec2_t gametext_(int32_t x, int32_t y, const char *t, int32_t s, int32_t p, int32_t o, int32_t a, int32_t f);
|
||||
extern void gametext_simple(int32_t x, int32_t y, const char *t);
|
||||
#define mpgametext_x (5<<16)
|
||||
extern vec2_t mpgametext(int32_t x, int32_t y, char const * t, int32_t s, int32_t o, int32_t a, int32_t f);
|
||||
extern vec2_t mpgametextsize(char const * t, int32_t f);
|
||||
extern int32_t textsc(int32_t sc);
|
||||
|
||||
#define minitextshade(x, y, t, s, p, sb) minitext_(x,y,t,s,p,sb)
|
||||
#define minitext(x, y, t, p, sb) minitext_(x,y,t,0,p,sb)
|
||||
#define menutext(x, y, t) menutext_((x), (y), 0, (t), 10|16, 0)
|
||||
#define menutext_centeralign(x, y, t) menutext_((x), (y), 0, (t), 10|16, TEXT_XCENTER|TEXT_YCENTER)
|
||||
#define menutext_center(y, t) menutext_(160<<16, (y)<<16, 0, (t), 10|16, TEXT_XCENTER)
|
||||
#define gametext(x, y, t) gametext_simple((x)<<16, (y)<<16, (t))
|
||||
#define gametext_widenumber(x, y, t) gametext_((x)<<16, (y)<<16, (t), 0, MF_Bluefont.pal, 1024, 0, TEXT_GAMETEXTNUMHACK)
|
||||
#define gametext_number(x, y, t) gametext_((x)<<16, (y)<<16, (t), 0, MF_Bluefont.pal, 0, 0, TEXT_GAMETEXTNUMHACK)
|
||||
#define gametext_pal(x, y, t, p) gametext_((x)<<16, (y)<<16, (t), 0, (p), 0, 0, 0)
|
||||
#define gametext_center(y, t) gametext_(160<<16, (y)<<16, (t), 0, MF_Bluefont.pal, 0, 0, TEXT_XCENTER)
|
||||
#define gametext_center_number(y, t) gametext_(160<<16, (y)<<16, (t), 0, MF_Bluefont.pal, 0, 0, TEXT_XCENTER|TEXT_GAMETEXTNUMHACK)
|
||||
#define gametext_center_shade(y, t, s) gametext_(160<<16, (y)<<16, (t), (s), MF_Bluefont.pal, 0, 0, TEXT_XCENTER)
|
||||
#define gametext_center_shade_pal(y, t, s, p) gametext_(160<<16, (y)<<16, (t), (s), (p), 0, 0, TEXT_XCENTER)
|
||||
|
||||
extern void G_PrintGameText(int32_t tile, int32_t x, int32_t y, const char *t,
|
||||
int32_t s, int32_t p, int32_t o,
|
||||
int32_t x1, int32_t y1, int32_t x2, int32_t y2,
|
||||
int32_t z, int32_t a);
|
||||
|
||||
extern int32_t G_GetStringLineLength(const char *text, const char *end, int32_t iter);
|
||||
extern int32_t G_GetStringNumLines(const char *text, const char *end, int32_t iter);
|
||||
extern char* G_GetSubString(const char *text, const char *end, int32_t iter, int32_t length);
|
||||
extern int32_t G_GetStringTile(int32_t font, char *t, int32_t f);
|
||||
extern vec2_t G_ScreenTextSize(int32_t font, int32_t x, int32_t y, int32_t z, int32_t blockangle, const char *str, int32_t o, int32_t xspace, int32_t yline, int32_t xbetween, int32_t ybetween, int32_t f, int32_t x1, int32_t y1, int32_t x2, int32_t y2);
|
||||
extern void G_AddCoordsFromRotation(vec2_t *coords, const vec2_t *unitDirection, int32_t magnitude);
|
||||
extern vec2_t G_ScreenText(int32_t font, int32_t x, int32_t y, int32_t z, int32_t blockangle, int32_t charangle, const char *str, int32_t shade, int32_t pal, int32_t o, int32_t alpha, int32_t xspace, int32_t yline, int32_t xbetween, int32_t ybetween, int32_t f, int32_t x1, int32_t y1, int32_t x2, int32_t y2);
|
||||
extern vec2_t G_ScreenTextShadow(int32_t sx, int32_t sy, int32_t font, int32_t x, int32_t y, int32_t z, int32_t blockangle, int32_t charangle, const char *str, int32_t shade, int32_t pal, int32_t o, int32_t alpha, int32_t xspace, int32_t yline, int32_t xbetween, int32_t ybetween, int32_t f, int32_t x1, int32_t y1, int32_t x2, int32_t y2);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
Loading…
Reference in a new issue