fork/training-mode-ce
git clone https://git.julia.blue/fork/training-mode-ce
dcc8e3f
nix
1#ifndef SAVESTATE_V1_H 2#define SAVESTATE_V1_H 3 4#include "../MexTK/mex.h" 5 6#define EVENT_DATASIZE 512 7 8typedef struct FtSaveStateData_v1 9{ 10int is_exist ; 11int state_id ; 12float facing_direction ; 13float state_frame ; 14float state_rate ; 15float state_blend ; 16// Legacy - no longer used now that we update the animation when restoring state. 17Vec4 XRotN_rot ;// XRotN 18struct phys phys ; 19ColorOverlay color [3 ]; 20struct input input ; 21CollData coll_data ; 22struct 23 { 24void * alloc ;// 0x0 25CmSubject * next ;// 0x4 26int kind ;// 0x8 1 = disabled, 2 = only focus if close to center 27u8 flags_x80 :1 ;// 0xC 0x80 28u8 is_disable :1 ;// 0xC 0x40 29Vec3 cam_pos ;// 0x10 30Vec3 bone_pos ;// 0x1c 31float direction ;// 0x28 32float boundleft_curr ;// 0x2C 33float boundright_curr ;// 0x30 34float boundtop_curr ;// 0x34 35float boundbottom_curr ;// 0x38 36float x3c ;// 0x3c 37float boundleft_proj ;// 0x40 38float boundright_proj ;// 0x44 39float boundtop_proj ;// 0x48 40float boundbottom_proj ;// 0x4c 41// the savestate CmSubject struct is missing one field compared 42// to the CmSubject struct defined in MexTK 43 }camera_subject ; 44ftHit hitbox [4 ]; 45ftHit throw_hitbox [2 ]; 46ftHit thrown_hitbox ; 47struct flags flags ;// 0x2210 48struct fighter_var fighter_var ;// 0x222c 49struct state_var state_var ;// 0x2340 50struct ftcmd_var ftcmd_var ;// 0x2200 51struct 52 { 53int behavior ;// 0x182c 54float percent ;// 0x1830 55int x1834 ;// 0x1834 56float percent_temp ;// 0x1838 57int applied ;// 0x183c 58int x1840 ;// 0x1840 59FtDmgLog hit_log ;// 0x1844, info regarding the last solid hit 60FtDmgLog tip_log ;// 0x1870, info regarding the last phantom hit 61float tip_hitlag ;// 0x189c, hitlag is stored here during phantom hits @ 8006d774 62float tip_force_applied ;// 0x18a0, used to check if a tip happened this frame 63float kb_mag ;// 0x18a4 kb magnitude 64int x18a8 ;// 0x18a8 65int time_since_hit ;// 0x18ac in frames 66float armor_unk ;// 0x18b0, is prioritized over the armor below 67float armor ;// 0x18b4, used by yoshi double jump 68Vec2 vibrate_offset ;// 0x18b8 69int x18c0 ;// 0x18c0 70int source_ply ;// 0x18c4 damage source ply number 71int x18c8 ;// 0x18c8 72int x18cc ;// 0x18cc 73int x18d0 ;// 0x18d0 74int x18d4 ;// 0x18d4 75int x18d8 ;// 0x18d8 76int x18dc ;// 0x18dc 77int x18e0 ;// 0x18e0 78int x18e4 ;// 0x18e4 79int x18e8 ;// 0x18e8 80u16 atk_instance_hurtby ;// 0x18ec. Last Attack Instance This Player Was Hit by, 81int x18f0 ;// 0x18f0 82int x18f4 ;// 0x18f4 83u8 vibrate_index ;// 0x18f8, which dmg vibration values to use 84u8 x18f9 ;// 0x18f9 85u16 vibrate_timer ;// 0x18fa 86u8 vibrate_index_cur ;// 0x18fc, index of the current offset 87u8 vibrate_offset_num ;// 0x18fd, number of different offsets for this dmg vibration index 88Vec2 ground_slope ;// 0x1900 89int x1908 ;// 0x1908 90void * random_sfx_table ;// 0x190c, contains a ptr to an sfx table when requesting a random sfx 91int x1910 ;// 0x1910 92int x1914 ;// 0x1914 93struct // aka clank 94 {// 95int dmg_dealt ;// 0x1918, 96float dmg_based_rate_mult ;// 0x191c, updated @ 80077aec (when hitting projectile). is equal to 3 + (damageDealt * 0.3) 97float dir ;// 0x1920, direction the rebound/clank occured in 98 }rebound ;// 99int x1924 ;// 0x1924 100int x1928 ;// 0x1928 101int x192c ;// 0x192c 102struct // 0x1930 103 {// 104Vec3 pos_prev ;// 0x1930 105Vec3 pos_cur ;// 0x193c 106 }footstool ;// 107int x1948 ;// 0x1948 108int x194c ;// 0x194c 109int x1950 ;// 0x1950 110float x1954 ;// 0x1954, 111float hitlag_env_frames ;// 0x1958, Environment Hitlag Counter (used for peachs castle switches) 112float hitlag_frames ;// 0x195c 113// the savestate dmg struct is missing two fields compared 114// to the dmg struct defined in MexTK 115 }dmg ; 116struct grab grab ;// 0x1a4c 117struct jump jump ;// 0x1968 118struct smash smash ;// 0x2114 119struct hurt hurt ;// 0x1988 120struct shield shield ; 121struct shield_bubble shield_bubble ;// 0x19c0 122struct reflect_bubble reflect_bubble ;// 0x19e4 123struct absorb_bubble absorb_bubble ;// 0x1a08 124struct reflect_hit reflect_hit ;// 0x1a2c 125struct absorb_hit absorb_hit ;// 0x1a40 126struct cb cb ; 127}FtSaveStateData_v1 ; 128 129typedef struct FtSaveState_v1 130{ 131FtSaveStateData_v1 data [2 ]; 132struct 133 { 134int state ;// 0x00 = not present, 0x02 = HMN, 0x03 = CPU 135int c_kind ;// external ID 136int p_kind ;// (0x00 is HMN, 0x01 is CPU, 0x02 is Demo, 0x03 n/a) 137u8 isTransformed [2 ];// 0xC, 1 indicates the fighter that is active 138Vec3 tagPos ;// 0x10 139Vec3 spawnPos ;// 0x1C 140Vec3 respawnPos ;// 0x28 141int x34 ; 142int x38 ; 143int x3C ; 144float initialFacing ;// 0x40 145u8 costume ;// 0x44 146u8 color_accent ;// 0x45, will correspond to port color when ffa and team color when teams 147u8 tint ;// 0x46 148u8 team ;// 0x47 149u8 controller ;// 0x48 150u8 cpuLv ;// 0x49 151u8 cpuKind ;// 0x4a 152u8 handicap ;// 0x4b 153u8 x4c ;// 0x4c 154u8 kirby_copy ;// 0x4d, index of kirby copy ability 155u8 x4e ;// 0x4e 156u8 x4f ;// 0x4f 157float attack ;// 0x50 158float defense ;// 0x54 159float scale ;// 0x58 160u16 damage ;// 0x5c 161u16 initialDamage ;// 0x5e 162u16 stamina ;// 0x60 163int falls [2 ];// 0x68 164int ko [6 ];// 0x70 165int x88 ; 166u16 selfDestructs ; 167u8 stocks ; 168int coins_curr ; 169int coins_total ; 170int x98 ; 171int x9c ; 172int stickSmashes [2 ]; 173int tag ; 174u8 xac_80 :1 ;// 0xac, 0x80 175u8 is_multispawn :1 ;// 0xac, 0x40 176u8 xac_3f :6 ;// 0xac, 0x3f 177u8 xad ;// 0xad 178u8 xae ;// 0xae 179u8 xaf ;// 0xaf 180GOBJ * gobj [2 ];// 0xb0 181// Omitting Playerblock fields recently added to MexTK 182 }player_block ; 183int stale_queue [11 ]; 184}FtSaveState_v1 ; 185 186typedef struct Savestate_v1 187{ 188int is_exist ; 189int frame ; 190u8 event_data [EVENT_DATASIZE ]; 191FtSaveState_v1 ft_state [6 ]; 192}Savestate_v1 ; 193 194enum savestate_flags { 195// save: perform initial safety checks 196Savestate_Checks = 1 <<0 , 197 198// save/load: don't play sfx and screen flash 199Savestate_Silent = 1 <<1 , 200 201// load: mirror savestate 202Savestate_Mirror = 1 <<2 , 203}; 204 205int Savestate_Save_v1 (Savestate_v1 * savestate ,int flags ); 206int Savestate_Load_v1 (Savestate_v1 * savestate ,int flags ); 207 208#endif