mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 20:58:07 +03:00
input: allow repeating left/right menu arrows
This commit is contained in:
parent
57f6f25bba
commit
6667c1a1eb
6 changed files with 17 additions and 14 deletions
|
@ -1,4 +1,5 @@
|
|||
## [Unreleased](https://github.com/LostArtefacts/TRX/compare/tr1-4.7.1...develop) - ××××-××-××
|
||||
- added the ability to hold forward/back to move through menus more quickly (#2298)
|
||||
- added an option for pickup aids, which will show an intermittent twinkle when Lara is nearby pickup items (#2076)
|
||||
- added an optional demo number argument to the `/demo` command
|
||||
- added pause screen support to demos
|
||||
|
|
|
@ -469,7 +469,7 @@ Not all options are turned on by default. Refer to `TR1X_ConfigTool.exe` for det
|
|||
|
||||
#### Input
|
||||
- added ability to sidestep like in TR3
|
||||
- added ability to hold forward/back to move through menus more quickly
|
||||
- added ability to hold arrows to move through menus more quickly
|
||||
- added ability to move camera around with W,A,S,D
|
||||
- added ability to unbind unessential keys
|
||||
- added ability to reset control schemes to default
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
- added pause dialog (#1638)
|
||||
- added a photo mode feature (#2277)
|
||||
- added fade-out effect to the demos
|
||||
- added the ability to hold forward/back to move through menus more quickly (#2298)
|
||||
- changed default input bindings to let the photo mode binding be compatible with TR1X:
|
||||
| Key | Old binding | New binding |
|
||||
| ----------------------------- | ----------- | ------------ |
|
||||
|
|
|
@ -77,7 +77,7 @@ game with new enhancements and features.
|
|||
|
||||
#### Input
|
||||
- added ability to sidestep like in TR3
|
||||
- added ability to hold forward/back to move through menus more quickly
|
||||
- added ability to hold arrows to move through menus more quickly
|
||||
- added additional custom control schemes
|
||||
- added customizable controller support
|
||||
- fixed setting user keys being very difficult
|
||||
|
|
|
@ -8,9 +8,6 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#define DELAY_TIME 0.4
|
||||
#define HOLD_TIME 0.1
|
||||
|
||||
typedef enum {
|
||||
HOLD_INACTIVE,
|
||||
HOLD_DELAY,
|
||||
|
@ -18,8 +15,10 @@ typedef enum {
|
|||
} M_HOLD_STATE;
|
||||
|
||||
typedef struct {
|
||||
CLOCK_TIMER hold_timer;
|
||||
CLOCK_TIMER delay_timer;
|
||||
CLOCK_TIMER repeat_timer;
|
||||
double delay_time;
|
||||
double hold_time;
|
||||
M_HOLD_STATE state;
|
||||
INPUT_ROLE role;
|
||||
} M_HOLD_CHECK;
|
||||
|
@ -31,8 +30,10 @@ INPUT_STATE g_OldInputDB = {};
|
|||
static bool m_ListenMode = false;
|
||||
|
||||
static M_HOLD_CHECK m_HoldChecks[] = {
|
||||
{ .role = INPUT_ROLE_MENU_UP },
|
||||
{ .role = INPUT_ROLE_MENU_DOWN },
|
||||
{ .role = INPUT_ROLE_MENU_UP, .delay_time = 0.4, .hold_time = 0.1 },
|
||||
{ .role = INPUT_ROLE_MENU_DOWN, .delay_time = 0.4, .hold_time = 0.1 },
|
||||
{ .role = INPUT_ROLE_MENU_LEFT, .delay_time = 0.4, .hold_time = 0.2 },
|
||||
{ .role = INPUT_ROLE_MENU_RIGHT, .delay_time = 0.4, .hold_time = 0.2 },
|
||||
{ .role = (INPUT_ROLE)-1 }, // sentinel
|
||||
};
|
||||
|
||||
|
@ -105,7 +106,7 @@ static INPUT_STATE M_SetPressed(
|
|||
void Input_Init(void)
|
||||
{
|
||||
for (int32_t i = 0; m_HoldChecks[i].role != (INPUT_ROLE)-1; i++) {
|
||||
m_HoldChecks[i].hold_timer.type = CLOCK_TIMER_REAL;
|
||||
m_HoldChecks[i].delay_timer.type = CLOCK_TIMER_REAL;
|
||||
m_HoldChecks[i].repeat_timer.type = CLOCK_TIMER_REAL;
|
||||
}
|
||||
if (g_Input_Keyboard.init != NULL) {
|
||||
|
@ -321,16 +322,16 @@ INPUT_STATE Input_GetDebounced(const INPUT_STATE input)
|
|||
hold_check->state = HOLD_INACTIVE;
|
||||
} else if (hold_check->state == HOLD_INACTIVE) {
|
||||
hold_check->state = HOLD_DELAY;
|
||||
ClockTimer_Sync(&hold_check->hold_timer);
|
||||
ClockTimer_Sync(&hold_check->delay_timer);
|
||||
} else if (
|
||||
hold_check->state == HOLD_DELAY
|
||||
&& ClockTimer_CheckElapsedAndTake(
|
||||
&hold_check->hold_timer, DELAY_TIME)) {
|
||||
&hold_check->delay_timer, hold_check->delay_time)) {
|
||||
hold_check->state = HOLD_REPEATING;
|
||||
} else if (
|
||||
hold_check->state == HOLD_REPEATING
|
||||
&& ClockTimer_CheckElapsedAndTake(
|
||||
&hold_check->repeat_timer, HOLD_TIME)) {
|
||||
&hold_check->repeat_timer, hold_check->hold_time)) {
|
||||
result = M_SetPressed(result, hold_check->role, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,10 +85,10 @@ void Option_Sound_Control(INVENTORY_ITEM *const item)
|
|||
|
||||
if (g_SoundOptionLine) {
|
||||
bool changed = false;
|
||||
if (g_Input.left && g_Config.audio.sound_volume > 0) {
|
||||
if (g_InputDB.menu_left && g_Config.audio.sound_volume > 0) {
|
||||
g_Config.audio.sound_volume--;
|
||||
changed = true;
|
||||
} else if (g_Input.right && g_Config.audio.sound_volume < 10) {
|
||||
} else if (g_InputDB.menu_right && g_Config.audio.sound_volume < 10) {
|
||||
g_Config.audio.sound_volume++;
|
||||
changed = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue