AMFP Enhanced
C++ reference: the code this unofficial fork added
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
11{
23};
24
26{
38};
39
40static const int kLuxCtxNoFocus = -1;
41static const int kLuxCtxMaxPrompts = 4;
42
44{
53};
54
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. */
62inline 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). */
72inline const char* LuxCtxFocusLabel(int /*alFocus*/)
73{
74 return "CtxInteract";
75}
76
77/** Fills apOut (capacity alMax) and returns the number of prompts. */
78inline int LuxContextPrompts(int alState, int alFocus, cLuxCtxPrompt* apOut, int alMax)
79{
81 int n = 0;
82 switch(alState)
83 {
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;
94 v[n].mlAction = eLuxCtxAction_Interact; v[n].msLabel = "CtxUseItem"; ++n;
95 break;
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;
102 v[n].mlAction = eLuxCtxAction_Forward; v[n].msLabel = "CtxPush"; ++n;
103 v[n].mlAction = eLuxCtxAction_Interact; v[n].msLabel = "CtxLetGo"; ++n;
104 break;
109 v[n].mlAction = eLuxCtxAction_Interact; v[n].msLabel = "CtxHoldAndMove"; ++n;
110 break;
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
static const int kLuxCtxNoFocus
@ eLuxCtxFocus_Note
@ eLuxCtxFocus_LevelDoor
@ eLuxCtxFocus_Pick
@ eLuxCtxFocus_Push
@ eLuxCtxFocus_PhoneBox
@ eLuxCtxFocus_Default
@ eLuxCtxFocus_Ladder
@ eLuxCtxFocus_VoiceOver
@ eLuxCtxFocus_Grab
@ eLuxCtxFocus_Ignite
@ eLuxCtxFocus_LastEnum
const char * LuxCtxFocusLabel(int)
Prompt label for Interact on a focused entity: one word for everything (user decision: 互動 / Interact ...
static const int kLuxCtxMaxPrompts
const char * LuxCtxActionName(int alAction)
Input action name as used by cLuxInputHandler::GetInputName / user_keys.cfg.
eLuxCtxAction
@ eLuxCtxAction_Backward
@ eLuxCtxAction_LastEnum
@ eLuxCtxAction_Rotate
@ eLuxCtxAction_RecentText
@ eLuxCtxAction_Attack
@ eLuxCtxAction_Interact
@ eLuxCtxAction_QuestLog
@ eLuxCtxAction_Forward
int LuxContextPrompts(int alState, int alFocus, cLuxCtxPrompt *apOut, int alMax)
Fills apOut (capacity alMax) and returns the number of prompts.
@ eLuxCtxState_HandObject
@ eLuxCtxState_InteractSwingDoor
@ eLuxCtxState_InteractGrab
@ eLuxCtxState_InteractSlide
@ eLuxCtxState_Normal
@ eLuxCtxState_LastEnum
@ eLuxCtxState_InteractPush
@ eLuxCtxState_InteractWheel
@ eLuxCtxState_InteractLever
@ eLuxCtxState_Ladder
@ eLuxCtxState_UseItem
const char * msLabel