AMFP Enhanced
C++ reference: the code this unofficial fork added
Toggle main menu visibility
Loading...
Searching...
No Matches
LuxContextControls.h
Go to the documentation of this file.
1
/*
2
* AMFP-2026: which control prompts the bottom-right HUD shows for the player's state and the
3
* entity in focus. Pure table, unit tested in tests/cpp/test_context_controls.cpp. The enums
4
* mirror eLuxPlayerState / eLuxFocusCrosshair (checked by static_asserts in LuxPlayer.cpp).
5
* Labels are keys in the AMFP2026 category of amfp2026_<lang>.lang.
6
*/
7
#ifndef LUX_CONTEXT_CONTROLS_H
8
#define LUX_CONTEXT_CONTROLS_H
9
10
enum
eLuxCtxState
11
{
12
eLuxCtxState_Normal
,
13
eLuxCtxState_HandObject
,
14
eLuxCtxState_UseItem
,
15
eLuxCtxState_InteractGrab
,
16
eLuxCtxState_InteractPush
,
17
eLuxCtxState_InteractSwingDoor
,
18
eLuxCtxState_InteractLever
,
19
eLuxCtxState_InteractWheel
,
20
eLuxCtxState_InteractSlide
,
21
eLuxCtxState_Ladder
,
22
eLuxCtxState_LastEnum
23
};
24
25
enum
eLuxCtxFocus
26
{
27
eLuxCtxFocus_Default
,
28
eLuxCtxFocus_Grab
,
29
eLuxCtxFocus_Push
,
30
eLuxCtxFocus_Ignite
,
31
eLuxCtxFocus_Pick
,
32
eLuxCtxFocus_LevelDoor
,
33
eLuxCtxFocus_Ladder
,
34
eLuxCtxFocus_VoiceOver
,
35
eLuxCtxFocus_PhoneBox
,
36
eLuxCtxFocus_Note
,
37
eLuxCtxFocus_LastEnum
38
};
39
40
static
const
int
kLuxCtxNoFocus
= -1;
41
static
const
int
kLuxCtxMaxPrompts
= 4;
42
43
enum
eLuxCtxAction
44
{
45
eLuxCtxAction_Interact
,
46
eLuxCtxAction_Attack
,
47
eLuxCtxAction_Rotate
,
48
eLuxCtxAction_Forward
,
49
eLuxCtxAction_Backward
,
50
eLuxCtxAction_QuestLog
,
51
eLuxCtxAction_RecentText
,
52
eLuxCtxAction_LastEnum
53
};
54
55
struct
cLuxCtxPrompt
56
{
57
int
mlAction
;
// eLuxCtxAction
58
const
char
*
msLabel
;
// lang key
59
};
60
61
/** Input action name as used by cLuxInputHandler::GetInputName / user_keys.cfg. */
62
inline
const
char
*
LuxCtxActionName
(
int
alAction)
63
{
64
static
const
char
*
const
vNames[
eLuxCtxAction_LastEnum
] = {
65
"Interact"
,
"Attack"
,
"Rotate"
,
"Forward"
,
"Backward"
,
"QuestLog"
,
"RecentText"
};
66
if
(alAction < 0 || alAction >=
eLuxCtxAction_LastEnum
)
return
""
;
67
return
vNames[alAction];
68
}
69
70
/** Prompt label for Interact on a focused entity: one word for everything (user decision:
71
* 互動 / Interact everywhere, not Grab / Push / Read per crosshair). */
72
inline
const
char
*
LuxCtxFocusLabel
(
int
/*alFocus*/
)
73
{
74
return
"CtxInteract"
;
75
}
76
77
/** Fills apOut (capacity alMax) and returns the number of prompts. */
78
inline
int
LuxContextPrompts
(
int
alState,
int
alFocus,
cLuxCtxPrompt
* apOut,
int
alMax)
79
{
80
cLuxCtxPrompt
v[
kLuxCtxMaxPrompts
];
81
int
n = 0;
82
switch
(alState)
83
{
84
case
eLuxCtxState_Normal
:
85
case
eLuxCtxState_HandObject
:
86
// Only when something can be interacted with (user decision); the hint / note keys
87
// stay listed in the key config and the journal.
88
if
(alFocus >= 0 && alFocus <
eLuxCtxFocus_LastEnum
)
89
{
90
v[n].
mlAction
=
eLuxCtxAction_Interact
; v[n].
msLabel
=
LuxCtxFocusLabel
(alFocus); ++n;
91
}
92
break
;
93
case
eLuxCtxState_UseItem
:
94
v[n].
mlAction
=
eLuxCtxAction_Interact
; v[n].
msLabel
=
"CtxUseItem"
; ++n;
95
break
;
96
case
eLuxCtxState_InteractGrab
:
97
v[n].
mlAction
=
eLuxCtxAction_Interact
; v[n].
msLabel
=
"CtxHoldToCarry"
; ++n;
98
v[n].
mlAction
=
eLuxCtxAction_Attack
; v[n].
msLabel
=
"CtxThrow"
; ++n;
99
v[n].
mlAction
=
eLuxCtxAction_Rotate
; v[n].
msLabel
=
"CtxRotate"
; ++n;
100
break
;
101
case
eLuxCtxState_InteractPush
:
102
v[n].
mlAction
=
eLuxCtxAction_Forward
; v[n].
msLabel
=
"CtxPush"
; ++n;
103
v[n].
mlAction
=
eLuxCtxAction_Interact
; v[n].
msLabel
=
"CtxLetGo"
; ++n;
104
break
;
105
case
eLuxCtxState_InteractSwingDoor
:
106
case
eLuxCtxState_InteractLever
:
107
case
eLuxCtxState_InteractWheel
:
108
case
eLuxCtxState_InteractSlide
:
109
v[n].
mlAction
=
eLuxCtxAction_Interact
; v[n].
msLabel
=
"CtxHoldAndMove"
; ++n;
110
break
;
111
case
eLuxCtxState_Ladder
:
112
v[n].
mlAction
=
eLuxCtxAction_Forward
; v[n].
msLabel
=
"CtxClimbUp"
; ++n;
113
v[n].
mlAction
=
eLuxCtxAction_Backward
; v[n].
msLabel
=
"CtxClimbDown"
; ++n;
114
break
;
115
default
:
116
break
;
117
}
118
int
lCount = n < alMax ? n : alMax;
119
for
(
int
i = 0; i < lCount; ++i) apOut[i] = v[i];
120
return
lCount;
121
}
122
123
#endif
kLuxCtxNoFocus
static const int kLuxCtxNoFocus
Definition
LuxContextControls.h:40
eLuxCtxFocus
eLuxCtxFocus
Definition
LuxContextControls.h:26
eLuxCtxFocus_Note
@ eLuxCtxFocus_Note
Definition
LuxContextControls.h:36
eLuxCtxFocus_LevelDoor
@ eLuxCtxFocus_LevelDoor
Definition
LuxContextControls.h:32
eLuxCtxFocus_Pick
@ eLuxCtxFocus_Pick
Definition
LuxContextControls.h:31
eLuxCtxFocus_Push
@ eLuxCtxFocus_Push
Definition
LuxContextControls.h:29
eLuxCtxFocus_PhoneBox
@ eLuxCtxFocus_PhoneBox
Definition
LuxContextControls.h:35
eLuxCtxFocus_Default
@ eLuxCtxFocus_Default
Definition
LuxContextControls.h:27
eLuxCtxFocus_Ladder
@ eLuxCtxFocus_Ladder
Definition
LuxContextControls.h:33
eLuxCtxFocus_VoiceOver
@ eLuxCtxFocus_VoiceOver
Definition
LuxContextControls.h:34
eLuxCtxFocus_Grab
@ eLuxCtxFocus_Grab
Definition
LuxContextControls.h:28
eLuxCtxFocus_Ignite
@ eLuxCtxFocus_Ignite
Definition
LuxContextControls.h:30
eLuxCtxFocus_LastEnum
@ eLuxCtxFocus_LastEnum
Definition
LuxContextControls.h:37
LuxCtxFocusLabel
const char * LuxCtxFocusLabel(int)
Prompt label for Interact on a focused entity: one word for everything (user decision: 互動 / Interact ...
Definition
LuxContextControls.h:72
kLuxCtxMaxPrompts
static const int kLuxCtxMaxPrompts
Definition
LuxContextControls.h:41
LuxCtxActionName
const char * LuxCtxActionName(int alAction)
Input action name as used by cLuxInputHandler::GetInputName / user_keys.cfg.
Definition
LuxContextControls.h:62
eLuxCtxAction
eLuxCtxAction
Definition
LuxContextControls.h:44
eLuxCtxAction_Backward
@ eLuxCtxAction_Backward
Definition
LuxContextControls.h:49
eLuxCtxAction_LastEnum
@ eLuxCtxAction_LastEnum
Definition
LuxContextControls.h:52
eLuxCtxAction_Rotate
@ eLuxCtxAction_Rotate
Definition
LuxContextControls.h:47
eLuxCtxAction_RecentText
@ eLuxCtxAction_RecentText
Definition
LuxContextControls.h:51
eLuxCtxAction_Attack
@ eLuxCtxAction_Attack
Definition
LuxContextControls.h:46
eLuxCtxAction_Interact
@ eLuxCtxAction_Interact
Definition
LuxContextControls.h:45
eLuxCtxAction_QuestLog
@ eLuxCtxAction_QuestLog
Definition
LuxContextControls.h:50
eLuxCtxAction_Forward
@ eLuxCtxAction_Forward
Definition
LuxContextControls.h:48
LuxContextPrompts
int LuxContextPrompts(int alState, int alFocus, cLuxCtxPrompt *apOut, int alMax)
Fills apOut (capacity alMax) and returns the number of prompts.
Definition
LuxContextControls.h:78
eLuxCtxState
eLuxCtxState
Definition
LuxContextControls.h:11
eLuxCtxState_HandObject
@ eLuxCtxState_HandObject
Definition
LuxContextControls.h:13
eLuxCtxState_InteractSwingDoor
@ eLuxCtxState_InteractSwingDoor
Definition
LuxContextControls.h:17
eLuxCtxState_InteractGrab
@ eLuxCtxState_InteractGrab
Definition
LuxContextControls.h:15
eLuxCtxState_InteractSlide
@ eLuxCtxState_InteractSlide
Definition
LuxContextControls.h:20
eLuxCtxState_Normal
@ eLuxCtxState_Normal
Definition
LuxContextControls.h:12
eLuxCtxState_LastEnum
@ eLuxCtxState_LastEnum
Definition
LuxContextControls.h:22
eLuxCtxState_InteractPush
@ eLuxCtxState_InteractPush
Definition
LuxContextControls.h:16
eLuxCtxState_InteractWheel
@ eLuxCtxState_InteractWheel
Definition
LuxContextControls.h:19
eLuxCtxState_InteractLever
@ eLuxCtxState_InteractLever
Definition
LuxContextControls.h:18
eLuxCtxState_Ladder
@ eLuxCtxState_Ladder
Definition
LuxContextControls.h:21
eLuxCtxState_UseItem
@ eLuxCtxState_UseItem
Definition
LuxContextControls.h:14
cLuxCtxPrompt
Definition
LuxContextControls.h:56
cLuxCtxPrompt::msLabel
const char * msLabel
Definition
LuxContextControls.h:58
cLuxCtxPrompt::mlAction
int mlAction
Definition
LuxContextControls.h:57
Game
src
game
LuxContextControls.h
Generated by
1.18.0