Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/Menu/UIControl.h
338 views
1
#ifndef OBJ_UICONTROL_H
2
#define OBJ_UICONTROL_H
3
4
#include "Game.h"
5
6
#define UICONTROL_BUTTON_COUNT (64)
7
#if MANIA_USE_PLUS
8
#define UICONTROL_PROMPT_COUNT (4)
9
#endif
10
11
// Object Class
12
struct ObjectUIControl {
13
RSDK_OBJECT
14
bool32 isProcessingInput;
15
bool32 inputLocked;
16
bool32 lockInput;
17
bool32 upPress[PLAYER_COUNT];
18
bool32 downPress[PLAYER_COUNT];
19
bool32 leftPress[PLAYER_COUNT];
20
bool32 rightPress[PLAYER_COUNT];
21
bool32 backPress[PLAYER_COUNT];
22
bool32 confirmPress[PLAYER_COUNT];
23
bool32 yPress[PLAYER_COUNT];
24
bool32 xPress[PLAYER_COUNT];
25
#if MANIA_USE_PLUS
26
bool32 startPress[PLAYER_COUNT];
27
#endif
28
bool32 anyUpPress;
29
bool32 anyDownPress;
30
bool32 anyLeftPress;
31
bool32 anyRightPress;
32
bool32 anyConfirmPress;
33
bool32 anyBackPress;
34
bool32 anyYPress;
35
bool32 anyXPress;
36
#if MANIA_USE_PLUS
37
bool32 anyStartPress;
38
#endif
39
bool32 forceBackPress;
40
bool32 hasTouchInput;
41
int32 timer;
42
int32 unused1;
43
uint16 aniFrames;
44
};
45
46
// Entity Class
47
struct EntityUIControl {
48
RSDK_ENTITY
49
StateMachine(state);
50
int32 unused1;
51
int32 buttonID;
52
String tag;
53
String parentTag;
54
bool32 activeOnLoad;
55
bool32 noWidgets;
56
bool32 resetSelection;
57
uint8 buttonCount;
58
#if MANIA_USE_PLUS
59
uint8 promptCount;
60
#endif
61
uint8 rowCount;
62
uint8 columnCount;
63
uint8 startingID;
64
Vector2 size;
65
Vector2 cameraOffset;
66
Vector2 scrollSpeed;
67
#if MANIA_USE_PLUS
68
bool32 noClamp;
69
bool32 noWrap;
70
#endif
71
Vector2 startPos;
72
Vector2 targetPos;
73
bool32 childHasFocus;
74
bool32 dialogHasFocus;
75
#if MANIA_USE_PLUS
76
bool32 popoverHasFocus;
77
#endif
78
bool32 hasStoredButton;
79
bool32 selectionDisabled;
80
#if MANIA_USE_PLUS
81
bool32 menuWasSetup;
82
#endif
83
int32 backoutTimer;
84
int32 storedButtonID;
85
int32 lastButtonID;
86
EntityUIHeading *heading;
87
EntityUIShifter *shifter;
88
#if MANIA_USE_PLUS
89
EntityUICarousel *carousel;
90
EntityUIButtonPrompt *prompts[UICONTROL_PROMPT_COUNT];
91
#endif
92
EntityUIButton *buttons[UICONTROL_BUTTON_COUNT];
93
bool32 (*backPressCB)(void);
94
void (*processButtonInputCB)(void);
95
void (*menuSetupCB)(void);
96
void (*menuUpdateCB)(void);
97
void (*yPressCB)(void);
98
void (*xPressCB)(void);
99
int32 unused2;
100
int32 unused3;
101
int32 unused4;
102
int32 unused5;
103
int32 unused6;
104
int32 unused7;
105
};
106
107
// Object Struct
108
extern ObjectUIControl *UIControl;
109
110
// Standard Entity Events
111
void UIControl_Update(void);
112
void UIControl_LateUpdate(void);
113
void UIControl_StaticUpdate(void);
114
void UIControl_Draw(void);
115
void UIControl_Create(void *data);
116
void UIControl_StageLoad(void);
117
#if GAME_INCLUDE_EDITOR
118
void UIControl_EditorDraw(void);
119
void UIControl_EditorLoad(void);
120
#endif
121
void UIControl_Serialize(void);
122
123
// Extra Entity Functions
124
int32 UIControl_GetButtonID(EntityUIControl *control, EntityUIButton *entity);
125
void UIControl_MenuChangeButtonInit(EntityUIControl *control);
126
127
#if MANIA_USE_PLUS
128
void UIControl_SetActiveMenuButtonPrompts(EntityUIControl *entity);
129
#endif
130
void UIControl_SetActiveMenu(EntityUIControl *entity);
131
void UIControl_SetMenuLostFocus(EntityUIControl *entity);
132
void UIControl_SetInactiveMenu(EntityUIControl *entity);
133
void UIControl_SetupButtons(void);
134
135
EntityUIControl *UIControl_GetUIControl(void);
136
bool32 UIControl_isMoving(EntityUIControl *entity);
137
void UIControl_MatchMenuTag(const char *text);
138
void UIControl_HandleMenuChange(String *newMenuTag);
139
void UIControl_HandleMenuLoseFocus(EntityUIControl *parent);
140
void UIControl_ReturnToParentMenu(void);
141
142
void UIControl_ClearInputs(uint8 buttonID);
143
#if MANIA_USE_PLUS
144
void UIControl_SetTargetPos(EntityUIControl *entity, int32 x, int32 y);
145
#endif
146
void UIControl_HandlePosition(void);
147
void UIControl_ProcessInputs(void);
148
void UIControl_ProcessButtonInput(void);
149
bool32 UIControl_ContainsPos(EntityUIControl *control, Vector2 *pos);
150
151
#endif //! OBJ_UICONTROL_H
152
153