fork/training-mode-ce
git clone https://git.julia.blue/fork/training-mode-ce
4f5d26e
techchase-camera
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{ 23SLCHRKIND_VS ,// regular vs 24SLCHRKIND_SNAPSHOT ,// camera mode 25SLCHRKIND_STAMINA ,// 26SLCHRKIND_SUDDEN ,// 27SLCHRKIND_GIANT ,// 28SLCHRKIND_TINY ,// 29SLCHRKIND_INVISIBLE ,// 30SLCHRKIND_FIXEDCAM ,// 31SLCHRKIND_SNGLBTN ,// 32SLCHRKIND_FAST ,// 33SLCHRKIND_SLOW ,// 34SLCHRKIND_CLASSIC ,// 35SLCHRKIND_ADV ,// 36SLCHRKIND_ALLSTAR ,// 37SLCHRKIND_EVENT ,// 38SLCHRKIND_TARGET ,// 39SLCHRKIND_HOMERUN ,// 40SLCHRKIND_MULTIMAN10 ,// 41SLCHRKIND_MULTIMAN100 ,// 42SLCHRKIND_MULTIMAN3MIN ,// 43SLCHRKIND_MULTIMAN15MIN ,// 44SLCHRKIND_MULTIMANENDLESS ,// 45SLCHRKIND_MULTIMANCRUEL ,// 46SLCHRKIND_TRAINING ,// 47}; 48 49enum CSSExitKind 50{ 51CSSEXIT_NONE ,// can be used to identify LRStart to go back to main menu 52CSSEXIT_SSS ,// 53CSSEXIT_MAINMENU ,// 54CSSEXIT_RULES ,// 55CSSEXIT_NAME ,// name entry 56CSSEXIT_SUBMENUOPEN ,// in rules / name entry 57}; 58 59/*** Structs ***/ 60struct CSSBackup 61{ 62u8 c_kind ;// 0x0 63u8 costume ;// 0x1 64u8 nametag ;// 0x2 65u8 event ;// 0x3 66u8 port ;// 0x4 67u8 x5 ;// 0x5 68u8 x6 ;// 0x6 69u8 x7 ;// 0x7 70u8 x8 ;// 0x8 71}; 72 73struct MnSelectChrDataTable 74{ 75COBJDesc * cobj ; 76void * lobj1 ; 77void * lobj2 ; 78void * fog ; 79struct 80 { 81JOBJSet bg ; 82JOBJSet cursor ; 83JOBJSet puck ; 84JOBJSet vsmenu ; 85JOBJSet start ; 86JOBJSet camdoor ; 87JOBJSet solomenu ; 88JOBJSet solooption ; 89JOBJSet cpudoor ; 90 }jobjset ; 91}; 92 93enum CSSCursorState 94{ 95SLCHRCUR_POINT , 96SLCHRCUR_HOLD , 97SLCHRCUR_OPEN , 98SLCHRCUR_HIDDEN , 99}; 100struct CSSCursor 101{ 102GOBJ * gobj ;// 0x0 103u8 door_id ;// 0x4, actually door index 104u8 state ;// 0x5, 0x0 = Pointing / 0x1 = Holding Puck / 0x2 = Open Hand / 0x3 = Hidden/Unplugged 105u8 puck ;// 0x6, puck index being held 106u8 x7 ;// 0x7, 107u16 is_over_option ;// 0x8, is hovered over an option on the top of the CSS (rules, teams, back) 108u16 exit_timer ;// 0xa, frames held B 109Vec2 pos ;// 0xc-0x10 110}; 111 112enum CSSObjectKind 113{ 114SLCHROBJKIND_P1PUCK , 115SLCHROBJKIND_P2PUCK , 116SLCHROBJKIND_P3PUCK , 117SLCHROBJKIND_P4PUCK , 118SLCHROBJKIND_P1CPU , 119SLCHROBJKIND_P2CPU , 120SLCHROBJKIND_P3CPU , 121SLCHROBJKIND_P4CPU , 122SLCHROBJKIND_P1HANDICAP , 123SLCHROBJKIND_P2HANDICAP , 124SLCHROBJKIND_P3HANDICAP , 125SLCHROBJKIND_P4HANDICAP , 126}; 127enum CSSPuckState 128{ 129SLCHRPUCK_0 , 130SLCHRPUCK_1 , 131SLCHRPUCK_2 , 132SLCHRPUCK_3 , 133}; 134struct CSSPuck 135{ 136GOBJ * gobj ;// 0x0, 137u8 door_id ;// 0x4, port this puck belongs to 138u8 state ;// 0x5, 139u8 kind ;// 0x6, port that this puck is being held by 140u8 anim_timer ;// 0x7, Animation Timer. resets animation when this hits 39, checked for @ 80262790 141Vec2 pos_proj ;// 0x8, where the puck should be 142Vec2 pos_correct ;// 0x10, where the puck is corrected to 143}; 144 145struct MnSlChrIcon 146{ 147u8 ft_hudindex ;// 0x0, used for getting combo count @ 8025c0c4 148u8 c_kind ;// 0x1, icons external ID 149u8 state ;// 0x2, Dictates whether icon can be chosen. 0x0 = Not Unlocked, 0x1 = Unlocked (temp value), 0x2 = Unlocked and Displayed 150u8 anim_timer ;// 0x3, is made to be 0xC when the character is chosen. 151u8 joint_id_vs ;// 0x4, vs icon background jobj ID 152u8 joint_id_1p ;// 0x5, 1p icon background jobj ID 153int sfx ;// 0x8, 154float bound_l ;// 0xC 155float bound_r ;// 0x10 156float bound_u ;// 0x14 157float bound_d ;// 0x18 158}; 159 160struct MnSlChrDoor 161{ 162u8 emblem_joint ;// 0x0 163u8 costume_joint ;// 0x1 164u8 team_joint ;// 0x2 165u8 door_joint ;// 0x3 166u8 bg_joint ;// 0x4 167u8 player_indicator_joint ;// 0x5, nametag window joint id (to scroll and choose a name) 168u8 slidername_joint ;// 0x6, slider name joint 169u8 cpuslider_joint ;// 0x7, used when only CPU is showing 170u8 cpuslider2_joint ;// 0x8, used when handicap is also showing 171u8 selected_since_load ;// 0x9, used to determine when the player made a selection since the CSS loaded 172u8 team ;// 0xa 173u8 p_kind ;// 0xb, PlayerKind, 0x0 = HMN, 0x1 = CPU, 0x3 = Closed 174u8 p_kind_prev ;// 0xc 175u8 costume ;// 0xd 176u8 sel_icon ;// 0xe, icon this player has selected 177u8 sel_icon_prev ;// 0xf 178u8 dooranim_timer ;// 0x10 179u8 slideranim_timer ;// 0x11 180u8 is_hold_cpu_slider ;// 0x12 181u8 is_hold_handicap_slider ;// 0x13 182float togglebtn_left ;// 0x14, HMN button bound 183float togglebtn_right ;// 0x18, HMN button bound 184float teambtn_left ;// 0x1C, team button bound 185float teambtn_right ;// 0x20, team button bound 186}; 187 188struct MnSlChrTagData 189{ 190Text * name ;// 0x0 191Text * namelist ;// 0x4, used when opening the tag window 192float x8 ;// 0x8 193float scroll_amt ;// xC, Text Y Offset to scroll up each frame 194float scroll_force ;// x10 195int timer ;// x14, state timer 196u8 next_tag ;// 0x18, index of next empty tag 197u8 port ; 198u8 state ;// 0x1a, is nametag window open bool 199u8 use_tag ;// 0x1b, is using a nametag bool 200}; 201 202struct MnSlChrTag 203{ 204MnSlChrTagData * tag_data ;// 0x0 205u8 x4 ;// 0x4 206u8 list_joint ;// 0x5 207u8 name_joint ;// 0x6 208u8 x7 ;// 0x7 209u8 kostartext_joint ;// 0x8 210u8 x9 ; 211u8 xa ; 212u8 xb ; 213}; 214 215struct MnSlChrKOStar 216{ 217Text * text ;// 0x0 218float x4 ;// 0x4 219u8 joint ;// 0x8 220int xc ; 221int x10 ; 222int x14 ; 223int x18 ; 224int x1c ; 225}; 226 227struct MnSlChrKindData 228{ 229u16 mode_ffa_frame ;// 0x0, anim frame used for the top left mode texture 230u16 mode_teams_frame ;// 0x2, anim frame used for the top left mode texture 231int enter_sfx ;// 0x4, announcer sfx used when entering the CSS 232}; 233 234struct MnSlChrData 235{ 236u8 GaWName [0x1C ];// 0x0 237MnSlChrKindData kind_data [24 ];// 0x1c 238MnSlChrIcon icons [25 + 1 ];// 0xDC 239MnSlChrDoor doors [4 ];// 0x3b4 240MnSlChrTag tags [4 ];// 0x444 241u8 x474 ;// 0x474 242u8 x475 ;// 0x475 243u8 x476 ;// 0x476 244u8 x477 ;// 0x477 245u8 x478 ;// 0x478 246u8 name_list_joint ;// 0x479, for singleplayer 247u8 tag_box_joint ;// 0x47a, for singleplayer 248u8 x47b ;// 0x47b 249u8 x47c ;// 0x47c 250u8 x47d ;// 0x47d 251u8 x47e ;// 0x47e 252u8 x47f ;// 0x47f 253u8 x480 ;// 0x480 254u8 x481 ;// 0x481 255u8 x482 ;// 0x482 256u8 x483 ;// 0x483 257int x484 ;// 0x484 258int x488 ;// 0x488 259float x48c ;// 0x48c 260float x490 ;// 0x490 261float x494 ;// 0x494 262float x498 ;// 0x498 263float x49c ;// 0x49c 264float x4a0 ;// 0x4a0 265u8 x4a4 [5 ];// 0x4a4 266float x4ac ;// 0x4ac 267float x4b0 ;// 0x4b0 268float x4b4 ;// 0x4b4 269float x4b8 ;// 0x4b8 270float x4bc ;// 0x4bc 271float x4c0 ;// 0x4c0 272MnSlChrKOStar ko_stars [4 ];// 0x4c4 273}; 274 275struct VSMinorData 276{ 277u16 snglply_port ;// 0x0, port index for single player (1 indexed) 278u8 css_kind ;// 0x2, 0 = VS 279u8 exit_kind ;// 0x3, 1 = advance, 2 = leave 280u8 * ko_data ;// 0x4, used for displaying KO stars on CSS 281ScDataVS vs_data ;// 0x8 282}; 283struct SSSMinorData 284{ 285u8 x0 ;// is made 0 upon entry 286u8 x1 ; 287u8 x2 ; 288u8 auto_random_stage ;// is -1 if random stage in rules is disabled 289u8 exit_kind ;// 0 = back, 1 = advance 290ScDataVS 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