fork/training-mode-ce

git clone https://git.julia.blue/fork/training-mode-ce

AitchAdd warnings and fix them (#297)4f5d26e

nix
12.6 KiB358 linesraw
1#ifndef MEX_H_CSS
2#define MEX_H_CSS
3
4#include "structs.h"
5#include "datatypes.h"
6#include "fighter.h"
7#include "scene.h"
8
9#define MENU_BUTTON_UP 0x1
10#define MENU_BUTTON_DOWN 0x2
11#define MENU_BUTTON_LEFT 0x4
12#define MENU_BUTTON_RIGHT 0x8
13#define MENU_BUTTON_A 0x10
14#define MENU_BUTTON_B 0x20
15#define MENU_BUTTON_L 0x40
16#define MENU_BUTTON_R 0x80
17#define MENU_BUTTON_START 0x100
18#define MENU_BUTTON_X 0x400
19#define MENU_BUTTON_Y 0x800
20
21enum CSSKind
22{
23    SLCHRKIND_VS,              // regular vs
24    SLCHRKIND_SNAPSHOT,        // camera mode
25    SLCHRKIND_STAMINA,         //
26    SLCHRKIND_SUDDEN,          //
27    SLCHRKIND_GIANT,           //
28    SLCHRKIND_TINY,            //
29    SLCHRKIND_INVISIBLE,       //
30    SLCHRKIND_FIXEDCAM,        //
31    SLCHRKIND_SNGLBTN,         //
32    SLCHRKIND_FAST,            //
33    SLCHRKIND_SLOW,            //
34    SLCHRKIND_CLASSIC,         //
35    SLCHRKIND_ADV,             //
36    SLCHRKIND_ALLSTAR,         //
37    SLCHRKIND_EVENT,           //
38    SLCHRKIND_TARGET,          //
39    SLCHRKIND_HOMERUN,         //
40    SLCHRKIND_MULTIMAN10,      //
41    SLCHRKIND_MULTIMAN100,     //
42    SLCHRKIND_MULTIMAN3MIN,    //
43    SLCHRKIND_MULTIMAN15MIN,   //
44    SLCHRKIND_MULTIMANENDLESS, //
45    SLCHRKIND_MULTIMANCRUEL,   //
46    SLCHRKIND_TRAINING,        //
47};
48
49enum CSSExitKind
50{
51    CSSEXIT_NONE,        // can be used to identify LRStart to go back to main menu
52    CSSEXIT_SSS,         //
53    CSSEXIT_MAINMENU,    //
54    CSSEXIT_RULES,       //
55    CSSEXIT_NAME,        // name entry
56    CSSEXIT_SUBMENUOPEN, // in rules / name entry
57};
58
59/*** Structs ***/
60struct CSSBackup
61{
62    u8 c_kind;  // 0x0
63    u8 costume; // 0x1
64    u8 nametag; // 0x2
65    u8 event;   // 0x3
66    u8 port;    // 0x4
67    u8 x5;      // 0x5
68    u8 x6;      // 0x6
69    u8 x7;      // 0x7
70    u8 x8;      // 0x8
71};
72
73struct MnSelectChrDataTable
74{
75    COBJDesc *cobj;
76    void *lobj1;
77    void *lobj2;
78    void *fog;
79    struct
80    {
81        JOBJSet bg;
82        JOBJSet cursor;
83        JOBJSet puck;
84        JOBJSet vsmenu;
85        JOBJSet start;
86        JOBJSet camdoor;
87        JOBJSet solomenu;
88        JOBJSet solooption;
89        JOBJSet cpudoor;
90    } jobjset;
91};
92
93enum CSSCursorState
94{
95    SLCHRCUR_POINT,
96    SLCHRCUR_HOLD,
97    SLCHRCUR_OPEN,
98    SLCHRCUR_HIDDEN,
99};
100struct CSSCursor
101{
102    GOBJ *gobj;         // 0x0
103    u8 door_id;         // 0x4, actually door index
104    u8 state;           // 0x5, 0x0 = Pointing / 0x1 = Holding Puck / 0x2 = Open Hand / 0x3 = Hidden/Unplugged
105    u8 puck;            // 0x6, puck index being held
106    u8 x7;              // 0x7,
107    u16 is_over_option; // 0x8, is hovered over an option on the top of the CSS (rules, teams, back)
108    u16 exit_timer;     // 0xa, frames held B
109    Vec2 pos;           // 0xc-0x10
110};
111
112enum CSSObjectKind
113{
114    SLCHROBJKIND_P1PUCK,
115    SLCHROBJKIND_P2PUCK,
116    SLCHROBJKIND_P3PUCK,
117    SLCHROBJKIND_P4PUCK,
118    SLCHROBJKIND_P1CPU,
119    SLCHROBJKIND_P2CPU,
120    SLCHROBJKIND_P3CPU,
121    SLCHROBJKIND_P4CPU,
122    SLCHROBJKIND_P1HANDICAP,
123    SLCHROBJKIND_P2HANDICAP,
124    SLCHROBJKIND_P3HANDICAP,
125    SLCHROBJKIND_P4HANDICAP,
126};
127enum CSSPuckState
128{
129    SLCHRPUCK_0,
130    SLCHRPUCK_1,
131    SLCHRPUCK_2,
132    SLCHRPUCK_3,
133};
134struct CSSPuck
135{
136    GOBJ *gobj;       // 0x0,
137    u8 door_id;       // 0x4, port this puck belongs to
138    u8 state;         // 0x5,
139    u8 kind;          // 0x6, port that this puck is being held by
140    u8 anim_timer;    // 0x7, Animation Timer. resets animation when this hits 39, checked for @ 80262790
141    Vec2 pos_proj;    // 0x8, where the puck should be
142    Vec2 pos_correct; // 0x10, where the puck is corrected to
143};
144
145struct MnSlChrIcon
146{
147    u8 ft_hudindex; // 0x0, used for getting combo count @ 8025c0c4
148    u8 c_kind;      // 0x1, icons external ID
149    u8 state;       // 0x2, Dictates whether icon can be chosen. 0x0 = Not Unlocked, 0x1 = Unlocked (temp value), 0x2 = Unlocked and Displayed
150    u8 anim_timer;  // 0x3, is made to be 0xC when the character is chosen.
151    u8 joint_id_vs; // 0x4, vs icon background jobj ID
152    u8 joint_id_1p; // 0x5, 1p icon background jobj ID
153    int sfx;        // 0x8,
154    float bound_l;  // 0xC
155    float bound_r;  // 0x10
156    float bound_u;  // 0x14
157    float bound_d;  // 0x18
158};
159
160struct MnSlChrDoor
161{
162    u8 emblem_joint;            // 0x0
163    u8 costume_joint;           // 0x1
164    u8 team_joint;              // 0x2
165    u8 door_joint;              // 0x3
166    u8 bg_joint;                // 0x4
167    u8 player_indicator_joint;  // 0x5, nametag window joint id (to scroll and choose a name)
168    u8 slidername_joint;        // 0x6, slider name joint
169    u8 cpuslider_joint;         // 0x7, used when only CPU is showing
170    u8 cpuslider2_joint;        // 0x8, used when handicap is also showing
171    u8 selected_since_load;     // 0x9, used to determine when the player made a selection since the CSS loaded
172    u8 team;                    // 0xa
173    u8 p_kind;                  // 0xb, PlayerKind, 0x0 = HMN, 0x1 = CPU, 0x3 = Closed
174    u8 p_kind_prev;             // 0xc
175    u8 costume;                 // 0xd
176    u8 sel_icon;                // 0xe, icon this player has selected
177    u8 sel_icon_prev;           // 0xf
178    u8 dooranim_timer;          // 0x10
179    u8 slideranim_timer;        // 0x11
180    u8 is_hold_cpu_slider;      // 0x12
181    u8 is_hold_handicap_slider; // 0x13
182    float togglebtn_left;       // 0x14, HMN button bound
183    float togglebtn_right;      // 0x18, HMN button bound
184    float teambtn_left;         // 0x1C, team button bound
185    float teambtn_right;        // 0x20, team button bound
186};
187
188struct MnSlChrTagData
189{
190    Text *name;         // 0x0
191    Text *namelist;     // 0x4, used when opening the tag window
192    float x8;           // 0x8
193    float scroll_amt;   // xC, Text Y Offset to scroll up each frame
194    float scroll_force; // x10
195    int timer;          // x14, state timer
196    u8 next_tag;        // 0x18, index of next empty tag
197    u8 port;
198    u8 state;   // 0x1a, is nametag window open bool
199    u8 use_tag; // 0x1b, is using a nametag bool
200};
201
202struct MnSlChrTag
203{
204    MnSlChrTagData *tag_data; // 0x0
205    u8 x4;                    // 0x4
206    u8 list_joint;            // 0x5
207    u8 name_joint;            // 0x6
208    u8 x7;                    // 0x7
209    u8 kostartext_joint;      // 0x8
210    u8 x9;
211    u8 xa;
212    u8 xb;
213};
214
215struct MnSlChrKOStar
216{
217    Text *text; // 0x0
218    float x4;   // 0x4
219    u8 joint;   // 0x8
220    int xc;
221    int x10;
222    int x14;
223    int x18;
224    int x1c;
225};
226
227struct MnSlChrKindData
228{
229    u16 mode_ffa_frame;   // 0x0, anim frame used for the top left mode texture
230    u16 mode_teams_frame; // 0x2, anim frame used for the top left mode texture
231    int enter_sfx;        // 0x4, announcer sfx used when entering the CSS
232};
233
234struct MnSlChrData
235{
236    u8 GaWName[0x1C];              // 0x0
237    MnSlChrKindData kind_data[24]; // 0x1c
238    MnSlChrIcon icons[25 + 1];     // 0xDC
239    MnSlChrDoor doors[4];          // 0x3b4
240    MnSlChrTag tags[4];            // 0x444
241    u8 x474;                       // 0x474
242    u8 x475;                       // 0x475
243    u8 x476;                       // 0x476
244    u8 x477;                       // 0x477
245    u8 x478;                       // 0x478
246    u8 name_list_joint;            // 0x479, for singleplayer
247    u8 tag_box_joint;              // 0x47a, for singleplayer
248    u8 x47b;                       // 0x47b
249    u8 x47c;                       // 0x47c
250    u8 x47d;                       // 0x47d
251    u8 x47e;                       // 0x47e
252    u8 x47f;                       // 0x47f
253    u8 x480;                       // 0x480
254    u8 x481;                       // 0x481
255    u8 x482;                       // 0x482
256    u8 x483;                       // 0x483
257    int x484;                      // 0x484
258    int x488;                      // 0x488
259    float x48c;                    // 0x48c
260    float x490;                    // 0x490
261    float x494;                    // 0x494
262    float x498;                    // 0x498
263    float x49c;                    // 0x49c
264    float x4a0;                    // 0x4a0
265    u8 x4a4[5];                    // 0x4a4
266    float x4ac;                    // 0x4ac
267    float x4b0;                    // 0x4b0
268    float x4b4;                    // 0x4b4
269    float x4b8;                    // 0x4b8
270    float x4bc;                    // 0x4bc
271    float x4c0;                    // 0x4c0
272    MnSlChrKOStar ko_stars[4];     // 0x4c4
273};
274
275struct VSMinorData
276{
277    u16 snglply_port; // 0x0, port index for single player (1 indexed)
278    u8 css_kind;      // 0x2, 0 = VS
279    u8 exit_kind;     // 0x3, 1 = advance, 2 = leave
280    u8 *ko_data;      // 0x4, used for displaying KO stars on CSS
281    ScDataVS vs_data; // 0x8
282};
283struct SSSMinorData
284{
285    u8 x0; // is made 0 upon entry
286    u8 x1;
287    u8 x2;
288    u8 auto_random_stage; // is -1 if random stage in rules is disabled
289    u8 exit_kind;         //  0 = back, 1 = advance
290    ScDataVS vs_data;
291};
292
293/*** Variables ***/
294static MnSlChrData *stc_css_data = (void *)0x803F0A48;         // 0x803f0a48
295static VSMinorData **stc_css_minorscene = (void *)0x804D6CB0;  // -0x49F0
296static u8 *stc_css_regtagnum = (void *)0x804D6CF8;             // -0x49A8, number of registered tags
297static s8 *stc_css_name_ply = (void *)0x804D6CF9;              // -0x49A7, index of the player using the name entry menu
298static HSD_Archive **stc_css_archive = (void *)0x804D6CD0;     // -0x49D0
299static HSD_Archive **stc_css_menuarchive = (void *)0x804D6CD4; // -0x49CC, ptr to MnMaExt archive
300static u8 *stc_css_custom_rules = (void *)0x804D6CF4;          // -0x49AC
301static GOBJ **stc_css_menugobj = (void *)0x804D6CBC;           // -0x49E4
302static JOBJ **stc_css_menumodel = (void *)0x804D6CC0;          // -0x49E0
303static JOBJ **stc_css_trainingmodel = (void *)0x804D6CC4;      // -0x49DC
304static JOBJ **stc_css_highscoremodel = (void *)0x804D6CC8;     // -0x49D8
305static JOBJ **stc_css_cameramodel = (void *)0x804D6CCC;        // -0x49D4
306static CSSCursor **stc_css_cursors = (void *)0x804A0BC0;       // 0x804a0bc0
307static CSSPuck **stc_css_pucks = (void *)0x804A0BD0;           // 0x804a0bd0
308
309static s8 *stc_css_hmnport = (void *)0x804D6CF0;                      // -0x49B0
310static s8 *stc_css_cpuport = (void *)0x804D6CF1;                      // -0x49AF
311static u8 *stc_css_delay = (void *)0x804D6CF2;                        // -0x49AE
312static u8 *stc_css_exitkind = (void *)0x804D6CF6;                     // -0x49AA
313static u8 *stc_css_maxply = (void *)0x804D6CF5;                       // -0x49AB
314static u8 *stc_css_is_ready_timer = (void *)0x804D6CF7;               // -0x49A9
315static u8 *stc_css_singeplyport = (void *)0x804D6CF0;                 // -0x4DE0
316static u8 *stc_menu_singeplyport = (void *)0x804D6598;                // -0x4DB8
317static Text **stc_css_ply1_combo_text = (void *)0x804D6CDC;           // -0x49C4
318static Text **stc_css_ply2_combo_text = (void *)0x804D6CE0;           // -0x49C0
319static Text **stc_css_ply3_combo_text = (void *)0x804D6CE4;           // -0x49BC
320static Text **stc_css_ply4_combo_text = (void *)0x804D6CE8;           // -0x49B8
321static int *stc_css_bgtimer = (void *)0x804D6CEC;                     // -0x49B4
322static u8 *stc_css_hasreleasedb = (void *)0x804D6CF3;                 // -0x49AD
323static MnSelectChrDataTable **stc_css_datatable = (void *)0x804D6CB4; // -0x49EC
324static JOBJSet **stc_css_jobjsets = (void *)0x804D6CD8;               // -0x49C8
325static COBJDesc **stc_css_cobjdesc = (void *)0x804D6BC4;              // -0x4ADC
326static GOBJ **stc_css_camgobj = (void *)0x804D6CB8;                   // -0x49E8
327static HSD_Pad *stc_css_pad = (void *)0x804C20BC;                     // 0x804c20bc
328static u8 *stc_css_unkarr = (void *)0x804D50C8;                       // 0x804d50c8
329
330/*** Functions ***/
331void MainMenu_CamRotateThink(GOBJ *gobj);
332int MainMenu_GetPadDown(int controller_index);  // returns HSD_BUTTON vals
333u64 MainMenu_GetPadRapid(int controller_index); // returns HSD_BUTTON vals
334int MainMenu_CheckForLRA();
335void MainMenu_DestroyAllTextCanvases(); // destroys all SIS canvases
336void CSS_FreeText();                    //
337int CSS_GetNametagRumble(int player, u8 tag);
338void CSS_InitPlayerData(PlayerData *player);
339void CSS_MenuModelThink(GOBJ *gobj);
340void CSS_CursorThink(GOBJ *gobj);
341void CSS_PuckThink(GOBJ *gobj);
342void CSS_TagThink(GOBJ *gobj);
343void CSS_UpdateRulesText();
344void CSS_UpdateKOStars(int ply, int unk);
345void CSS_StartThink(GOBJ *gobj);
346int CSS_GetHandicapValue(int ply, int nametag_id);
347void CSS_SetModeTexture(int css_kind);
348int CSS_ReturnPuck(int ply);
349int CSS_SetRandomFighter(int ply, int unk);
350void CSS_UpdateCSP(int ply);
351int CSS_GetCostumeNum(int ext_id);
352int CSS_GetCostumeRed(int c_kind);
353int CSS_GetCostumeBlue(int c_kind);
354int CSS_GetCostumeGreen(int c_kind);
355void CSS_PlayFighterName(int ext_id);
356void CSS_CostumeChange(int port, int button_down);
357void CSS_UpdateCSPTexture(int port, int costume, int is_none);
358#endif