From f40105e778ae46f19beabe7fe3684a592e9ae102 Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Tue, 24 Dec 2024 10:48:09 -0600 Subject: [PATCH] Updated vs decomp --- assets/yaml/us/rev1/ast_common.yaml | 4 +- config.yml | 36 +- include/assets/ast_common.h | 2 +- include/bgm.h | 6 + include/fox_option.h | 24 +- include/functions.h | 4 +- include/i5.h | 2 +- include/macros.h | 4 + include/prevent_context_reordering.h | 6 +- include/sf64audio_provisional.h | 12 +- include/sf64object.h | 74 ++-- include/sf64player.h | 36 +- include/sf64save.h | 19 +- include/variables.h | 2 +- .../jp/rev0/symbol_addrs_overlays.txt | 1 + src/audio/audio_effects.c | 5 +- src/audio/audio_general.c | 10 +- src/audio/audio_heap.c | 11 +- src/audio/audio_load.c | 9 +- src/audio/audio_playback.c | 306 ++++++++-------- src/audio/audio_seqplayer.c | 23 +- src/audio/audio_synthesis.c | 184 ++++++---- src/engine/fox_360.c | 26 +- src/engine/fox_beam.c | 51 ++- src/engine/fox_bg.c | 146 ++++---- src/engine/fox_boss.c | 2 +- src/engine/fox_demo.c | 38 +- src/engine/fox_display.c | 58 ++- src/engine/fox_edata_info.c | 4 +- src/engine/fox_edisplay.c | 115 +++--- src/engine/fox_effect.c | 36 +- src/engine/fox_enmy.c | 44 +-- src/engine/fox_enmy2.c | 10 +- src/engine/fox_hud.c | 97 +++-- src/engine/fox_play.c | 168 ++++----- src/engine/fox_radio.c | 3 +- src/engine/fox_save.c | 139 +++++++- src/engine/fox_std_lib.c | 11 +- src/engine/fox_tank.c | 7 +- src/engine/fox_versus.c | 23 +- src/mods/object_ram.c | 10 +- src/mods/spawner.c | 4 +- src/overlays/ovl_ending/fox_end2.c | 9 +- src/overlays/ovl_ending/fox_end2_data.c | 2 +- src/overlays/ovl_i1/fox_co.c | 35 +- src/overlays/ovl_i1/fox_tr360.c | 2 +- src/overlays/ovl_i1/fox_ve1.c | 2 +- src/overlays/ovl_i2/fox_me.c | 19 +- src/overlays/ovl_i2/fox_sx.c | 92 ++--- src/overlays/ovl_i3/fox_a6.c | 17 +- src/overlays/ovl_i3/fox_aq.c | 104 +++++- src/overlays/ovl_i3/fox_so.c | 16 +- src/overlays/ovl_i3/fox_zo.c | 118 +++--- src/overlays/ovl_i4/fox_bo.c | 17 +- src/overlays/ovl_i4/fox_fo.c | 24 +- src/overlays/ovl_i4/fox_ka.c | 42 +-- src/overlays/ovl_i4/fox_sz.c | 40 +-- src/overlays/ovl_i5/fox_ma.c | 38 +- src/overlays/ovl_i5/fox_ti.c | 195 +++++----- src/overlays/ovl_i5/fox_ti_cs.c | 4 +- src/overlays/ovl_i6/fox_andross.c | 48 +-- src/overlays/ovl_i6/fox_sy.c | 28 +- src/overlays/ovl_i6/fox_ve2.c | 11 +- src/overlays/ovl_menu/fox_map.c | 2 +- src/overlays/ovl_menu/fox_option.c | 28 +- src/overlays/ovl_menu/fox_title.c | 2 +- srcjp/audio/audio_tables.c | 337 ++++++++++++++++++ tools/Torch | 2 +- yamls/eu/rev0/main.yaml | 2 +- yamls/jp/rev0/header.yaml | 1 + yamls/jp/rev0/main.yaml | 2 +- yamls/jp/rev0/overlays.yaml | 22 +- yamls/us/rev1/overlays.yaml | 22 +- 73 files changed, 1850 insertions(+), 1205 deletions(-) create mode 100644 linker_scripts/jp/rev0/symbol_addrs_overlays.txt create mode 100644 srcjp/audio/audio_tables.c diff --git a/assets/yaml/us/rev1/ast_common.yaml b/assets/yaml/us/rev1/ast_common.yaml index 5fa0ca74..1f5dd578 100644 --- a/assets/yaml/us/rev1/ast_common.yaml +++ b/assets/yaml/us/rev1/ast_common.yaml @@ -920,8 +920,8 @@ D_102A010: D_102A098: { type: TEXTURE, format: RGBA16, width: 32, height: 32, ctype: u16, offset: 0x102A098, symbol: D_102A098 } -aRadarMarkKaSaucererDL: - { type: GFX, offset: 0x102A8A0, symbol: aRadarMarkKaSaucererDL } +aBallDL: + { type: GFX, offset: 0x102A8A0, symbol: aBallDL } D_102A928: { type: TEXTURE, format: RGBA16, width: 16, height: 16, ctype: u16, offset: 0x102A928, symbol: D_102A928 } diff --git a/config.yml b/config.yml index dbfa5f0d..21db6ae5 100644 --- a/config.yml +++ b/config.yml @@ -29,21 +29,21 @@ f7475fb11e7e6830f82883412638e8390791ab87: - include/sf64event.h - include/sf64player.h -d064229a32cc05ab85e2381ce07744eb3ffaf530: - name: Star Fox 64 (JP) (V1.0) - path: assets/yaml/jp/rev0 - config: - gbi: F3DEX - sort: OFFSET - output: - binary: mods/sf64jp.otr - code: src/assets - headers: include/assets - modding: src/assets - enums: - - include/sf64object.h - - include/sf64level.h - - include/sf64mesg.h - - include/sf64audio_external.h - - include/sf64event.h - - include/sf64player.h \ No newline at end of file +# d064229a32cc05ab85e2381ce07744eb3ffaf530: +# name: Star Fox 64 (JP) (V1.0) +# path: assets/yaml/jp/rev0 +# config: +# gbi: F3DEX +# sort: OFFSET +# output: +# binary: starship.otr +# code: src/assets +# headers: include/assets +# modding: src/assets +# enums: +# - include/sf64object.h +# - include/sf64level.h +# - include/sf64mesg.h +# - include/sf64audio_external.h +# - include/sf64event.h +# - include/sf64player.h diff --git a/include/assets/ast_common.h b/include/assets/ast_common.h index 24f975f7..545650b9 100644 --- a/include/assets/ast_common.h +++ b/include/assets/ast_common.h @@ -787,7 +787,7 @@ static const ALIGN_ASSET(2) char ast_common_seg1_vtx_2A068[] = "__OTR__ast_commo static const ALIGN_ASSET(2) char D_102A098[] = "__OTR__ast_common/D_102A098"; -static const ALIGN_ASSET(2) char aRadarMarkKaSaucererDL[] = "__OTR__ast_common/aRadarMarkKaSaucererDL"; +static const ALIGN_ASSET(2) char aBallDL[] = "__OTR__ast_common/aBallDL"; static const ALIGN_ASSET(2) char ast_common_seg1_vtx_2A8F8[] = "__OTR__ast_common/ast_common_seg1_vtx_2A8F8"; diff --git a/include/bgm.h b/include/bgm.h index 3f5c6376..62f92d74 100644 --- a/include/bgm.h +++ b/include/bgm.h @@ -81,7 +81,12 @@ typedef enum BgmSeqIds { /* 63 */ SEQ_ID_TRAINING, /* 64 */ SEQ_ID_VE_CLEAR, /* 65 */ SEQ_ID_BOSS_RESUME, +#ifdef VERSION_EU + /* 66 */ SEQ_ID_VOICE_LYLAT, + /* 67 */ SEQ_ID_MAX, +#else /* 66 */ SEQ_ID_MAX, +#endif /* -1 */ SEQ_ID_NONE = 0xFFFF, } BgmSeqIds; @@ -89,6 +94,7 @@ typedef enum BgmSeqIds { #define NA_BGM_SE (SEQ_ID_SFX) #define NA_BGM_VO (SEQ_ID_VOICE) +#define NA_BGM_VO_LYLAT (SEQ_ID_VOICE_LYLAT) #define NA_BGM_STAGE_CO (SEQ_ID_CORNERIA | SEQ_FLAG) #define NA_BGM_STAGE_ME (SEQ_ID_METEO | SEQ_FLAG) #define NA_BGM_STAGE_TI (SEQ_ID_TITANIA | SEQ_FLAG) diff --git a/include/fox_option.h b/include/fox_option.h index 51e23099..9605a727 100644 --- a/include/fox_option.h +++ b/include/fox_option.h @@ -57,19 +57,25 @@ typedef enum OptionId { /* 1000 */ OPTION_MAIN_MENU = 1000, /* 2000 */ OPTION_VERSUS_STAGE = 2000, /* 0 */ OPTION_MAP = 0, - /* 1 */ OPTION_TRAINING = 1, - /* 2 */ OPTION_VERSUS = 2, - /* 3 */ OPTION_RANKING = 3, - /* 4 */ OPTION_SOUND = 4, - /* 5 */ OPTION_DATA = 5, - /* 6 */ OPTION_EXPERT_SOUND = 6, + /* 1 */ OPTION_TRAINING, + /* 2 */ OPTION_VERSUS, + /* 3 */ OPTION_RANKING, + /* 4 */ OPTION_SOUND, +#ifdef VERSION_EU + /* 5 */ OPTION_LANGUAGE, + /* 6 */ OPTION_DATA, + /* 7 */ OPTION_EXPERT_SOUND, +#else + /* 5 */ OPTION_DATA, + /* 6 */ OPTION_EXPERT_SOUND, +#endif /* 10 */ OPTION_POINT_MATCH = 10, // Point Match /* 20 */ OPTION_BR_MATCH = 20, // Battle Royal Match /* 30 */ OPTION_TT_MATCH = 30, // Time Trial Match /* 200 */ OPTION_NAME_ENTRY = 200, /* 300 */ OPTION_SCORE = 300, /* 400 */ OPTION_INVOICE = 400, - /* 401 */ OPTION_MAX, + /* 401 */ OPTION_MAX } OptionId; extern u8* gBSSMapPlanetTextures[9]; @@ -196,8 +202,8 @@ void Option_SetMenuLightPos(f32, f32, f32, f32*, f32*, f32*); void Option_CardLightning_Update(void); void Option_CardLightning_Draw(void); void Option_DrawCardLabel(OptionCardTexture tex); -bool Option_Input_MoveCursor_Y(s32* arg0, s32 arg1, bool arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 controllerNum, - StickInput* stickY); +bool Option_Input_MoveCursor_Y(s32* arg0, s32 arg1, bool arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, + s32 controllerNum, StickInput* stickY); s32 Option_Input_DataSelect_X(s32*); bool Option_Input_Sound_X(f32* arg0, f32 arg1, f32 arg2, StickInput* arg3); void Option_Color_FlashRed(f32*); diff --git a/include/functions.h b/include/functions.h index 4c253777..b85f8490 100644 --- a/include/functions.h +++ b/include/functions.h @@ -403,7 +403,7 @@ s32 HUD_8008CB8C(void); void HUD_VS_ShieldGaugeTex_Draw(f32, f32, f32, f32, f32); void HUD_DrawBossHealth(void); void HUD_DrawCountdown(s32* , f32); -void HUD_Shield_GoldRings_HitPoints(f32, f32); +void HUD_Shield_GoldRings_Score(f32, f32); void HUD_BombCounter_Draw(f32, f32); void HUD_Draw(void); void FoBase_Draw(Boss*); @@ -424,7 +424,7 @@ void Aquas_AqRock_Setup(Actor*, s32); void Aquas_CsLevelComplete(Player*); void Aquas_Effect363_Update(Effect*); void Aquas_Effect363_Draw(Effect*); -void HUD_Hitpoints_Draw(f32, f32); +void HUD_Score_Draw(f32, f32); void Venom1_LevelStart2(Player* player); // fox_col1 diff --git a/include/i5.h b/include/i5.h index aa26402e..ea4c4b94 100644 --- a/include/i5.h +++ b/include/i5.h @@ -37,7 +37,7 @@ void Titania_TiDelphorHead_Init(Actor *); void Titania_TiCactus_Init(Sprite *); void Titania_TiPillar_Init(Scenery *); void Titania_TiGoras_Init(Boss *); -void Titania_801990DC(Boss *); +void Titania_TiGoras_Dying(Boss *); void Macbeth_InitLevel(void); void Macbeth_Train_Init(Actor *); void Macbeth_MaMaRailroadSwitch_Init(Actor *); diff --git a/include/macros.h b/include/macros.h index 4e9480f9..a567fc5c 100644 --- a/include/macros.h +++ b/include/macros.h @@ -12,6 +12,10 @@ #define TIME_IN_SECONDS(x) (x * 30); +#define CLAMP(x, min, max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x)) +#define CLAMP_MAX(x, max) ((x) > (max) ? (max) : (x)) +#define CLAMP_MIN(x, min) ((x) < (min) ? (min) : (x)) + #define RAND_FLOAT(max) (Rand_ZeroOne()*(max)) #define RAND_INT(max) ((s32)(Rand_ZeroOne()*(max))) #define RAND_FLOAT_CENTERED(width) ((Rand_ZeroOne()-0.5f)*(width)) diff --git a/include/prevent_context_reordering.h b/include/prevent_context_reordering.h index 2d25120c..cc009271 100644 --- a/include/prevent_context_reordering.h +++ b/include/prevent_context_reordering.h @@ -1,7 +1,7 @@ #ifndef PREVENT_CONTEXT_REORDERING_H #define PREVENT_CONTEXT_REORDERING_H -// extern int Dummyhalf; +extern int Dummyhalf; // struct Dummy0 {int x;}; // struct Dummy1 {int x;}; // struct Dummy2 {int x;}; @@ -17,8 +17,8 @@ // struct Dummy12 {int x;}; // struct Dummy13 {int x;}; // struct Dummy14 {int x;}; -struct Dummy15 {int x;}; -struct Dummy16 {int x;}; +// struct Dummy15 {int x;}; +// struct Dummy16 {int x;}; struct Dummy17 {int x;}; struct Dummy18 {int x;}; struct Dummy19 {int x;}; diff --git a/include/sf64audio_provisional.h b/include/sf64audio_provisional.h index 7641d543..0629b588 100644 --- a/include/sf64audio_provisional.h +++ b/include/sf64audio_provisional.h @@ -52,7 +52,7 @@ typedef void (*AudioCustomUpdateFunction)(void); // Samples are processed in groups of 16 called a "frame" #define SAMPLES_PER_FRAME ADPCMFSIZE -// The length of one left/right channel is 13 frames +// The length of one left/right channel is 12 frames #define DMEM_1CH_SIZE (12 * SAMPLES_PER_FRAME * SAMPLE_SIZE) // Both left and right channels #define DMEM_2CH_SIZE (2 * DMEM_1CH_SIZE) @@ -1059,20 +1059,20 @@ void AudioLoad_DiscardSeqFonts(s32 seqId); s32 AudioLoad_SlowLoadSample(s32 fontId, u8 instId, s8* status); // audio_playback -TunedSample* Audio_GetInstrumentTunedSample(Instrument* instrument, s32 arg1); +TunedSample* Audio_GetInstrumentTunedSample(Instrument* instrument, s32 semitone); Instrument* Audio_GetInstrument(s32, s32); Drum* Audio_GetDrum(s32, s32); -void func_80011F4C(Note* note); +void Audio_NoteDisable(Note* note); void Audio_ProcessNotes(void); void Audio_SeqLayerNoteDecay(SequenceLayer* layer); void Audio_InitSyntheticWave(Note* note, SequenceLayer* layer); void Audio_InitNoteLists(NotePool* pool); -void func_800128B4(void); +void Audio_InitNoteFreeList(void); void Audio_NotePoolClear(NotePool* pool); void Audio_NotePoolFill(NotePool* pool, s32); -void func_80012C40(Note* note); +void Audio_AudioListRemove(Note* note); Note* Audio_AllocNote(SequenceLayer* layer); -void func_800132E8(void); +void Audio_NoteInitAll(void); // audio_seqplayer void AudioSeq_SequenceChannelDisable(SequenceChannel* channel); diff --git a/include/sf64object.h b/include/sf64object.h index 5a87d32a..5f653ff1 100644 --- a/include/sf64object.h +++ b/include/sf64object.h @@ -8,6 +8,16 @@ #define HITBOX_SHADOW 300000.0f #define HITBOX_WHOOSH 400000.0f +#define TEAM_FACE (14) + +typedef enum ActorCSTeamFace { + /* 0 */ FACE_NONE, + /* 1 */ FACE_FOX, + /* 2 */ FACE_FALCO, + /* 3 */ FACE_SLIPPY, + /* 4 */ FACE_PEPPY +} ActorCSTeamFace; + typedef struct { /* 0x0 */ f32 offset; /* 0x4 */ f32 size; @@ -488,7 +498,7 @@ typedef enum ObjectId { /* 179 */ OBJ_ACTOR_CO_GARUDA_DESTROY, /* 180 */ OBJ_ACTOR_ME_MOLAR_ROCK, /* 181 */ OBJ_ACTOR_ME_METEOR_1, - /* 182 */ OBJ_ACTOR_ME_METEOR_2, // Smaller than Meteor 1 + /* 182 */ OBJ_ACTOR_ME_METEOR_2, // Smaller than Meteor 1, used in Meteo intro cutscene. /* 183 */ OBJ_ACTOR_ME_METEOR_SHOWER_1, /* 184 */ OBJ_ACTOR_ME_METEOR_SHOWER_2, /* 185 */ OBJ_ACTOR_ME_METEOR_SHOWER_3, @@ -496,8 +506,8 @@ typedef enum ObjectId { /* 187 */ OBJ_ACTOR_ME_LASER_CANNON_2, /* 188 */ OBJ_ACTOR_AQ_UNK_188, // Unimplemented actor. /* 189 */ OBJ_ACTOR_DEBRIS, - /* 190 */ OBJ_MISSILE_SEEK_TEAM, - /* 191 */ OBJ_MISSILE_SEEK_PLAYER, + /* 190 */ OBJ_ACTOR_MISSILE_SEEK_TEAM, + /* 191 */ OBJ_ACTOR_MISSILE_SEEK_PLAYER, /* 192 */ OBJ_ACTOR_CO_SKIBOT, /* 193 */ OBJ_ACTOR_CO_RADAR, /* 194 */ OBJ_ACTOR_ME_MORA, @@ -561,7 +571,7 @@ typedef enum ObjectId { /* 252 */ OBJ_ACTOR_ZO_RADARBUOY, // Zoness searchlight. /* 253 */ OBJ_ACTOR_ZO_SUPPLYCRANE, /* 254 */ OBJ_ACTOR_ZO_SEARCHLIGHT, - /* 255 */ OBJ_ACTOR_255, + /* 255 */ OBJ_ACTOR_255, // OBJ_ACTOR_AQ_SANADA (Named after from SFX_ID) /* 256 */ OBJ_ACTOR_256, /* 257 */ OBJ_ACTOR_257, /* 258 */ OBJ_ACTOR_AQ_PEARL, @@ -780,34 +790,34 @@ typedef enum AllRangeAi { } AllRangeAi; typedef enum ActorCutsceneModels { - /* 0 */ ACTOR_CS_TEAM_ARWING, - /* 1 */ ACTOR_CS_GREAT_FOX, - /* 10 */ ACTOR_CS_ME_CORNERIA_BG = 10, // Planet Corneria in the background of level start CS. - /* 11 */ ACTOR_CS_FO_EXPLOSION, // Fortuna explosion in a mission complete ending. - /* 20 */ ACTOR_CS_COMMANDER = 20, - /* 24 */ ACTOR_CS_KATT = 24, - /* 25 */ ACTOR_CS_SZ_SPACE_JUNK, - /* 26 */ ACTOR_CS_SZ_INVADER, - /* 28 */ ACTOR_CS_COMMANDER_GLOW = 28, // Commander with Engine Glow. - /* 30 */ ACTOR_CS_30 = 30, // Related to LEVEL_BOLSE - /* 31 */ ACTOR_CS_31, - /* 32 */ ACTOR_CS_32, - /* 33 */ ACTOR_CS_CORNERIAN_FIGHTER, // Bill's ship when actor->index is 3. - /* 34 */ ACTOR_CS_KA_ENEMY, - /* 35 */ ACTOR_CS_SY_SHIP_1_SHRINK, // Scale Matrix by 1/8. - /* 36 */ ACTOR_CS_SY_SHIP_2, - /* 37 */ ACTOR_CS_37, - /* 38 */ ACTOR_CS_38, // Related to Sector Y - /* 39 */ ACTOR_CS_SY_SHIP_1 = 39, - /* 40 */ ACTOR_CS_40, - /* 41 */ ACTOR_CS_AQ_FISHGROUP, - /* 42 */ ACTOR_CS_42, // Related to Sector Y - /* 43 */ ACTOR_CS_43, // Related to Sector Y - /* 44 */ ACTOR_CS_AQ_SEAWEED, - /* 45 */ ACTOR_CS_AQ_BUMP_2, - /* 46 */ ACTOR_CS_AQ_CORAL_REEF_2, - /* 47 */ ACTOR_CS_AQ_ROCK, - /* 1000 */ ACTOR_CS_1000 = 1000 // James? Is that you? + /* 0 */ ACTOR_CS_TEAM_ARWING, + /* 1 */ ACTOR_CS_GREAT_FOX, + /* 10 */ ACTOR_CS_ME_CORNERIA_BG = 10, // Planet Corneria in the background of level start CS. + /* 11 */ ACTOR_CS_FO_EXPLOSION, // Fortuna explosion in a mission complete ending. + /* 20 */ ACTOR_CS_COMMANDER = 20, + /* 24 */ ACTOR_CS_KATT = 24, + /* 25 */ ACTOR_CS_SZ_SPACE_JUNK, + /* 26 */ ACTOR_CS_SZ_INVADER, + /* 28 */ ACTOR_CS_COMMANDER_GLOW = 28, // Commander with Engine Glow. + /* 30 */ ACTOR_CS_30 = 30, // Related to LEVEL_BOLSE + /* 31 */ ACTOR_CS_31, + /* 32 */ ACTOR_CS_32, + /* 33 */ ACTOR_CS_CORNERIAN_FIGHTER, // Bill's ship when actor->index is 3. + /* 34 */ ACTOR_CS_KA_ENEMY, + /* 35 */ ACTOR_CS_SY_SHIP_1_SHRINK, // Scale Matrix by 1/8. + /* 36 */ ACTOR_CS_SY_SHIP_2, + /* 37 */ ACTOR_CS_37, + /* 38 */ ACTOR_CS_SY_ROBOT, + /* 39 */ ACTOR_CS_SY_SHIP_1 = 39, + /* 40 */ ACTOR_CS_40, + /* 41 */ ACTOR_CS_AQ_FISHGROUP, + /* 42 */ ACTOR_CS_42, // Related to Sector Y + /* 43 */ ACTOR_CS_43, // Related to Sector Y + /* 44 */ ACTOR_CS_AQ_SEAWEED, + /* 45 */ ACTOR_CS_AQ_BUMP_2, + /* 46 */ ACTOR_CS_AQ_CORAL_REEF_2, + /* 47 */ ACTOR_CS_AQ_ROCK, + /* 1000 */ ACTOR_CS_JAMES_ARWING = 1000 // James McCloud Arwing seen for the last time in the ending CS. } ActorCutsceneModels; Actor* Game_SpawnActor(ObjectId); diff --git a/include/sf64player.h b/include/sf64player.h index 71f28f91..00651a0c 100644 --- a/include/sf64player.h +++ b/include/sf64player.h @@ -65,23 +65,23 @@ typedef enum LevelMode { /* 3 */ LEVELMODE_MAX, } LevelMode; -typedef enum PlayerState1C8 { - /* 0 */ PLAYERSTATE_1C8_STANDBY, - /* 1 */ PLAYERSTATE_1C8_INIT, - /* 2 */ PLAYERSTATE_1C8_LEVEL_INTRO, - /* 3 */ PLAYERSTATE_1C8_ACTIVE, - /* 4 */ PLAYERSTATE_1C8_DOWN, - /* 5 */ PLAYERSTATE_1C8_U_TURN, - /* 6 */ PLAYERSTATE_1C8_NEXT, - /* 7 */ PLAYERSTATE_1C8_LEVEL_COMPLETE, - /* 8 */ PLAYERSTATE_1C8_ENTER_WARP_ZONE, - /* 9 */ PLAYERSTATE_1C8_START_360, - /* 10 */ PLAYERSTATE_1C8_GFOX_REPAIR, - /* 11 */ PLAYERSTATE_1C8_ANDROSS_MOUTH, - /* 12 */ PLAYERSTATE_1C8_12, - /* 13 */ PLAYERSTATE_1C8_VS_STANDBY, - /* 14 */ PLAYERSTATE_1C8_MAX, -} PlayerState1C8; +typedef enum PlayerState { + /* 0 */ PLAYERSTATE_STANDBY, + /* 1 */ PLAYERSTATE_INIT, + /* 2 */ PLAYERSTATE_LEVEL_INTRO, + /* 3 */ PLAYERSTATE_ACTIVE, + /* 4 */ PLAYERSTATE_DOWN, + /* 5 */ PLAYERSTATE_U_TURN, + /* 6 */ PLAYERSTATE_NEXT, + /* 7 */ PLAYERSTATE_LEVEL_COMPLETE, + /* 8 */ PLAYERSTATE_ENTER_WARP_ZONE, + /* 9 */ PLAYERSTATE_START_360, + /* 10 */ PLAYERSTATE_GFOX_REPAIR, + /* 11 */ PLAYERSTATE_ANDROSS_MOUTH, + /* 12 */ PLAYERSTATE_UNK_12, + /* 13 */ PLAYERSTATE_VS_STANDBY, + /* 14 */ PLAYERSTATE_MAX, +} PlayerState; typedef enum PlayerShotStatus { /* 0 */ SHOT_FREE, @@ -259,7 +259,7 @@ typedef struct Player { /* 0x1BC */ s32 turretRecoil; /* 0x1C0 */ s32 turretLockOnCount; /* 0x1C4 */ s32 num; - /* 0x1C8 */ PlayerState1C8 state_1C8; + /* 0x1C8 */ PlayerState state; /* 0x1CC */ PlayerForm form; /* 0x1D0 */ s32 csState; /* 0x1D4 */ bool grounded; diff --git a/include/sf64save.h b/include/sf64save.h index b57f17d5..e3ae8bf2 100644 --- a/include/sf64save.h +++ b/include/sf64save.h @@ -24,11 +24,15 @@ typedef struct { typedef struct PlanetStats { /* bit 0 */ u16 hitCount : 8; /* bit 8 */ u16 planetId : 4; - /* bit C */ u16 unk_C : 1; // hitCount related + /* bit C */ u16 hitCountOver256 : 1; /* bit D */ u16 peppyAlive : 1; /* bit E */ u16 falcoAlive : 1; /* bit F */ u16 slippyAlive : 1; -} PlanetStats; // size = 0x10 +} PlanetStats; // size = 0x2 + +#define PLANET_STATS(hitCount, planetId, peppyAlive, falcoAlive, slippyAlive) \ + (hitCount > 255 ? hitCount - 256 : hitCount), \ + ((planetId << 4) | ((hitCount > 255 ? 1 : 0) << 3) | (peppyAlive << 2) | (falcoAlive << 1) | (slippyAlive)) typedef struct SaveData { /* 0x00 */ PlanetData planet[16]; @@ -38,13 +42,14 @@ typedef struct SaveData { /* 0x16 */ u8 voiceVolume; /* 0x17 */ u8 sfxVolume; /* 0x18 */ u8 rankNameEntry[RANKING_MAX][ENTRY_MAX]; // Name entries in the ranking - /* 0x36 */ u8 rankingRoute[RANKING_MAX]; // Maximum number of planets played in the current record - /* 0x40 */ u8 rankingLives[RANKING_MAX]; // Player lives left in the current record - /* 0x4A */ u16 rankingMedal[RANKING_MAX]; // Medals obtained in the current record + /* 0x36 */ u8 rankingRoute[RANKING_MAX]; // Maximum number of planets played in the current record + /* 0x40 */ u8 rankingLives[RANKING_MAX]; // Player lives left in the current record + /* 0x4A */ u16 rankingMedal[RANKING_MAX]; // Medals obtained in the current record /* 0x5E */ PlanetStats stats[RANKING_MAX][ROUTE_MAX]; /* 0xEA */ u8 unk_EA; - /* 0xEB */ char padEB[0x3]; - /* 0xEE */ char padEE[0x10]; + /* 0xEB */ u8 textLanguage; // EU Only text language selection + /* 0xEC */ u8 voiceLanguage; // EU Only voice language selection + /* 0xED */ char padEE[0x11]; } SaveData; // size = 0xFE typedef struct { diff --git a/include/variables.h b/include/variables.h index 3248eaeb..b1accc52 100644 --- a/include/variables.h +++ b/include/variables.h @@ -155,7 +155,7 @@ extern s32 gCallTimer; extern s32 D_hud_80161704; extern s32 D_hud_80161708; extern s32 D_hud_8016170C; -extern s32 D_hud_80161710; +extern s32 gRadarMissileAlarmTimer; extern s32 gTotalHits; // 0x80161714 gTotalGameScore extern f32 D_hud_80161720[3]; extern s32 gDisplayedHitCount; diff --git a/linker_scripts/jp/rev0/symbol_addrs_overlays.txt b/linker_scripts/jp/rev0/symbol_addrs_overlays.txt new file mode 100644 index 00000000..8a7a4c47 --- /dev/null +++ b/linker_scripts/jp/rev0/symbol_addrs_overlays.txt @@ -0,0 +1 @@ +OvlI1_CallFunction = 0x8017E7A0;//segment:ovl_i1 \ No newline at end of file diff --git a/src/audio/audio_effects.c b/src/audio/audio_effects.c index 709c311c..6bf31e64 100644 --- a/src/audio/audio_effects.c +++ b/src/audio/audio_effects.c @@ -64,7 +64,7 @@ void Audio_SequencePlayerProcessSound(SequencePlayer* seqplayer) { if (seqplayer->recalculateVolume) { seqplayer->appliedFadeVolume = seqplayer->fadeVolume * seqplayer->fadeVolumeMod; } - for (i = 0; i < 16; i++) { + for (i = 0; i < SEQ_NUM_CHANNELS; i++) { if ((IS_SEQUENCE_CHANNEL_VALID(seqplayer->channels[i]) == 1) && (seqplayer->channels[i]->enabled == 1)) { Audio_SequenceChannelProcessSound(seqplayer->channels[i], seqplayer->recalculateVolume); } @@ -216,7 +216,8 @@ f32 Audio_AdsrUpdate(AdsrState* adsr) { break; default: if (adsr->delay >= 4) { - adsr->delay = (adsr->delay * gAudioBufferParams.ticksPerUpdate / gAudioBufferParams.numBuffers) / 4; + adsr->delay = + (adsr->delay * gAudioBufferParams.ticksPerUpdate / gAudioBufferParams.numBuffers) / 4; } if (adsr->delay == 0) { adsr->delay = 1; diff --git a/src/audio/audio_general.c b/src/audio/audio_general.c index c513e38b..bc2beb18 100644 --- a/src/audio/audio_general.c +++ b/src/audio/audio_general.c @@ -2688,8 +2688,8 @@ void Audio_PlaySequenceDistorted(u8 seqPlayId, u16 seqId, u16 distortion, u8 fad } void Audio_PlaySoundTestTrack(u8 trackNumber) { - u16 sp26; - u8 sp25; + u16 seqId; + u8 bgmParam; if ((trackNumber >= 45) && (trackNumber < 50)) { SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 1); @@ -2701,10 +2701,10 @@ void Audio_PlaySoundTestTrack(u8 trackNumber) { AUDIO_PLAY_SFX(NA_SE_ERROR, gDefaultSfxSource, 4); } else { sPlaylistIndex = 0xFF; - sp26 = sSoundTestTracks[trackNumber].seqId & 0xFF; - sp25 = sSoundTestTracks[trackNumber].bgmParam; + seqId = sSoundTestTracks[trackNumber].seqId & 0xFF; + bgmParam = sSoundTestTracks[trackNumber].bgmParam; SEQCMD_STOP_SEQUENCE(D_800C5E70 ^ 1, 5); - Audio_PlaySequence(D_800C5E70, sp26, 0, sp25); + Audio_PlaySequence(D_800C5E70, seqId, 0, bgmParam); D_800C5E70 ^= 1; } } diff --git a/src/audio/audio_heap.c b/src/audio/audio_heap.c index 1605e680..dbc37c57 100644 --- a/src/audio/audio_heap.c +++ b/src/audio/audio_heap.c @@ -99,8 +99,8 @@ void AudioHeap_DiscardFont(s32 fontId) { note->playbackState.parentLayer->enabled = false; note->playbackState.parentLayer->finished = true; } - func_80011F4C(note); - func_80012C40(note); + Audio_NoteDisable(note); + Audio_AudioListRemove(note); AudioSeq_AudioListPushBack(&gNoteFreeLists.disabled, ¬e->listItem); } } @@ -663,7 +663,6 @@ void AudioHeap_Init(void) { gAudioBufferParams.maxAiBufferLength *= gAudioBufferParams.numBuffers; gAudioBufferParams.minAiBufferLength *= gAudioBufferParams.numBuffers; gAudioBufferParams.ticksPerUpdate *= gAudioBufferParams.numBuffers; - if (gAudioBufferParams.numBuffers >= 2) { gAudioBufferParams.maxAiBufferLength -= 0x10; } @@ -700,10 +699,8 @@ void AudioHeap_Init(void) { AudioHeap_ResetLoadStatus(); gNotes = AudioHeap_AllocZeroed(&gMiscPool, gNumNotes * sizeof(Note)); - - func_800132E8(); - func_800128B4(); - + Audio_NoteInitAll(); + Audio_InitNoteFreeList(); gNoteSubsEu = AudioHeap_AllocZeroed(&gMiscPool, gAudioBufferParams.ticksPerUpdate * gNumNotes * sizeof(NoteSubEu)); for (i = 0; i != 2; i++) { diff --git a/src/audio/audio_load.c b/src/audio/audio_load.c index e8262122..caca54de 100644 --- a/src/audio/audio_load.c +++ b/src/audio/audio_load.c @@ -135,8 +135,8 @@ void* AudioLoad_DmaSampleData(uintptr_t devAddr, u32 size, u32 arg2, u8* dmaInde dma->ttl = 2; dma->devAddr = dmaDevAddr; dma->sizeUnused = dma->size; - AudioLoad_Dma(&gCurAudioFrameDmaIoMsgBuf[gCurAudioFrameDmaCount++], 0, 0, dmaDevAddr, dma->ramAddr, dma->size, - &gCurAudioFrameDmaQueue, medium, "SUPERDMA"); + AudioLoad_Dma(&gCurAudioFrameDmaIoMsgBuf[gCurAudioFrameDmaCount++], OS_MESG_PRI_NORMAL, OS_READ, dmaDevAddr, + dma->ramAddr, dma->size, &gCurAudioFrameDmaQueue, medium, "SUPERDMA"); *dmaIndexRef = sp38; return devAddr - dmaDevAddr + dma->ramAddr; } @@ -220,7 +220,7 @@ void AudioLoad_InitSampleDmaBuffers(s32 numNotes) { gSampleDmaReuseQueue2WrPos = gSampleDmaCount - gSampleDmaListSize1; } -// Updates the audiotable entries with their absolute ROM addresses +// Updates the audiotable entries with their relative ROM addresses void AudioLoad_InitTable(AudioTable* table, u8* romAddr, u16 unkMediumParam) { s32 i; @@ -634,7 +634,8 @@ void AudioLoad_SyncDma(uintptr_t devAddr, u8* ramAddr, u32 size, s32 medium) { } if (size != 0) { - AudioLoad_Dma(&gSyncDmaIoMsg, 1, 0, devAddr, ramAddr, size, &gSyncDmaQueue, medium, "FastCopy"); + AudioLoad_Dma(&gSyncDmaIoMsg, OS_MESG_PRI_HIGH, OS_READ, devAddr, ramAddr, size, &gSyncDmaQueue, medium, + "FastCopy"); MQ_WAIT_FOR_MESG(&gSyncDmaQueue, NULL); } } diff --git a/src/audio/audio_playback.c b/src/audio/audio_playback.c index 6f9ef7a2..bd41160c 100644 --- a/src/audio/audio_playback.c +++ b/src/audio/audio_playback.c @@ -34,13 +34,13 @@ static const char devstr25[] = "Intterupt UseStop %d (Kill %d)\n"; static const char devstr26[] = "Intterupt RelWait %d (Kill %d)\n"; static const char devstr27[] = "Drop Voice (Prio %x)\n"; -void func_80011C58(Note* note, f32); -void func_8001268C(SequenceLayer* layer); -void func_80012C00(AudioListItem* item1, AudioListItem* item2); -void func_80012C40(Note* note); -void func_80012CEC(Note* note, SequenceLayer* layer); +void Audio_NoteSetResamplingRate(Note* note, f32); +void Audio_SeqLayerNoteRelease(SequenceLayer* layer); +void Audio_AudioListPushFront(AudioListItem* list, AudioListItem* item); +void Audio_AudioListRemove(Note* note); +void Audio_NoteInitForLayer(Note* note, SequenceLayer* layer); -void func_80011890(Note* note, NoteAttributes* noteAttr) { +void Audio_InitNoteSub(Note* note, NoteAttributes* noteAttr) { NoteSubEu* noteSub; f32 panVolumeLeft; f32 pamVolumeRight; @@ -53,7 +53,7 @@ void func_80011890(Note* note, NoteAttributes* noteAttr) { u8 reverb; Stereo stereo; - func_80011C58(note, noteAttr->freqMod); + Audio_NoteSetResamplingRate(note, noteAttr->freqMod); noteSub = ¬e->noteSubEu; velocity = noteAttr->velocity; pan = noteAttr->pan; @@ -134,34 +134,30 @@ void func_80011890(Note* note, NoteAttributes* noteAttr) { } } -void func_80011C58(Note* note, f32 arg1) { +void Audio_NoteSetResamplingRate(Note* note, f32 resamplingRateInput) { NoteSubEu* noteSub = ¬e->noteSubEu; - f32 var_fv0; + f32 resamplingRate; - if (arg1 < 2.0f) { - noteSub->bitField1.hasTwoParts = 0; - if (arg1 > 1.99998f) { - var_fv0 = 1.99998f; - } else { - var_fv0 = arg1; - } + if (resamplingRateInput < 2.0f) { + noteSub->bitField1.hasTwoParts = false; + resamplingRate = CLAMP_MAX(resamplingRateInput, 1.99998f); } else { - noteSub->bitField1.hasTwoParts = 1; - if (arg1 > 3.99996f) { - var_fv0 = 1.99998f; + noteSub->bitField1.hasTwoParts = true; + if (resamplingRateInput > 3.99996f) { + resamplingRate = 1.99998f; } else { - var_fv0 = arg1 * 0.5f; + resamplingRate = resamplingRateInput * 0.5f; } } - note->noteSubEu.resampleRate = (s32) (var_fv0 * 32768.0f); + note->noteSubEu.resampleRate = (s32) (resamplingRate * 32768.0f); } -TunedSample* Audio_GetInstrumentTunedSample(Instrument* instrument, s32 arg1) { +TunedSample* Audio_GetInstrumentTunedSample(Instrument* instrument, s32 semitone) { TunedSample* sample; - if (arg1 < instrument->normalRangeLo) { + if (semitone < instrument->normalRangeLo) { sample = &instrument->lowPitchTunedSample; - } else if (arg1 <= instrument->normalRangeHi) { + } else if (semitone <= instrument->normalRangeHi) { sample = &instrument->normalPitchTunedSample; } else { sample = &instrument->highPitchTunedSample; @@ -220,29 +216,29 @@ Drum* Audio_GetDrum(s32 fontId, s32 drumId) { return drum; } -void func_80011EB8(Note* note) { +void Audio_NoteInit(Note* note) { if (note->playbackState.parentLayer->adsr.decayIndex == 0) { Audio_AdsrInit(¬e->playbackState.adsr, note->playbackState.parentLayer->channel->adsr.envelope, - ¬e->playbackState.adsrVolModUnused); + ¬e->playbackState.adsrVolModUnused); } else { Audio_AdsrInit(¬e->playbackState.adsr, note->playbackState.parentLayer->adsr.envelope, - ¬e->playbackState.adsrVolModUnused); + ¬e->playbackState.adsrVolModUnused); } - note->playbackState.adsr.state = 1; + note->playbackState.adsr.state = ADSR_STATE_INITIAL; note->noteSubEu = gDefaultNoteSub; } -void func_80011F4C(Note* note) { - if (note->noteSubEu.bitField0.needsInit == 1) { - note->noteSubEu.bitField0.needsInit = 0; +void Audio_NoteDisable(Note* note) { + if (note->noteSubEu.bitField0.needsInit == true) { + note->noteSubEu.bitField0.needsInit = false; } note->playbackState.priority = 0; + note->noteSubEu.bitField0.enabled = false; note->playbackState.unk_04 = 0; - note->noteSubEu.bitField0.enabled = 0; note->playbackState.parentLayer = NO_LAYER; note->playbackState.prevParentLayer = NO_LAYER; note->noteSubEu.bitField0.finished = 0; - note->playbackState.adsr.state = 0; + note->playbackState.adsr.state = ADSR_STATE_DISABLED; note->playbackState.adsr.current = 0.0f; } @@ -256,7 +252,7 @@ void Audio_ProcessNotes(void) { s32 i; NoteAttributes sp70; u8 bookOffset; - f32 temp_fs0; + f32 scale; for (i = 0; i < gNumNotes; i++) { note = &gNotes[i]; @@ -268,7 +264,7 @@ void Audio_ProcessNotes(void) { playbackState->adsr.fadeOutVel = gAudioBufferParams.ticksPerUpdateInv; playbackState->priority = 1; playbackState->unk_04 = 2; - goto block_21; + goto out; } else { if ((playbackState->parentLayer->enabled) || (playbackState->unk_04 != 0) || (playbackState->priority <= 0)) { @@ -279,55 +275,55 @@ void Audio_ProcessNotes(void) { continue; } if (!(playbackState->parentLayer->channel->seqPlayer->muted && - (playbackState->parentLayer->channel->muteBehavior & 0x40))) { - goto block_21; + (playbackState->parentLayer->channel->muteBehavior & MUTE_BEHAVIOR_STOP_NOTES))) { + goto out; } } - func_8001268C(playbackState->parentLayer); - func_80012C40(note); - func_80012C00(¬e->listItem.pool->decaying, ¬e->listItem); + Audio_SeqLayerNoteRelease(playbackState->parentLayer); + Audio_AudioListRemove(note); + Audio_AudioListPushFront(¬e->listItem.pool->decaying, ¬e->listItem); playbackState->priority = 1; playbackState->unk_04 = 2; } } else if ((playbackState->unk_04 == 0) && (playbackState->priority > 0)) { continue; } - block_21: + out: if (playbackState->priority != 0) { noteSub = ¬e->noteSubEu; if ((playbackState->unk_04 > 0) || noteSub->bitField0.finished) { if ((playbackState->adsr.state == 0) || noteSub->bitField0.finished) { if (playbackState->wantedParentLayer != NO_LAYER) { - func_80011F4C(note); + Audio_NoteDisable(note); if (playbackState->wantedParentLayer->channel != NULL) { - func_80012CEC(note, playbackState->wantedParentLayer); + Audio_NoteInitForLayer(note, playbackState->wantedParentLayer); Audio_NoteVibratoInit(note); - func_80012C40(note); + Audio_AudioListRemove(note); AudioSeq_AudioListPushBack(¬e->listItem.pool->active, ¬e->listItem); playbackState->wantedParentLayer = NO_LAYER; } else { - func_80011F4C(note); - func_80012C40(note); + Audio_NoteDisable(note); + Audio_AudioListRemove(note); AudioSeq_AudioListPushBack(¬e->listItem.pool->disabled, ¬e->listItem); playbackState->wantedParentLayer = NO_LAYER; goto next; } } else { - func_80011F4C(note); - func_80012C40(note); + Audio_NoteDisable(note); + Audio_AudioListRemove(note); AudioSeq_AudioListPushBack(¬e->listItem.pool->disabled, ¬e->listItem); goto next; } } } else if (playbackState->adsr.state == 0) { - func_80011F4C(note); - func_80012C40(note); + Audio_NoteDisable(note); + Audio_AudioListRemove(note); AudioSeq_AudioListPushBack(¬e->listItem.pool->disabled, ¬e->listItem); goto next; } - temp_fs0 = Audio_AdsrUpdate(&playbackState->adsr); + scale = Audio_AdsrUpdate(&playbackState->adsr); Audio_NoteVibratoUpdate(note); attr = &playbackState->attributes; if ((playbackState->unk_04 == 1) || (playbackState->unk_04 == 2)) { @@ -355,15 +351,15 @@ void Audio_ProcessNotes(void) { } sp70.freqMod *= playbackState->vibratoFreqMod * playbackState->portamentoFreqMod; sp70.freqMod *= gAudioBufferParams.resampleRate; - sp70.velocity *= temp_fs0; - func_80011890(note, &sp70); + sp70.velocity *= scale; + Audio_InitNoteSub(note, &sp70); noteSub->bitField1.bookOffset = bookOffset; next:; } } } -void func_80012438(SequenceLayer* layer, s32 arg1) { +void Audio_SeqLayerDecayRelease(SequenceLayer* layer, s32 arg1) { Note* note; NoteAttributes* noteAttr; @@ -423,21 +419,21 @@ void func_80012438(SequenceLayer* layer, s32 arg1) { } } if (arg1 == 6) { - func_80012C40(note); - func_80012C00(¬e->listItem.pool->decaying, ¬e->listItem); + Audio_AudioListRemove(note); + Audio_AudioListPushFront(¬e->listItem.pool->decaying, ¬e->listItem); } } } void Audio_SeqLayerNoteDecay(SequenceLayer* layer) { - func_80012438(layer, 6); + Audio_SeqLayerDecayRelease(layer, ADSR_STATE_DECAY); } -void func_8001268C(SequenceLayer* layer) { - func_80012438(layer, 7); +void Audio_SeqLayerNoteRelease(SequenceLayer* layer) { + Audio_SeqLayerDecayRelease(layer, ADSR_STATE_RELEASE); } -s32 func_800126AC(Note* note, SequenceLayer* layer, s32 waveId) { +s32 Audio_BuildSyntheticWave(Note* note, SequenceLayer* layer, s32 waveId) { f32 freqMod; u8 harmonicIndex = 0; @@ -478,28 +474,28 @@ void Audio_InitSyntheticWave(Note* note, SequenceLayer* layer) { } harmonicIndex = note->playbackState.harmonicIndex; note->synthesisState.samplePosInt = - (note->synthesisState.samplePosInt * sSamplesPerWavePeriod[func_800126AC(note, layer, waveId)]) / + (note->synthesisState.samplePosInt * sSamplesPerWavePeriod[Audio_BuildSyntheticWave(note, layer, waveId)]) / sSamplesPerWavePeriod[harmonicIndex]; } -void func_80012854(AudioListItem* item) { +void Audio_InitNoteList(AudioListItem* item) { item->prev = item; item->next = item; item->u.value = NULL; } void Audio_InitNoteLists(NotePool* pool) { - func_80012854(&pool->disabled); - func_80012854(&pool->decaying); - func_80012854(&pool->releasing); - func_80012854(&pool->active); + Audio_InitNoteList(&pool->disabled); + Audio_InitNoteList(&pool->decaying); + Audio_InitNoteList(&pool->releasing); + Audio_InitNoteList(&pool->active); pool->disabled.pool = pool; pool->decaying.pool = pool; pool->releasing.pool = pool; pool->active.pool = pool; } -void func_800128B4(void) { +void Audio_InitNoteFreeList(void) { s32 i; Audio_InitNoteLists(&gNoteFreeLists); @@ -541,23 +537,22 @@ void Audio_NotePoolClear(NotePool* pool) { if ((nextPoolItem == poolItem) || (nextPoolItem == NULL)) { break; } - func_80012C40((Note*) nextPoolItem); + Audio_AudioListRemove((Note*) nextPoolItem); AudioSeq_AudioListPushBack(freeList, nextPoolItem); } } } -void Audio_NotePoolFill(NotePool* pool, s32 arg1) { - s32 var_s0; +void Audio_NotePoolFill(NotePool* pool, s32 count) { + s32 j; s32 poolType; AudioListItem* note; AudioListItem* freeList; AudioListItem* poolList; Audio_NotePoolClear(pool); - poolType = 0; - var_s0 = 0; - while (var_s0 < arg1) { + + for (poolType = 0, j = 0; j < count; poolType++) { if (poolType == 4) { return; } @@ -579,30 +574,31 @@ void Audio_NotePoolFill(NotePool* pool, s32 arg1) { poolList = &pool->active; break; } - while (var_s0 < arg1) { + while (j < count) { note = AudioSeq_AudioListPopBack(freeList); if (note == NULL) { break; } AudioSeq_AudioListPushBack(poolList, note); - var_s0++; + j++; } - poolType++; } } -void func_80012C00(AudioListItem* item1, AudioListItem* item2) { - if (item2->prev == NULL) { - item2->prev = item1; - item2->next = item1->next; - item1->next->prev = item2; - item1->next = item2; - item1->u.count++; - item2->pool = item1->pool; +void Audio_AudioListPushFront(AudioListItem* list, AudioListItem* item) { + // add 'item' to the front of the list given by 'list', if it's not in any list + if (item->prev == NULL) { + item->prev = list; + item->next = list->next; + list->next->prev = item; + list->next = item; + list->u.count++; + item->pool = list->pool; } } -void func_80012C40(Note* note) { +void Audio_AudioListRemove(Note* note) { + // remove 'item' from the list it's in, if any if (note->listItem.prev != NULL) { note->listItem.prev->next = note->listItem.next; note->listItem.next->prev = note->listItem.prev; @@ -610,7 +606,7 @@ void func_80012C40(Note* note) { } } -Note* func_80012C6C(AudioListItem* item, s32 priority) { +Note* Audio_FindNodeWithPrioLessThan(AudioListItem* item, s32 priority) { AudioListItem* priorityItem; AudioListItem* nextItem = item->next; @@ -635,7 +631,7 @@ Note* func_80012C6C(AudioListItem* item, s32 priority) { return (Note*) priorityItem->u.value; } -void func_80012CEC(Note* note, SequenceLayer* layer) { +void Audio_NoteInitForLayer(Note* note, SequenceLayer* layer) { s32 pad[4]; s32 var_a2; NoteSubEu* noteSub; @@ -649,7 +645,7 @@ void func_80012CEC(Note* note, SequenceLayer* layer) { layer->channel->noteUnused = note; layer->channel->layerUnused = layer; layer->noteVelocity = 0.0f; - func_80011EB8(note); + Audio_NoteInit(note); var_a2 = layer->instOrWave; noteSub = ¬e->noteSubEu; if (var_a2 == 0xFF) { @@ -662,7 +658,7 @@ void func_80012CEC(Note* note, SequenceLayer* layer) { noteSub->bitField1.isSyntheticWave = false; } if (noteSub->bitField1.isSyntheticWave) { - func_800126AC(note, layer, var_a2); + Audio_BuildSyntheticWave(note, layer, var_a2); } note->playbackState.fontId = layer->channel->fontId; noteSub->bitField0.stereoHeadsetEffects = layer->channel->stereoHeadsetEffects; @@ -670,122 +666,126 @@ void func_80012CEC(Note* note, SequenceLayer* layer) { } void func_80012E28(Note* note, SequenceLayer* layer) { - func_8001268C(note->playbackState.parentLayer); + Audio_SeqLayerNoteRelease(note->playbackState.parentLayer); note->playbackState.wantedParentLayer = layer; } -void func_80012E5C(Note* note, SequenceLayer* layer) { +void Audio_NoteReleaseAndTakeOwnership(Note* note, SequenceLayer* layer) { note->playbackState.wantedParentLayer = layer; note->playbackState.priority = layer->channel->notePriority; note->playbackState.adsr.fadeOutVel = gAudioBufferParams.ticksPerUpdateInv; note->playbackState.adsr.action.asByte |= 0x10; } -Note* func_80012E88(NotePool* pool, SequenceLayer* layer) { +Note* Audio_AllocNoteFromDisabled(NotePool* pool, SequenceLayer* layer) { Note* note = AudioSeq_AudioListPopBack(&pool->disabled); if (note != NULL) { - func_80012CEC(note, layer); - func_80012C00(&pool->active, ¬e->listItem); + Audio_NoteInitForLayer(note, layer); + Audio_AudioListPushFront(&pool->active, ¬e->listItem); } return note; } -Note* func_80012ED4(NotePool* pool, SequenceLayer* layer) { +Note* Audio_AllocNoteFromDecaying(NotePool* pool, SequenceLayer* layer) { Note* note = AudioSeq_AudioListPopBack(&pool->decaying); if (note != NULL) { - func_80012E5C(note, layer); + Audio_NoteReleaseAndTakeOwnership(note, layer); AudioSeq_AudioListPushBack(&pool->releasing, ¬e->listItem); } return note; } -Note* func_80012F24(NotePool* pool, SequenceLayer* layer) { - Note* sp34; - Note* sp30; - s32 sp2C; - s32 sp28; +Note* Audio_AllocNoteFromActive(NotePool* pool, SequenceLayer* layer) { + Note* rNote; + Note* aNote; + s32 rPriority; + s32 aPriority; - sp2C = sp28 = 0x10; - sp34 = func_80012C6C(&pool->releasing, layer->channel->notePriority); - if (sp34 != NULL) { - sp2C = sp34->playbackState.priority; + rPriority = aPriority = 0x10; + rNote = Audio_FindNodeWithPrioLessThan(&pool->releasing, layer->channel->notePriority); + + if (rNote != NULL) { + rPriority = rNote->playbackState.priority; } - sp30 = func_80012C6C(&pool->active, layer->channel->notePriority); - if (sp30 != NULL) { - sp28 = sp30->playbackState.priority; + + aNote = Audio_FindNodeWithPrioLessThan(&pool->active, layer->channel->notePriority); + + if (aNote != NULL) { + aPriority = aNote->playbackState.priority; } - if ((sp34 == NULL) && (sp30 == NULL)) { + + if (rNote == NULL && aNote == NULL) { return NULL; } - if (sp28 < sp2C) { - func_80012C40(sp30); - func_80012E28(sp30, layer); - AudioSeq_AudioListPushBack(&pool->releasing, &sp30->listItem); - sp30->playbackState.priority = layer->channel->notePriority; - return sp30; - } else { - sp34->playbackState.wantedParentLayer = layer; - sp34->playbackState.priority = layer->channel->notePriority; - return sp34; + + if (aPriority < rPriority) { + Audio_AudioListRemove(aNote); + func_80012E28(aNote, layer); + AudioSeq_AudioListPushBack(&pool->releasing, &aNote->listItem); + aNote->playbackState.priority = layer->channel->notePriority; + return aNote; } + rNote->playbackState.wantedParentLayer = layer; + rNote->playbackState.priority = layer->channel->notePriority; + return rNote; } Note* Audio_AllocNote(SequenceLayer* layer) { - Note* sp24; + Note* note; if (layer->channel->noteAllocPolicy & 1) { - sp24 = layer->note; - if ((sp24 != NULL) && (layer == sp24->playbackState.prevParentLayer) && - (sp24->playbackState.wantedParentLayer == NO_LAYER)) { + note = layer->note; + if ((note != NULL) && (layer == note->playbackState.prevParentLayer) && + (note->playbackState.wantedParentLayer == NO_LAYER)) { - func_80012E5C(sp24, layer); - func_80012C40(sp24); - AudioSeq_AudioListPushBack(&sp24->listItem.pool->releasing, &sp24->listItem); - return sp24; + Audio_NoteReleaseAndTakeOwnership(note, layer); + Audio_AudioListRemove(note); + AudioSeq_AudioListPushBack(¬e->listItem.pool->releasing, ¬e->listItem); + return note; } } if (layer->channel->noteAllocPolicy & 2) { - if (((sp24 = func_80012E88(&layer->channel->notePool, layer)) != NULL) || - ((sp24 = func_80012ED4(&layer->channel->notePool, layer)) != NULL) || - ((sp24 = func_80012F24(&layer->channel->notePool, layer)) != NULL)) { - return sp24; + if (((note = Audio_AllocNoteFromDisabled(&layer->channel->notePool, layer)) != NULL) || + ((note = Audio_AllocNoteFromDecaying(&layer->channel->notePool, layer)) != NULL) || + ((note = Audio_AllocNoteFromActive(&layer->channel->notePool, layer)) != NULL)) { + return note; } } else if (layer->channel->noteAllocPolicy & 4) { - if (((sp24 = func_80012E88(&layer->channel->notePool, layer)) != NULL) || - ((sp24 = func_80012E88(&layer->channel->seqPlayer->notePool, layer)) != NULL) || - ((sp24 = func_80012ED4(&layer->channel->notePool, layer)) != NULL) || - ((sp24 = func_80012ED4(&layer->channel->seqPlayer->notePool, layer)) != NULL) || - ((sp24 = func_80012F24(&layer->channel->notePool, layer)) != NULL) || - ((sp24 = func_80012F24(&layer->channel->seqPlayer->notePool, layer)) != NULL)) { - return sp24; + if (((note = Audio_AllocNoteFromDisabled(&layer->channel->notePool, layer)) != NULL) || + ((note = Audio_AllocNoteFromDisabled(&layer->channel->seqPlayer->notePool, layer)) != NULL) || + ((note = Audio_AllocNoteFromDecaying(&layer->channel->notePool, layer)) != NULL) || + ((note = Audio_AllocNoteFromDecaying(&layer->channel->seqPlayer->notePool, layer)) != NULL) || + ((note = Audio_AllocNoteFromActive(&layer->channel->notePool, layer)) != NULL) || + ((note = Audio_AllocNoteFromActive(&layer->channel->seqPlayer->notePool, layer)) != NULL)) { + return note; } } else if (layer->channel->noteAllocPolicy & 8) { - if (((sp24 = func_80012E88(&gNoteFreeLists, layer)) != NULL) || - ((sp24 = func_80012ED4(&gNoteFreeLists, layer)) != NULL) || - ((sp24 = func_80012F24(&gNoteFreeLists, layer)) != NULL)) { - return sp24; + if (((note = Audio_AllocNoteFromDisabled(&gNoteFreeLists, layer)) != NULL) || + ((note = Audio_AllocNoteFromDecaying(&gNoteFreeLists, layer)) != NULL) || + ((note = Audio_AllocNoteFromActive(&gNoteFreeLists, layer)) != NULL)) { + return note; } } else { - if (((sp24 = func_80012E88(&layer->channel->notePool, layer)) != NULL) || - ((sp24 = func_80012E88(&layer->channel->seqPlayer->notePool, layer)) != NULL) || - ((sp24 = func_80012E88(&gNoteFreeLists, layer)) != NULL) || - ((sp24 = func_80012ED4(&layer->channel->notePool, layer)) != NULL) || - ((sp24 = func_80012ED4(&layer->channel->seqPlayer->notePool, layer)) != NULL) || - ((sp24 = func_80012ED4(&gNoteFreeLists, layer)) != NULL) || - ((sp24 = func_80012F24(&layer->channel->notePool, layer)) != NULL) || - ((sp24 = func_80012F24(&layer->channel->seqPlayer->notePool, layer)) != NULL) || - ((sp24 = func_80012F24(&gNoteFreeLists, layer)) != NULL)) { - return sp24; + if (((note = Audio_AllocNoteFromDisabled(&layer->channel->notePool, layer)) != NULL) || + ((note = Audio_AllocNoteFromDisabled(&layer->channel->seqPlayer->notePool, layer)) != NULL) || + ((note = Audio_AllocNoteFromDisabled(&gNoteFreeLists, layer)) != NULL) || + ((note = Audio_AllocNoteFromDecaying(&layer->channel->notePool, layer)) != NULL) || + ((note = Audio_AllocNoteFromDecaying(&layer->channel->seqPlayer->notePool, layer)) != NULL) || + ((note = Audio_AllocNoteFromDecaying(&gNoteFreeLists, layer)) != NULL) || + ((note = Audio_AllocNoteFromActive(&layer->channel->notePool, layer)) != NULL) || + ((note = Audio_AllocNoteFromActive(&layer->channel->seqPlayer->notePool, layer)) != NULL) || + ((note = Audio_AllocNoteFromActive(&gNoteFreeLists, layer)) != NULL)) { + return note; } } layer->unk_3 = 0; return NULL; } -void func_800132E8(void) { +void Audio_NoteInitAll(void) { s32 i; Note* note; diff --git a/src/audio/audio_seqplayer.c b/src/audio/audio_seqplayer.c index 5e60cd9b..b49e7041 100644 --- a/src/audio/audio_seqplayer.c +++ b/src/audio/audio_seqplayer.c @@ -48,7 +48,7 @@ static const char devstr30[] = "Group:Undefined Command\n"; void AudioSeq_AudioListPushBack(AudioListItem* list, AudioListItem* item); void* AudioSeq_AudioListPopBack(AudioListItem* list); -u8 AudioSeq_GetInstrument(SequenceChannel* channel, u8 arg1, Instrument** instrument, AdsrSettings* adsrSettings); +u8 AudioSeq_GetInstrument(SequenceChannel* channel, u8 instId, Instrument** instrumentOut, AdsrSettings* adsrSettings); void AudioSeq_InitSequenceChannel(SequenceChannel* channel) { s32 i; @@ -144,16 +144,13 @@ void AudioSeq_SeqLayerDisable(SequenceLayer* layer) { } } -void AudioSeq_SeqLayerFree(SequenceChannel* channel, s32 layerIndex) -{ - if (layerIndex < 4) { - SequenceLayer* layer = channel->layers[layerIndex]; +void AudioSeq_SeqLayerFree(SequenceChannel* channel, s32 layerIndex) { + SequenceLayer* layer = channel->layers[layerIndex]; - if (layer != NULL) { - AudioSeq_AudioListPushBack(&gLayerFreeList, &layer->listItem); - AudioSeq_SeqLayerDisable(layer); - channel->layers[layerIndex] = NULL; - } + if (layer != NULL) { + AudioSeq_AudioListPushBack(&gLayerFreeList, &layer->listItem); + AudioSeq_SeqLayerDisable(layer); + channel->layers[layerIndex] = NULL; } } @@ -769,8 +766,8 @@ void AudioSeq_SetInstrument(SequenceChannel* channel, u8 instId) { channel->hasInstrument = true; } -void AudioSeq_SequenceChannelSetVolume(SequenceChannel* channel, u8 arg1) { - channel->volume = (s32) arg1 / 127.0f; +void AudioSeq_SequenceChannelSetVolume(SequenceChannel* channel, u8 volume) { + channel->volume = (s32) volume / 127.0f; } void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { @@ -1531,7 +1528,7 @@ void AudioSeq_ProcessSequences(s32 arg0) { s32 i; for (i = 0; i < ARRAY_COUNT(gSeqPlayers); i++) { - if (gSeqPlayers[i].enabled == 1) { + if (gSeqPlayers[i].enabled == true) { AudioSeq_SequencePlayerProcessSequence(&gSeqPlayers[i]); Audio_SequencePlayerProcessSound(&gSeqPlayers[i]); } diff --git a/src/audio/audio_synthesis.c b/src/audio/audio_synthesis.c index 2a0e147e..a6216e21 100644 --- a/src/audio/audio_synthesis.c +++ b/src/audio/audio_synthesis.c @@ -388,7 +388,7 @@ void AudioSynth_HartleyTransform(f32* arg0, s32 arg1, f32* arg2) { #pragma GLOBAL_ASM("asm/us/rev1/nonmatchings/audio/audio_synthesis/AudioSynth_HartleyTransform.s") #endif -// https://decomp.me/scratch/mYlns +// https://decomp.me/scratch/TZQNS #ifdef NON_MATCHING void func_80009124(s16** arg0) { s16* var_a1; @@ -843,28 +843,37 @@ Acmd* AudioSynth_DoOneAudioUpdate(s16* aiBuf, s32 aiBufLen, Acmd* aList, s32 upd Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisState* synthState, s16* aiBuf, s32 aiBufLen, Acmd* aList, s32 updateIndex) { + s32 pad11C[3]; Sample* bookSample; AdpcmLoop* loopInfo; void* currentBook; - s32 sampleFinished; - u32 loopToPoint; + s32 pad104[2]; + bool sampleFinished; + bool loopToPoint; s32 flags; u16 resampleRateFixedPoint; s32 numSamplesToLoad; + s32 padE8[3]; s32 skipBytes = 0; + s32 padD8[3]; uintptr_t sampleAddr; + s32 padC8; s32 numSamplesToLoadAdj; s32 numSamplesProcessed; u32 endPos; s32 nSamplesToProcess; + s32 padB4[5]; s32 numTrailingSamplesToIgnore; + s32 pad9C[3]; s32 frameSize; + s32 pad8C; s32 skipInitialSamples; s32 sampleDmaStart; + s32 pad80; s32 numParts; s32 curPart; s32 numSamplesInThisIteration; - uintptr_t sampleDataChunkAlignPad; + s32 sampleDataChunkAlignPad; s32 resampledTempLen; u16 noteSamplesDmemAddrBeforeResampling; s32 pasdasd; @@ -879,34 +888,33 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisSta s32 dmemUncompressedAddrOffset1; u32 sampleslenFixedPoint; u8* samplesToLoadAddr; + uintptr_t buffAddr; s32 gain; u32 nEntries; s32 aligned; - s32 align2; - u32 addr; + s16 addr; s32 samplesRemaining; s32 numSamplesToDecode; currentBook = NULL; note = &gNotes[noteIndex]; - flags = 0; + flags = A_CONTINUE; + if (noteSub->bitField0.needsInit == 1) { - flags = 1; + flags = A_INIT; synthState->restart = 0; synthState->samplePosInt = 0; synthState->samplePosFrac = 0; synthState->curVolLeft = 0; synthState->curVolRight = 0; - synthState->prevHaasEffectLeftDelaySize = 0; - synthState->prevHaasEffectRightDelaySize = 0; - synthState->numParts = 0; + synthState->numParts = synthState->prevHaasEffectRightDelaySize = synthState->prevHaasEffectLeftDelaySize = 0; note->noteSubEu.bitField0.finished = 0; } resampleRateFixedPoint = noteSub->resampleRate; numParts = noteSub->bitField1.hasTwoParts + 1; sampleslenFixedPoint = ((resampleRateFixedPoint * aiBufLen) * 2) + synthState->samplePosFrac; - numSamplesToLoad = sampleslenFixedPoint >> 0x10; + numSamplesToLoad = sampleslenFixedPoint >> 16; synthState->samplePosFrac = sampleslenFixedPoint & 0xFFFF; if ((synthState->numParts == 1) && (numParts == 2)) { @@ -925,7 +933,7 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisSta noteSamplesDmemAddrBeforeResampling = DMEM_UNCOMPRESSED_NOTE + (synthState->samplePosInt * SAMPLE_SIZE); synthState->samplePosInt += numSamplesToLoad; } else { - bookSample = *(noteSub->waveSampleAddr); + bookSample = *((Sample**) noteSub->waveSampleAddr); loopInfo = bookSample->loop; endPos = loopInfo->end; @@ -935,15 +943,16 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisSta for (curPart = 0; curPart < numParts; curPart++) { numSamplesProcessed = 0; dmemUncompressedAddrOffset1 = 0; + if (numParts == 1) { numSamplesToLoadAdj = numSamplesToLoad; } else if (numSamplesToLoad & 1) { - numSamplesToLoadAdj = (numSamplesToLoad & (~1)) + (curPart * 2); + numSamplesToLoadAdj = (numSamplesToLoad & ~1) + (curPart * 2); } else { numSamplesToLoadAdj = numSamplesToLoad; } - if ((bookSample->codec == 0) && (currentBook != bookSample->book->book)) { + if ((bookSample->codec == CODEC_ADPCM) && (currentBook != bookSample->book->book)) { switch (noteSub->bitField1.bookOffset) { case 1: currentBook = &gD_800DD200[1]; @@ -960,23 +969,29 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisSta break; } - nEntries = (16 * bookSample->book->order) * bookSample->book->numPredictors; + nEntries = (SAMPLES_PER_FRAME * bookSample->book->order) * bookSample->book->numPredictors; aLoadADPCM(aList++, nEntries, OS_K0_TO_PHYSICAL(currentBook)); } while (numSamplesProcessed != numSamplesToLoadAdj) { - sampleFinished = 0; - loopToPoint = 0; + sampleFinished = false; + loopToPoint = false; + samplesRemaining = endPos - synthState->samplePosInt; nSamplesToProcess = numSamplesToLoadAdj - numSamplesProcessed; + nFirstFrameSamplesToIgnore = synthState->samplePosInt & 0xF; + if ((nFirstFrameSamplesToIgnore == 0) && (!synthState->restart)) { - nFirstFrameSamplesToIgnore = 0x10; + nFirstFrameSamplesToIgnore = SAMPLES_PER_FRAME; } - numSamplesInFirstFrame = 0x10 - nFirstFrameSamplesToIgnore; + + numSamplesInFirstFrame = SAMPLES_PER_FRAME - nFirstFrameSamplesToIgnore; + if (nSamplesToProcess < samplesRemaining) { - nFramesToDecode = ((nSamplesToProcess - numSamplesInFirstFrame) + 0xF) / 16; - numSamplesToDecode = nFramesToDecode * 0x10; + nFramesToDecode = + ((nSamplesToProcess - numSamplesInFirstFrame) + SAMPLES_PER_FRAME - 1) / SAMPLES_PER_FRAME; + numSamplesToDecode = nFramesToDecode * SAMPLES_PER_FRAME; numTrailingSamplesToIgnore = (numSamplesInFirstFrame + numSamplesToDecode) - nSamplesToProcess; } else { numSamplesToDecode = samplesRemaining - numSamplesInFirstFrame; @@ -985,23 +1000,26 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisSta numSamplesToDecode = 0; numSamplesInFirstFrame = samplesRemaining; } - nFramesToDecode = (numSamplesToDecode + 0xF) / 16; + + nFramesToDecode = (numSamplesToDecode + SAMPLES_PER_FRAME - 1) / SAMPLES_PER_FRAME; if (loopInfo->count != 0) { - loopToPoint = 1; + // Loop around and restart + loopToPoint = true; } else { - sampleFinished = 1; + sampleFinished = true; } } + switch (bookSample->codec) { case CODEC_ADPCM: frameSize = 9; - skipInitialSamples = 0x10; + skipInitialSamples = SAMPLES_PER_FRAME; sampleDmaStart = 0; break; case CODEC_S8: - frameSize = 0x10; - skipInitialSamples = 0x10; + frameSize = 16; + skipInitialSamples = SAMPLES_PER_FRAME; sampleDmaStart = 0; break; @@ -1038,10 +1056,11 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisSta addr = 0x990 - aligned; if (nFramesToDecode != 0) { + if (1) {} frameIndex = (synthState->samplePosInt + skipInitialSamples - nFirstFrameSamplesToIgnore) / 16; sampleDataOffset = frameIndex * frameSize; samplesToLoadAddr = (u8*) (sampleDmaStart + sampleDataOffset + sampleAddr); - sampleDataChunkAlignPad = ((uintptr_t) samplesToLoadAddr) % 16; + sampleDataChunkAlignPad = ((uintptr_t) samplesToLoadAddr) % SAMPLES_PER_FRAME; aLoadBuffer(aList++, OS_K0_TO_PHYSICAL(samplesToLoadAddr - sampleDataChunkAlignPad), addr, aligned); } else { @@ -1051,85 +1070,88 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisSta if (synthState->restart) { aSetLoop(aList++, OS_K0_TO_PHYSICAL(bookSample->loop->predictorState)); - flags = 2; + flags = A_LOOP; synthState->restart = 0; } numSamplesInThisIteration = (numSamplesToDecode + numSamplesInFirstFrame) - numTrailingSamplesToIgnore; if (numSamplesProcessed == 0) { - switch (bookSample->codec) { case 0: - aSetBuffer(aList++, 0, addr + sampleDataChunkAlignPad, DMEM_UNCOMPRESSED_NOTE, - numSamplesToDecode * 2); - + numSamplesToDecode * SAMPLE_SIZE); aADPCMdec(aList++, flags, OS_K0_TO_PHYSICAL(synthState->synthesisBuffers)); break; case 1: aSetBuffer(aList++, 0, addr + sampleDataChunkAlignPad, DMEM_UNCOMPRESSED_NOTE, - numSamplesToDecode * 2); + numSamplesToDecode * SAMPLE_SIZE); aS8Dec(aList++, flags, OS_K0_TO_PHYSICAL(synthState->synthesisBuffers)); break; } - skipBytes = nFirstFrameSamplesToIgnore * 2; + skipBytes = nFirstFrameSamplesToIgnore * SAMPLE_SIZE; } else { - align2 = ALIGN16(dmemUncompressedAddrOffset1 + 0x10); + aligned = ALIGN16(dmemUncompressedAddrOffset1 + SAMPLES_PER_FRAME); switch (bookSample->codec) { case 0: - aSetBuffer(aList++, 0, addr + sampleDataChunkAlignPad, align2 + DMEM_UNCOMPRESSED_NOTE, - numSamplesToDecode * 2); + aSetBuffer(aList++, 0, addr + sampleDataChunkAlignPad, DMEM_UNCOMPRESSED_NOTE + aligned, + numSamplesToDecode * SAMPLE_SIZE); aADPCMdec(aList++, flags, OS_K0_TO_PHYSICAL(synthState->synthesisBuffers)); break; case 1: - aSetBuffer(aList++, 0, addr + sampleDataChunkAlignPad, align2 + DMEM_UNCOMPRESSED_NOTE, - numSamplesToDecode * 2); + aSetBuffer(aList++, 0, addr + sampleDataChunkAlignPad, DMEM_UNCOMPRESSED_NOTE + aligned, + numSamplesToDecode * SAMPLE_SIZE); aS8Dec(aList++, flags, OS_K0_TO_PHYSICAL(synthState->synthesisBuffers)); break; } - aDMEMMove(aList++, DMEM_UNCOMPRESSED_NOTE + align2 + (nFirstFrameSamplesToIgnore * 2), - DMEM_UNCOMPRESSED_NOTE + dmemUncompressedAddrOffset1, numSamplesInThisIteration * 2); + aDMEMMove(aList++, DMEM_UNCOMPRESSED_NOTE + aligned + (nFirstFrameSamplesToIgnore * SAMPLE_SIZE), + DMEM_UNCOMPRESSED_NOTE + dmemUncompressedAddrOffset1, + numSamplesInThisIteration * SAMPLE_SIZE); } numSamplesProcessed += numSamplesInThisIteration; switch (flags) { - case 1: - skipBytes = 0x20; - dmemUncompressedAddrOffset1 = (numSamplesToDecode + 0x10) * 2; + case A_INIT: + skipBytes = SAMPLES_PER_FRAME * SAMPLE_SIZE; + dmemUncompressedAddrOffset1 = (numSamplesToDecode + SAMPLES_PER_FRAME) * SAMPLE_SIZE; break; - case 2: - dmemUncompressedAddrOffset1 = (numSamplesInThisIteration * 2) + dmemUncompressedAddrOffset1; + case A_LOOP: + dmemUncompressedAddrOffset1 = + (numSamplesInThisIteration * SAMPLE_SIZE) + dmemUncompressedAddrOffset1; break; default: if (dmemUncompressedAddrOffset1 != 0) { - dmemUncompressedAddrOffset1 = (numSamplesInThisIteration * 2) + dmemUncompressedAddrOffset1; + dmemUncompressedAddrOffset1 = + (numSamplesInThisIteration * SAMPLE_SIZE) + dmemUncompressedAddrOffset1; } else { - dmemUncompressedAddrOffset1 = (nFirstFrameSamplesToIgnore + numSamplesInThisIteration) * 2; + dmemUncompressedAddrOffset1 = + (nFirstFrameSamplesToIgnore + numSamplesInThisIteration) * SAMPLE_SIZE; } break; } skip: - flags = 0; + + flags = A_CONTINUE; if (sampleFinished) { - aClearBuffer(aList++, dmemUncompressedAddrOffset1 + DMEM_UNCOMPRESSED_NOTE, - (numSamplesToLoadAdj - numSamplesProcessed) * 2); - noteSub->bitField0.finished = 1; - note->noteSubEu.bitField0.finished = 1; + aClearBuffer(aList++, DMEM_UNCOMPRESSED_NOTE + dmemUncompressedAddrOffset1, + (numSamplesToLoadAdj - numSamplesProcessed) * SAMPLE_SIZE); + noteSub->bitField0.finished = true; + note->noteSubEu.bitField0.finished = true; AudioSynth_DisableSampleStates(updateIndex, noteIndex); break; } - if (loopToPoint != 0) { - synthState->restart = 1; + + if (loopToPoint) { + synthState->restart = true; synthState->samplePosInt = loopInfo->start; } else { synthState->samplePosInt += nSamplesToProcess; @@ -1138,24 +1160,25 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisSta switch (numParts) { case 1: - noteSamplesDmemAddrBeforeResampling = skipBytes + DMEM_UNCOMPRESSED_NOTE; + noteSamplesDmemAddrBeforeResampling = DMEM_UNCOMPRESSED_NOTE + skipBytes; break; case 2: switch (curPart) { case 0: - aInterl(aList++, skipBytes + DMEM_UNCOMPRESSED_NOTE, DMEM_WET_SCRATCH, - ALIGN8(numSamplesToLoadAdj / 2)); + aInterl(aList++, skipBytes + DMEM_UNCOMPRESSED_NOTE, + DMEM_TEMP + (SAMPLES_PER_FRAME * SAMPLE_SIZE), ALIGN8(numSamplesToLoadAdj / 2)); resampledTempLen = numSamplesToLoadAdj; - noteSamplesDmemAddrBeforeResampling = DMEM_WET_SCRATCH; + noteSamplesDmemAddrBeforeResampling = DMEM_TEMP + (SAMPLES_PER_FRAME * SAMPLE_SIZE); if (noteSub->bitField0.finished) { aClearBuffer(aList++, resampledTempLen + noteSamplesDmemAddrBeforeResampling, - numSamplesToLoadAdj + 0x10); + numSamplesToLoadAdj + SAMPLES_PER_FRAME); } break; case 1: - aInterl(aList++, skipBytes + DMEM_UNCOMPRESSED_NOTE, resampledTempLen + DMEM_WET_SCRATCH, + aInterl(aList++, skipBytes + DMEM_UNCOMPRESSED_NOTE, + resampledTempLen + DMEM_TEMP + (SAMPLES_PER_FRAME * SAMPLE_SIZE), ALIGN8(numSamplesToLoadAdj / 2)); break; } @@ -1168,35 +1191,44 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisSta } } } - flags = 0; - if (noteSub->bitField0.needsInit == 1) { - flags = 1; - noteSub->bitField0.needsInit = 0; + + flags = A_CONTINUE; + if (noteSub->bitField0.needsInit == true) { + flags = A_INIT; + noteSub->bitField0.needsInit = false; } + flags = sp56 | flags; - aList = AudioSynth_FinalResample(aList, synthState, aiBufLen * 2, resampleRateFixedPoint, + + aList = AudioSynth_FinalResample(aList, synthState, aiBufLen * SAMPLE_SIZE, resampleRateFixedPoint, noteSamplesDmemAddrBeforeResampling, flags); - if (flags & 1) { - flags = 1; + + if (flags & A_INIT) { + flags = A_INIT; } + if (noteSub->bitField1.bookOffset == 3) { - aUnkCmd19(aList++, 0, aiBufLen * 2, 0x450, 0x450); + aUnkCmd19(aList++, 0, aiBufLen * SAMPLE_SIZE, DMEM_TEMP, DMEM_TEMP); } + gain = noteSub->gain; if (gain != 0) { + // A gain of 0x10 (a UQ4.4 number) is equivalent to 1.0 and represents no volume change if (gain < 0x10) { gain = 0x10; } - aHiLoGain(aList++, gain, (aiBufLen + 0x10) * 2, 0x450, 0); + aHiLoGain(aList++, gain, (aiBufLen + SAMPLES_PER_FRAME) * SAMPLE_SIZE, DMEM_TEMP, 0); } + if ((noteSub->leftDelaySize != 0) || (synthState->prevHaasEffectLeftDelaySize != 0)) { - delaySide = 1; + delaySide = HAAS_EFFECT_DELAY_LEFT; } else if ((noteSub->rightDelaySize != 0) || (synthState->prevHaasEffectRightDelaySize != 0)) { - delaySide = 2; + delaySide = HAAS_EFFECT_DELAY_RIGHT; } else { - delaySide = 0; + delaySide = HAAS_EFFECT_DELAY_NONE; } - aList = AudioSynth_ProcessEnvelope(aList, noteSub, synthState, aiBufLen, 0x450, delaySide, flags); + + aList = AudioSynth_ProcessEnvelope(aList, noteSub, synthState, aiBufLen, DMEM_TEMP, delaySide, flags); if (noteSub->bitField0.usesHeadsetPanEffects) { if (!(flags & 1)) { flags = 0; diff --git a/src/engine/fox_360.c b/src/engine/fox_360.c index e7e7b9dc..034b9bf0 100644 --- a/src/engine/fox_360.c +++ b/src/engine/fox_360.c @@ -87,7 +87,7 @@ void AllRange_GetStarWolfHits(Actor* this) { } bool AllRange_PlayMessage(u16* msg, RadioCharacterId rcid) { - if ((gRadioState == 0) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_STANDBY)) { + if ((gRadioState == 0) && (gPlayer[0].state != PLAYERSTATE_STANDBY)) { Radio_PlayMessage(msg, rcid); return true; } else { @@ -227,7 +227,7 @@ void AllRange_GreatFoxRepair(Player* player) { gCsCamEyeX -= 1.0f; player->rot.x += 0.4f; if (gCsFrameCount >= 130) { - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; player->arwing.drawFace = false; player->unk_014 = 0; player->unk_018 = 0; @@ -477,7 +477,7 @@ void ActorAllRange_SpawnStarWolf(void) { } void ActorAllRange_PlayMessage(u16* msg, RadioCharacterId character) { - if (!gHideRadio && (gActors[0].state == STATE360_2) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_STANDBY)) { + if (!gHideRadio && (gActors[0].state == STATE360_2) && (gPlayer[0].state != PLAYERSTATE_STANDBY)) { Radio_PlayMessage(msg, character); } } @@ -508,7 +508,7 @@ void ActorAllRange_UpdateStarWolfEvents(ActorAllRange* this) { if (gAllRangeEventTimer == gAllRangeSpawnEvent) { ActorAllRange_SpawnStarWolf(); this->state = STATE360_3; - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_STANDBY; + gPlayer[0].state = PLAYERSTATE_STANDBY; if ((gCurrentLevel == LEVEL_VENOM_2) || (gCurrentLevel == LEVEL_BOLSE)) { gPlayer[0].camRoll = 20.0f; } @@ -698,7 +698,8 @@ void ActorAllRange_SpawnSupplies(Actor* this) { } } } - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) && !gAllRangeSuppliesSent) { + + if ((gPlayer[0].state == PLAYERSTATE_ACTIVE) && !gAllRangeSuppliesSent) { if (gAllRangeWingRepairTimer != 0) { gAllRangeWingRepairTimer--; } @@ -710,7 +711,7 @@ void ActorAllRange_SpawnSupplies(Actor* this) { } void ActorAllRange_UpdateEvents(Actor* this) { - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_DOWN) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_NEXT)) { + if ((gPlayer[0].state == PLAYERSTATE_DOWN) || (gPlayer[0].state == PLAYERSTATE_NEXT)) { Object_Kill(&this->obj, this->sfxSource); return; } @@ -810,7 +811,7 @@ s32 ActorAllRange_CheckObjectNearby(ActorAllRange* this) { Boss* boss = &gBosses[0]; s32 pad[4]; - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) { + if (gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO) { return 0; } @@ -1229,7 +1230,7 @@ void ActorAllRange_ApplyDamage(ActorAllRange* this) { } void ActorAllRange_CheckPlayerNearby(ActorAllRange* this) { - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) && (this->iwork[24] != 0) && + if ((gPlayer[0].state == PLAYERSTATE_ACTIVE) && (this->iwork[24] != 0) && (fabsf(this->obj.pos.x - gPlayer[0].pos.x) < 1000.0f) && (fabsf(this->obj.pos.y - gPlayer[0].pos.y) < 1000.0f) && (fabsf(this->obj.pos.z - gPlayer[0].trueZpos) < 1000.0f)) { @@ -1501,7 +1502,7 @@ void ActorAllRange_Update(ActorAllRange* this) { break; case STATE360_0: - if (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_START_360) { + if (gPlayer[0].state != PLAYERSTATE_START_360) { this->fwork[0] = this->fwork[1] = 40.0f; if (gActors[0].state == STATE360_5) { @@ -1573,7 +1574,7 @@ void ActorAllRange_Update(ActorAllRange* this) { if (this->aiIndex == AI360_FOX) { if (gCurrentLevel != LEVEL_VENOM_2) { if ((gPlayer[0].somersault && (this->iwork[4] > 10)) || - ((gCurrentLevel == LEVEL_BOLSE) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_STANDBY))) { + ((gCurrentLevel == LEVEL_BOLSE) && (gPlayer[0].state == PLAYERSTATE_STANDBY))) { this->state = STATE360_3; this->counter_04E = 300; this->timer_0BC = 160; @@ -1656,8 +1657,7 @@ void ActorAllRange_Update(ActorAllRange* this) { this->fwork[1] = gActors[this->aiIndex].fwork[0] - 5.0f; } else { this->fwork[1] = gPlayer[0].baseSpeed - 5.0f; - if ((gCurrentLevel == LEVEL_VENOM_2) && - (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_U_TURN) && + if ((gCurrentLevel == LEVEL_VENOM_2) && (gPlayer[0].state == PLAYERSTATE_U_TURN) && (gPlayer[0].aerobaticPitch > 100.0f)) { this->iwork[16] = STATE360_8; } @@ -1925,7 +1925,7 @@ void ActorAllRange_Update(ActorAllRange* this) { spE0 = 0.0f; } spDC = RAND_FLOAT_CENTERED(10000.0f); - if ((gCurrentLevel == LEVEL_KATINA) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_STANDBY)) { + if ((gCurrentLevel == LEVEL_KATINA) && (gPlayer[0].state == PLAYERSTATE_STANDBY)) { spE4 = RAND_FLOAT_CENTERED(5000.0f); spDC = RAND_FLOAT_CENTERED(5000.0f); } diff --git a/src/engine/fox_beam.c b/src/engine/fox_beam.c index b95015e6..d6751bcc 100644 --- a/src/engine/fox_beam.c +++ b/src/engine/fox_beam.c @@ -851,7 +851,7 @@ void PlayerShot_CollisionCheck(PlayerShot* shot) { } test.z = test.x; if ((i != shot->sourceId) && - ((player->state_1C8 == PLAYERSTATE_1C8_ACTIVE) || (player->state_1C8 == PLAYERSTATE_1C8_DOWN)) && + ((player->state == PLAYERSTATE_ACTIVE) || (player->state == PLAYERSTATE_DOWN)) && (fabsf(player->trueZpos - shot->obj.pos.z) < test.z) && (fabsf(player->pos.x - shot->obj.pos.x) < test.x) && (fabsf(player->pos.y - shot->obj.pos.y) < test.y)) { @@ -1100,8 +1100,7 @@ void PlayerShot_DrawLaser(PlayerShot* shot) { if (gCamCount < 4) { RCP_SetupDL_21(); twinLaserSeparation = 9.0f; - if ((shot->unk_58 == 0) || - ((gCurrentLevel == LEVEL_METEO) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO))) { + if ((shot->unk_58 == 0) || ((gCurrentLevel == LEVEL_METEO) && (gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO))) { width = 4.0f; length = 20.0f; } else { @@ -1137,7 +1136,7 @@ void PlayerShot_DrawLaser(PlayerShot* shot) { var_a1 = 2; } } else if (gCurrentLevel == LEVEL_KATINA) { - if (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_INTRO) { + if (gPlayer[0].state != PLAYERSTATE_LEVEL_INTRO) { if (shot->sourceId > NPC_SHOT_ID + AI360_PEPPY) { if (gActors[shot->sourceId - NPC_SHOT_ID].animFrame == 0) { var_a1 = 1; @@ -1739,8 +1738,8 @@ bool PlayerShot_FindLockTarget(PlayerShot* shot) { } if (gVersusMode) { for (i = 0, player = gPlayer; i < gCamCount; i++, player++) { - if ((player->state_1C8 == PLAYERSTATE_1C8_ACTIVE) && !player->somersault && - (player->form != FORM_ON_FOOT) && (i != shot->sourceId) && (gVsLockOnTimers[i][shot->sourceId] == 0) && + if ((player->state == PLAYERSTATE_ACTIVE) && !player->somersault && (player->form != FORM_ON_FOOT) && + (i != shot->sourceId) && (gVsLockOnTimers[i][shot->sourceId] == 0) && (fabsf(shot->obj.pos.x - player->pos.x) <= lockRange) && (fabsf(shot->obj.pos.y - player->pos.y) <= lockRange) && (fabsf(shot->obj.pos.z - player->trueZpos) <= lockRange)) { @@ -1877,7 +1876,7 @@ void PlayerShot_ApplyExplosionDamage(PlayerShot* shot, s32 damage) { Player* player; f32 radius = shot->scale * 60.0f; - scenery = gScenery; + scenery = &gScenery[0]; for (i = 0; i < ARRAY_COUNT(gScenery); i++, scenery++) { if ((scenery->obj.status == OBJ_ACTIVE) && (scenery->obj.id == OBJ_SCENERY_CO_DOORS)) { dx = scenery->obj.pos.x - shot->obj.pos.x; @@ -1889,7 +1888,8 @@ void PlayerShot_ApplyExplosionDamage(PlayerShot* shot, s32 damage) { scenery->dmgPart = 0; } } - sprite = gSprites; + + sprite = &gSprites[0]; for (i = 0; i < ARRAY_COUNT(gSprites); i++, sprite++) { if ((sprite->obj.status == OBJ_ACTIVE) && ((sprite->obj.id == OBJ_SPRITE_FO_POLE) || (sprite->obj.id == OBJ_SPRITE_TI_CACTUS) || @@ -1902,6 +1902,7 @@ void PlayerShot_ApplyExplosionDamage(PlayerShot* shot, s32 damage) { } } } + actor = &gActors[0]; for (i = 0; i < ARRAY_COUNT(gActors); i++, actor++) { if ((actor->obj.status == OBJ_ACTIVE) && (actor->timer_0C2 == 0) && @@ -1915,12 +1916,14 @@ void PlayerShot_ApplyExplosionDamage(PlayerShot* shot, s32 damage) { if ((gLevelMode == LEVELMODE_ON_RAILS) && (dz < 0.0f)) { dz *= 0.6f; } + actor->hitPos.x = shot->obj.pos.x; actor->hitPos.y = shot->obj.pos.y; actor->hitPos.z = shot->obj.pos.z; + if (sqrtf(SQ(dx) + SQ(dy) + SQ(dz)) < radius) { if ((actor->obj.id == OBJ_ACTOR_CO_RADAR) || (actor->obj.id == OBJ_ACTOR_ME_LASER_CANNON_1) || - (actor->obj.id == OBJ_MISSILE_SEEK_TEAM) || (actor->obj.id == OBJ_ACTOR_ME_HOPBOT) || + (actor->obj.id == OBJ_ACTOR_MISSILE_SEEK_TEAM) || (actor->obj.id == OBJ_ACTOR_ME_HOPBOT) || (actor->obj.id == OBJ_ACTOR_ME_METEO_BALL) || (actor->obj.id == OBJ_ACTOR_ME_LASER_CANNON_2) || ((actor->obj.id == OBJ_ACTOR_EVENT) && (actor->eventType == EVID_SUPPLY_CRATE)) || ((actor->obj.id == OBJ_ACTOR_EVENT) && (actor->eventType == EVID_SX_WARP_GATE)) || @@ -1958,6 +1961,7 @@ void PlayerShot_ApplyExplosionDamage(PlayerShot* shot, s32 damage) { } } } + if (gCurrentLevel == LEVEL_MACBETH) { Macbeth_801AD144(shot); } else if (gCurrentLevel == LEVEL_VENOM_1) { @@ -1965,7 +1969,8 @@ void PlayerShot_ApplyExplosionDamage(PlayerShot* shot, s32 damage) { } else { PlayerShot_CheckBossHitbox(shot); } - effect = gEffects; + + effect = &gEffects[0]; for (i = 0; i < ARRAY_COUNT(gEffects); i++, effect++) { if (effect->obj.status == OBJ_ACTIVE) { dx = effect->obj.pos.x - shot->obj.pos.x; @@ -1992,10 +1997,11 @@ void PlayerShot_ApplyExplosionDamage(PlayerShot* shot, s32 damage) { } } } + if (gVersusMode) { player = gPlayer; for (i = 0; i < gCamCount; i++, player++) { - if ((i != shot->sourceId) && (player->state_1C8 == PLAYERSTATE_1C8_ACTIVE) && (player->hitTimer == 0)) { + if ((i != shot->sourceId) && (player->state == PLAYERSTATE_ACTIVE) && (player->hitTimer == 0)) { dx = player->pos.x - shot->obj.pos.x; dy = player->pos.y - shot->obj.pos.y; dz = player->trueZpos - shot->obj.pos.z; @@ -2028,14 +2034,17 @@ void PlayerShot_UpdateBomb(PlayerShot* shot) { PlayerShot_ExplodeBomb(shot); break; } + if ((shot->obj.pos.y < gGroundHeight) && (gGroundType != 4)) { PlayerShot_ExplodeBomb(shot); break; } + if ((gPlayer[shot->sourceId].form == FORM_LANDMASTER) || (gPlayer[shot->sourceId].form == FORM_ON_FOOT)) { shot->vel.y -= 1.0f; Math_SmoothStepToF(&shot->obj.rot.x, -90.0f, 0.05f, 1.0f, 0.0f); } + if (shot->timer < 25) { if (gVersusMode) { if (gControllerPress[shot->sourceId].button & gBombButton[shot->sourceId]) { @@ -2049,19 +2058,22 @@ void PlayerShot_UpdateBomb(PlayerShot* shot) { } } } + if (!((gCurrentLevel == LEVEL_VENOM_ANDROSS) && (gBosses[0].obj.status == OBJ_ACTIVE) && (gBosses[0].state == 17))) { PlayerShot_CollisionCheck(shot); } PlayerShot_SetBombLight(shot); break; + case 1: gGroundClipMode = 2; shot->obj.rot.y += 1.0f; Math_SmoothStepToF(&shot->scale, shot->unk_48, 0.05f, 1.5f, 0.001f); + if ((shot->timer > 0) && (shot->timer < 30)) { - if (!gVersusMode && ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) || - (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_U_TURN))) { + if (!gVersusMode && + ((gPlayer[0].state == PLAYERSTATE_ACTIVE) || (gPlayer[0].state == PLAYERSTATE_U_TURN))) { test.x = gPlayer[0].pos.x - shot->obj.pos.x; test.y = gPlayer[0].pos.y - shot->obj.pos.y; test.z = gPlayer[0].trueZpos - shot->obj.pos.z; @@ -2074,6 +2086,7 @@ void PlayerShot_UpdateBomb(PlayerShot* shot) { } PlayerShot_SetBombLight(shot); } + if (shot->timer == 0) { shot->unk_58 -= 8; if (shot->unk_58 < 0) { @@ -2125,8 +2138,9 @@ void PlayerShot_UpdateLockOnShot(PlayerShot* shot) { sLockOnPos.y += actor->info.targetOffset; } } - for (i = 0, player = gPlayer; i < gCamCount; i++, player++) { - if (((player->state_1C8 == PLAYERSTATE_1C8_ACTIVE) || (player->state_1C8 == PLAYERSTATE_1C8_U_TURN)) && + + for (i = 0, player = &gPlayer[0]; i < gCamCount; i++, player++) { + if (((player->state == PLAYERSTATE_ACTIVE) || (player->state == PLAYERSTATE_U_TURN)) && (gVsLockOnTimers[i][shot->sourceId] != 0)) { var_a3 = 1; gVsLockOnTimers[i][shot->sourceId] = 2; @@ -2139,6 +2153,7 @@ void PlayerShot_UpdateLockOnShot(PlayerShot* shot) { sLockOnPos.z = player->trueZpos; } } + if (var_a3 != 0) { sp6C = shot->obj.pos.x - sLockOnPos.x; sp68 = shot->obj.pos.y - sLockOnPos.y; @@ -2164,12 +2179,14 @@ void PlayerShot_UpdateLockOnShot(PlayerShot* shot) { shot->unk_60 = 1; } } + Math_SmoothStepToF(&shot->unk_50, 360.0f, 1.0f, 3.0f, 0.f); if (shot->unk_60 != 0) { Math_SmoothStepToF(&shot->unk_54, 169.0f, 1.0f, 13.0f, 0.f); } else { Math_SmoothStepToF(&shot->unk_54, 91.0f, 1.0f, 7.7999997f, 0.f); } + if (!((gPlayer[shot->sourceId].form == FORM_LANDMASTER) && (shot->unk_60 != 0))) { Vec3f sp44; Vec3f sp38; @@ -2185,6 +2202,7 @@ void PlayerShot_UpdateLockOnShot(PlayerShot* shot) { shot->vel.y = sp38.y; shot->vel.z = sp38.z; } + PlayerShot_CollisionCheck(shot); gLight3x = shot->obj.pos.x; gLight3y = shot->obj.pos.y; @@ -2203,6 +2221,7 @@ void PlayerShot_UpdateShot(PlayerShot* shot, s32 index) { shot->obj.pos.x += shot->vel.x; shot->obj.pos.y += shot->vel.y; shot->obj.pos.z += shot->vel.z; + switch (shot->obj.id) { case PLAYERSHOT_SINGLE_LASER: PlayerShot_UpdateBeam(shot, index); @@ -2288,7 +2307,7 @@ void PlayerShot_Update(PlayerShot* shot) { break; case PLAYERSHOT_SINGLE_LASER: case PLAYERSHOT_TWIN_LASER: - if ((shot->unk_58 == 0) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO)) { + if ((shot->unk_58 == 0) || (gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO)) { ticks = 4; } else { ticks = 3; diff --git a/src/engine/fox_bg.c b/src/engine/fox_bg.c index 0aef18ee..d82d1c1a 100644 --- a/src/engine/fox_bg.c +++ b/src/engine/fox_bg.c @@ -54,16 +54,12 @@ u16 gStarColors[16] = { 0x294B, 0x18DF, 0x294B, 0x1085, 0x39FF, 0x108B, 0x18CD, 0x108B, }; Gfx* sSunDLs[13] = { - aRadarMarkKaSaucererDL, aRadarMarkKaSaucererDL, aRadarMarkKaSaucererDL, aRadarMarkKaSaucererDL, - aRadarMarkKaSaucererDL, D_BG_PLANET_20112C0, aRadarMarkKaSaucererDL, aRadarMarkKaSaucererDL, - aRadarMarkKaSaucererDL, aRadarMarkKaSaucererDL, aRadarMarkKaSaucererDL, D_BG_PLANET_20112C0, - aRadarMarkKaSaucererDL, + aBallDL, aBallDL, aBallDL, aBallDL, aBallDL, D_BG_PLANET_20112C0, + aBallDL, aBallDL, aBallDL, aBallDL, aBallDL, D_BG_PLANET_20112C0, + aBallDL, }; Gfx* sKaSunDLs[13] = { - aRadarMarkKaSaucererDL, aRadarMarkKaSaucererDL, aRadarMarkKaSaucererDL, aRadarMarkKaSaucererDL, - aRadarMarkKaSaucererDL, aRadarMarkKaSaucererDL, aRadarMarkKaSaucererDL, aRadarMarkKaSaucererDL, - aRadarMarkKaSaucererDL, aRadarMarkKaSaucererDL, aRadarMarkKaSaucererDL, aRadarMarkKaSaucererDL, - aRadarMarkKaSaucererDL, + aBallDL, aBallDL, aBallDL, aBallDL, aBallDL, aBallDL, aBallDL, aBallDL, aBallDL, aBallDL, aBallDL, aBallDL, aBallDL, }; f32 sSunShifts[13] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f, 13.0f, 20.0f, 35.0f, 40.0f, 50.0f, 50.0f, 70.0f, @@ -362,6 +358,7 @@ void Background_DrawPartialStarfield(s32 yMin, s32 yMax) { // Stars that are in cos = __cosf(gStarfieldRoll); sin = __sinf(gStarfieldRoll); + for (i = 0; i < var_s2; i++, sp5C++, sp60++, sp58++) { bx = *sp60 + spf68; by = *sp5C + spf64; @@ -424,8 +421,8 @@ static u8 skipInterpolation; void Background_DrawBackdrop(void) { f32 sp12C; f32 sp13C; - f32 sp138; - f32 sp134; + f32 bgXpos; + f32 bgYpos; f32 sp130; f32 camYawDeg; f32 scale; @@ -460,12 +457,12 @@ void Background_DrawBackdrop(void) { case LEVEL_KATINA: case LEVEL_VENOM_2: case LEVEL_VERSUS: - sp134 = (gPlayer[gPlayerNum].camPitch * -6000.0f) - (gPlayer[gPlayerNum].cam.eye.y * 0.4f); + bgYpos = (gPlayer[gPlayerNum].camPitch * -6000.0f) - (gPlayer[gPlayerNum].cam.eye.y * 0.4f); sp13C = Math_ModF(Math_RadToDeg(gPlayer[gPlayerNum].camYaw) * (-7280.0f / 360.0f) * 5.0f, 7280.0f); Matrix_RotateZ(gGfxMatrix, gPlayer[gPlayerNum].camRoll * M_DTOR, MTXF_APPLY); // Start by translating the matrix to the far left position - Matrix_Translate(gGfxMatrix, sp13C - 14560.0f, -2000.0f + sp134, -6000.0f, MTXF_APPLY); + Matrix_Translate(gGfxMatrix, sp13C - 14560.0f, -2000.0f + bgYpos, -6000.0f, MTXF_APPLY); if (gCurrentLevel == LEVEL_FORTUNA) { Matrix_Translate(gGfxMatrix, 0.0f, -2000.0f, 0, MTXF_APPLY); @@ -541,7 +538,7 @@ void Background_DrawBackdrop(void) { skipInterpolation = (fabsf(sp13C - bgPrevPosX) > 7280.0f / 2.0f); f32 bgCutsceneFix; - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) && (gCurrentLevel == LEVEL_CORNERIA)) { + if ((gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO) && (gCurrentLevel == LEVEL_CORNERIA)) { bgCutsceneFix = 100.0f; } else { bgCutsceneFix = 0.0f; @@ -549,7 +546,7 @@ void Background_DrawBackdrop(void) { // Apply camera roll and translate matrix to the starting position (far left) Matrix_RotateZ(gGfxMatrix, gPlayer[gPlayerNum].camRoll * M_DTOR, MTXF_APPLY); - Matrix_Translate(gGfxMatrix, sp13C - 14560.0f, -2000.0f + sp134 + bgCutsceneFix, -6000.0f, MTXF_APPLY); + Matrix_Translate(gGfxMatrix, sp13C - 14560.0f, -2000.0f + bgYpos + bgCutsceneFix, -6000.0f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); // Render the textures across a wider range to cover the screen @@ -590,7 +587,7 @@ void Background_DrawBackdrop(void) { case LEVEL_VENOM_ANDROSS: // WIP if (gDrawBackdrop != 6) { - sp134 = (gPlayer[gPlayerNum].camPitch * -6000.0f) - (gPlayer[gPlayerNum].cam.eye.y * 0.4f); + bgYpos = (gPlayer[gPlayerNum].camPitch * -6000.0f) - (gPlayer[gPlayerNum].cam.eye.y * 0.4f); sp13C = Math_ModF(Math_RadToDeg(gPlayer[gPlayerNum].camYaw) * (-7280.0f / 360.0f) * 5.0f, 7280.0f); @@ -628,7 +625,7 @@ void Background_DrawBackdrop(void) { // Leftmost DL (-2x translation) Matrix_RotateZ(gGfxMatrix, gPlayer[gPlayerNum].camRoll * M_DTOR, MTXF_APPLY); - Matrix_Translate(gGfxMatrix, sp13C - 2 * 7280.0f, -2000.0f + sp134, -6000.0f, MTXF_APPLY); + Matrix_Translate(gGfxMatrix, sp13C - 2 * 7280.0f, -2000.0f + bgYpos, -6000.0f, MTXF_APPLY); Matrix_Translate(gGfxMatrix, 0.0f, -2500.0f, 0.0f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); gSPDisplayList(gMasterDisp++, D_VE2_60038E0); @@ -689,23 +686,23 @@ void Background_DrawBackdrop(void) { break; case LEVEL_AQUAS: - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) { + if (gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO) { sp13C = Math_RadToDeg(gPlayer[gPlayerNum].camYaw) - gPlayer[gPlayerNum].yRot_114; - sp134 = (gPlayer[gPlayerNum].camPitch * -7000.0f) - (gPlayer[gPlayerNum].cam.eye.y * 0.6f); + bgYpos = (gPlayer[gPlayerNum].camPitch * -7000.0f) - (gPlayer[gPlayerNum].cam.eye.y * 0.6f); sp13C = Math_ModF(sp13C * -40.44444f * 2.0f, 7280.0f); // close to 7280.0f / 180.0f RCP_SetupDL_17(); Matrix_RotateZ(gGfxMatrix, gPlayer[gPlayerNum].camRoll * M_DTOR, MTXF_APPLY); Matrix_Scale(gGfxMatrix, 1.5f, 1.0f, 1.0f, MTXF_APPLY); // Start by translating the matrix to the far left position - Matrix_Translate(gGfxMatrix, sp13C - 14560.0f, sp134, -7000.0f, MTXF_APPLY); + Matrix_Translate(gGfxMatrix, sp13C - 14560.0f, bgYpos, -7000.0f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); // Render the textures across the screen (left to right) for (int i = 0; i < 5; i++) { FrameInterpolation_RecordOpenChild("Backdrop", i); FrameInterpolation_RecordMarker(__FILE__, __LINE__); - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) { + if (gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO) { gSPDisplayList(gMasterDisp++, D_AQ_601AFF0); } else { gSPDisplayList(gMasterDisp++, D_AQ_601C080); @@ -726,18 +723,18 @@ void Background_DrawBackdrop(void) { case LEVEL_MACBETH: case LEVEL_TITANIA: camYawDeg = Math_RadToDeg(gPlayer[gPlayerNum].camYaw) - gPlayer[gPlayerNum].yRot_114; - sp134 = (gPlayer[gPlayerNum].camPitch * -7000.0f) - (gPlayer[gPlayerNum].cam.eye.y * 0.6f); + bgYpos = (gPlayer[gPlayerNum].camPitch * -7000.0f) - (gPlayer[gPlayerNum].cam.eye.y * 0.6f); sp13C = camYawDeg * -40.44444f * 2.0f; // close to 7280.0f / 180.0f - if ((gCurrentLevel == LEVEL_TITANIA) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) && + if ((gCurrentLevel == LEVEL_TITANIA) && (gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO) && (gPlayer[0].csState < 3)) { D_bg_8015F968 += __sinf(gPlayer[0].camYaw) * 20.0f; sp13C += D_bg_8015F968; } - if ((gCurrentLevel == LEVEL_SOLAR) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) && + if ((gCurrentLevel == LEVEL_SOLAR) && (gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO) && (gPlayer[0].csState >= 2) && (gPlayer[0].cam.eye.z <= -1900.0f)) { D_bg_8015F968 = __sinf(gPlayer[0].camPitch) * 7000.0f; - sp134 -= fabsf(D_bg_8015F968); + bgYpos -= fabsf(D_bg_8015F968); } sp13C = Math_ModF(sp13C, 7280.0f); @@ -756,11 +753,11 @@ void Background_DrawBackdrop(void) { Matrix_Scale(gGfxMatrix, 1.5f, 1.0f, 1.0f, MTXF_APPLY); if ((gCurrentLevel == LEVEL_TITANIA) || (gCurrentLevel == LEVEL_ZONESS)) { - Matrix_Translate(gGfxMatrix, sp13C - 14560.0f, -3000.0f + sp134, -7000.0f, MTXF_APPLY); + Matrix_Translate(gGfxMatrix, sp13C - 14560.0f, -3000.0f + bgYpos, -7000.0f, MTXF_APPLY); } else if (gCurrentLevel == LEVEL_SOLAR) { - Matrix_Translate(gGfxMatrix, sp13C - 14560.0f, -3500.0f + sp134, -7000.0f, MTXF_APPLY); + Matrix_Translate(gGfxMatrix, sp13C - 14560.0f, -3500.0f + bgYpos, -7000.0f, MTXF_APPLY); } else if (gCurrentLevel == LEVEL_MACBETH) { - Matrix_Translate(gGfxMatrix, sp13C - 14560.0f, -4000.0f + sp134, -7000.0f, MTXF_APPLY); + Matrix_Translate(gGfxMatrix, sp13C - 14560.0f, -4000.0f + bgYpos, -7000.0f, MTXF_APPLY); } Matrix_SetGfxMtx(&gMasterDisp); @@ -804,14 +801,14 @@ void Background_DrawBackdrop(void) { break; case LEVELTYPE_SPACE: - if (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_ENTER_WARP_ZONE) { + if (gPlayer[0].state != PLAYERSTATE_ENTER_WARP_ZONE) { Matrix_Push(&gGfxMatrix); camYawDeg = Math_RadToDeg(gPlayer[0].camYaw); sp130 = Math_RadToDeg(gPlayer[0].camPitch); if (((camYawDeg < 110.0f) || (camYawDeg > 260.0f)) && ((sp130 < 40.0f) || (sp130 > 325.0f))) { RCP_SetupDL_36(); - sp138 = gStarfieldX; /* @port. Range: 0.0f - 960.0f */ - sp134 = gStarfieldY; + bgXpos = gStarfieldX; /* @port. Range: 0.0f - 960.0f */ + bgYpos = gStarfieldY; if (((gCurrentLevel == LEVEL_SECTOR_X) || (gCurrentLevel == LEVEL_METEO)) && (gLevelPhase == 1)) { levelId = LEVEL_WARP_ZONE; @@ -819,36 +816,36 @@ void Background_DrawBackdrop(void) { if (levelId == LEVEL_SECTOR_X) { // @port. Accomodate for expanded aspect ratio - sp138 = Math_ModF(sp138 + 60.0f, (320.0f * 3.0f) + 120.0f); - sp134 = Math_ModF(sp134 + 360.0f - 40.0f, 360.0f); + bgXpos = Math_ModF(bgXpos + 60.0f, (320.0f * 3.0f) + 120.0f); + bgYpos = Math_ModF(bgYpos + 360.0f - 40.0f, 360.0f); } else if (levelId == LEVEL_TRAINING) { // @port. Accomodate for expanded aspect ratio - sp138 = Math_ModF(sp138 - 30.0f, (320.0f * 3.0f) + 120.0f); - sp134 = Math_ModF(sp134 + 360.0f - 40.0f, 360.0f); + bgXpos = Math_ModF(bgXpos - 30.0f, (320.0f * 3.0f) + 120.0f); + bgYpos = Math_ModF(bgYpos + 360.0f - 40.0f, 360.0f); } else if ((levelId == LEVEL_SECTOR_Y) && (gLevelMode == LEVELMODE_ON_RAILS)) { // @port. Accomodate for expanded aspect ratio - sp138 = Math_ModF(sp138 + (320.0f * 3.0f) + 120.0f /* - 60.0f*/, (320.0f * 3.0f) + 120.0f); - sp134 = Math_ModF(sp134, 360.0f); + bgXpos = Math_ModF(bgXpos + (320.0f * 3.0f) + 120.0f /* - 60.0f*/, (320.0f * 3.0f) + 120.0f); + bgYpos = Math_ModF(bgYpos, 360.0f); } else if (levelId == LEVEL_FORTUNA) { // @port. Accomodate for expanded aspect ratio - sp138 = Math_ModF(sp138 - 34.5f, (320.0f * 3.0f) + 120.0f); - sp134 = Math_ModF(sp134 + 19.0f, 360.0f); + bgXpos = Math_ModF(bgXpos - 34.5f, (320.0f * 3.0f) + 120.0f); + bgYpos = Math_ModF(bgYpos + 19.0f, 360.0f); } else if (levelId == LEVEL_BOLSE) { - if ((gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_COMPLETE) || (gPlayer[0].csState < 10)) { - sp134 = Math_ModF(sp134 + 360.0f - 100.0f, 360.0f); + if ((gPlayer[0].state != PLAYERSTATE_LEVEL_COMPLETE) || (gPlayer[0].csState < 10)) { + bgYpos = Math_ModF(bgYpos + 360.0f - 100.0f, 360.0f); } } else { // @port. Accomodate for expanded aspect ratio - sp138 = Math_ModF(sp138, (320.0f * 3.0f) + 120.0f); - sp134 = Math_ModF(sp134, 360.0f); + bgXpos = Math_ModF(bgXpos, (320.0f * 3.0f) + 120.0f); + bgYpos = Math_ModF(bgYpos, 360.0f); } - if ((camYawDeg < 180.0f) && (sp138 > 380.0f)) { + if ((camYawDeg < 180.0f) && (bgXpos > 380.0f)) { // @port. Accomodate for expanded aspect ratio - sp138 = -((320.0f * 3.0f) - sp138); + bgXpos = -((320.0f * 3.0f) - bgXpos); } - if ((sp130 > 180.0f) && (sp134 > 280.0f)) { - sp134 = -(360.0f - sp134); + if ((sp130 > 180.0f) && (bgYpos > 280.0f)) { + bgYpos = -(360.0f - bgYpos); } // @port: Tag the transform. @@ -858,7 +855,7 @@ void Background_DrawBackdrop(void) { switch (levelId) { case LEVEL_SECTOR_Z: - Matrix_Translate(gGfxMatrix, sp138 - 120.0f, -(sp134 - 120.0f), -290.0f, MTXF_APPLY); + Matrix_Translate(gGfxMatrix, bgXpos - 120.0f, -(bgYpos - 120.0f), -290.0f, MTXF_APPLY); Matrix_Scale(gGfxMatrix, 0.5f, 0.5f, 0.5f, MTXF_APPLY); Matrix_RotateX(gGfxMatrix, M_PI / 2, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); @@ -869,7 +866,7 @@ void Background_DrawBackdrop(void) { if ((s32) gWarpZoneBgAlpha != 0) { RCP_SetupDL_62(); gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, (s32) gWarpZoneBgAlpha); - Matrix_Translate(gGfxMatrix, sp138 - 120.0f, -(sp134 - 120.0f), -290.0f, MTXF_APPLY); + Matrix_Translate(gGfxMatrix, bgXpos - 120.0f, -(bgYpos - 120.0f), -290.0f, MTXF_APPLY); Matrix_Scale(gGfxMatrix, 1.7f, 1.7f, 1.0f, MTXF_APPLY); Matrix_Push(&gGfxMatrix); Matrix_RotateZ(gGfxMatrix, -(f32) gGameFrameCount * 10.0f * M_DTOR, MTXF_APPLY); @@ -883,14 +880,14 @@ void Background_DrawBackdrop(void) { break; case LEVEL_METEO: - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) && (gCsFrameCount > 260)) { - Matrix_Translate(gGfxMatrix, sp138 - 120.0f, -(sp134 - 120.0f) - 30.0f, -290.0f, + if ((gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE) && (gCsFrameCount > 260)) { + Matrix_Translate(gGfxMatrix, bgXpos - 120.0f, -(bgYpos - 120.0f) - 30.0f, -290.0f, MTXF_APPLY); Matrix_Scale(gGfxMatrix, 0.5f, 0.5f, 1.0f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); gSPDisplayList(gMasterDisp++, D_ME_600DDF0); } else if (gPathProgress > 185668.0f) { - Matrix_Translate(gGfxMatrix, sp138 - 120.0f, -(sp134 - 120.0f) - 130.0f, -290.0f, + Matrix_Translate(gGfxMatrix, bgXpos - 120.0f, -(bgYpos - 120.0f) - 130.0f, -290.0f, MTXF_APPLY); Matrix_Scale(gGfxMatrix, 0.4f, 0.4f, 1.0f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); @@ -900,7 +897,7 @@ void Background_DrawBackdrop(void) { case LEVEL_SECTOR_X: if (gSceneSetup == 0) { - Matrix_Translate(gGfxMatrix, sp138 - 120.0f, -(sp134 - 120.0f), -290.0f, MTXF_APPLY); + Matrix_Translate(gGfxMatrix, bgXpos - 120.0f, -(bgYpos - 120.0f), -290.0f, MTXF_APPLY); Matrix_Scale(gGfxMatrix, 3.0f, 3.0f, 1.0f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); RCP_SetupDL_62(); @@ -910,7 +907,7 @@ void Background_DrawBackdrop(void) { break; case LEVEL_TRAINING: - Matrix_Translate(gGfxMatrix, sp138 - 120.0f, -(sp134 - 120.0f), -290.0f, MTXF_APPLY); + Matrix_Translate(gGfxMatrix, bgXpos - 120.0f, -(bgYpos - 120.0f), -290.0f, MTXF_APPLY); Matrix_Scale(gGfxMatrix, 0.2f, 0.2f, 1.0f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); RCP_SetupDL_62(); @@ -924,13 +921,13 @@ void Background_DrawBackdrop(void) { if (scale > 3.5f) { scale = 3.5f; } - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) { + if (gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE) { scale = D_bg_8015F984; if (scale > 3.5f) { scale = 3.5f; } } - Matrix_Translate(gGfxMatrix, sp138 - 120.0f, -(sp134 - 120.0f), -290.0f, MTXF_APPLY); + Matrix_Translate(gGfxMatrix, bgXpos - 120.0f, -(bgYpos - 120.0f), -290.0f, MTXF_APPLY); Matrix_Scale(gGfxMatrix, scale * 0.75, scale * 0.75f, 1.0f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); gSPDisplayList(gMasterDisp++, D_A6_601BB40); @@ -946,7 +943,7 @@ void Background_DrawBackdrop(void) { if ((gCsFrameCount > 500 /*400*/) && (gMissionStatus == MISSION_COMPLETE)) { scale = 0.75f; } - Matrix_Translate(gGfxMatrix, sp138 - 120.0f, -(sp134 - 120.0f), -290.0f, MTXF_APPLY); + Matrix_Translate(gGfxMatrix, bgXpos - 120.0f, -(bgYpos - 120.0f), -290.0f, MTXF_APPLY); Matrix_Scale(gGfxMatrix, scale, scale, scale, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); gSPDisplayList(gMasterDisp++, D_FO_600B4B0); @@ -954,17 +951,17 @@ void Background_DrawBackdrop(void) { case LEVEL_BOLSE: scale = 1.0f; - if ((gCsFrameCount > 500) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE)) { + if ((gCsFrameCount > 500) && (gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE)) { scale = 1.3f; } - Matrix_Translate(gGfxMatrix, sp138 - 120.0f, -(sp134 - 120.0f), -290.0f, MTXF_APPLY); + Matrix_Translate(gGfxMatrix, bgXpos - 120.0f, -(bgYpos - 120.0f), -290.0f, MTXF_APPLY); Matrix_Scale(gGfxMatrix, scale, scale, scale, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); gSPDisplayList(gMasterDisp++, D_BO_600D190); break; case LEVEL_SECTOR_Y: - Matrix_Translate(gGfxMatrix, sp138 - 120.0f, -(sp134 - 120.0f), -290.0f, MTXF_APPLY); + Matrix_Translate(gGfxMatrix, bgXpos - 120.0f, -(bgYpos - 120.0f), -290.0f, MTXF_APPLY); Matrix_Scale(gGfxMatrix, 0.4f, 0.4f, 1.0f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); RCP_SetupDL_62(); @@ -1024,9 +1021,10 @@ void Background_DrawSun(void) { if (gPlayerGlareAlphas[gPlayerNum] > 300) { gPlayerGlareAlphas[gPlayerNum] = 0; } - if (((gCurrentLevel == LEVEL_AQUAS) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO)) || - (((gPlayer[gPlayerNum].state_1C8 == PLAYERSTATE_1C8_U_TURN) || (gLevelMode == LEVELMODE_ALL_RANGE) || - (gPlayer[gPlayerNum].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE)) && + + if (((gCurrentLevel == LEVEL_AQUAS) && (gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO)) || + (((gPlayer[gPlayerNum].state == PLAYERSTATE_U_TURN) || (gLevelMode == LEVELMODE_ALL_RANGE) || + (gPlayer[gPlayerNum].state == PLAYERSTATE_LEVEL_COMPLETE)) && (gLevelType == LEVELTYPE_PLANET) && (gCurrentLevel != LEVEL_TITANIA) && (gCurrentLevel != LEVEL_AQUAS))) { gPlayerGlareReds[gPlayerNum] = 128; gPlayerGlareGreens[gPlayerNum] = 128; @@ -1107,6 +1105,7 @@ void Background_DrawLensFlare(void) { Matrix_RotateZ(gGfxMatrix, gPlayer[gPlayerNum].camRoll * M_DTOR, MTXF_APPLY); Matrix_Translate(gGfxMatrix, gSunViewX, gSunViewY, -200.0f, MTXF_APPLY); RCP_SetupDL_62(); + lensFlareOffsetX = gSunViewX * -0.03f; lensFlareOffsetY = gSunViewY * 0.03f; lensFlareColor = &sSunColors[5]; @@ -1591,9 +1590,9 @@ void Background_DrawGround(void) { RCP_SetupDL(&gMasterDisp, SETUPDL_37); } - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) && (gPlayer[0].csState < 2)) { + if ((gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO) && (gPlayer[0].csState < 2)) { gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 255); - } else if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) { + } else if (gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE) { gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, D_bg_8015F974, D_bg_8015F978, D_bg_8015F97C, D_bg_8015F980); } else { @@ -2044,26 +2043,39 @@ void Background_DrawGround(void) { Matrix_Pop(&gGfxMatrix); } +// Unused. Early water implementation in Aquas? void func_bg_80042D38(void) { f32 xEye; f32 zEye; - if (!gPlayer[gPlayerNum].cam.eye.x) {} - if (!gPlayer[gPlayerNum].cam.eye.y) {} // all sorts of fake + // all sorts of fake + + if (gPlayer[gPlayerNum].cam.eye.x == 0.0f) { + // Commented out code? + } + if (gPlayer[gPlayerNum].cam.eye.z == 0.0f) { + // Commented out code? + } Matrix_Push(&gGfxMatrix); + xEye = gPlayer[gPlayerNum].cam.eye.x; - if (0) {} + if (0) {} //! FAKE zEye = gPlayer[gPlayerNum].cam.eye.z; + Matrix_Translate(gGfxMatrix, xEye, 2.0f + gCameraShakeY, zEye, MTXF_APPLY); Matrix_Scale(gGfxMatrix, 1.5f, 1.0f, 1.0f, MTXF_APPLY); + RCP_SetupDL_37(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar); gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 125); + Matrix_SetGfxMtx(&gMasterDisp); + if ((gGameFrameCount % 2) != 0) { gSPDisplayList(gMasterDisp++, D_AQ_602C030); } else { gSPDisplayList(gMasterDisp++, D_AQ_602C088); } + Matrix_Pop(&gGfxMatrix); } diff --git a/src/engine/fox_boss.c b/src/engine/fox_boss.c index 8243257d..53e2879c 100644 --- a/src/engine/fox_boss.c +++ b/src/engine/fox_boss.c @@ -114,7 +114,7 @@ void Boss_CompleteLevel(Player* player, f32 xPos, f32 yPos, f32 zPos) { gBossDeathCamAtX = xPos; gBossDeathCamAtY = yPos; - player->state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + player->state = PLAYERSTATE_LEVEL_COMPLETE; player->csState = 10; player->csTimer = 50; player->csEventTimer = 50; diff --git a/src/engine/fox_demo.c b/src/engine/fox_demo.c index 5543f284..41385906 100644 --- a/src/engine/fox_demo.c +++ b/src/engine/fox_demo.c @@ -216,7 +216,7 @@ void Cutscene_WarpZoneComplete(Player* player) { gFillScreenRed = gFillScreenGreen = gFillScreenBlue = 0; gFillScreenAlphaStep = 8; if (gFillScreenAlpha == 255) { - player->state_1C8 = PLAYERSTATE_1C8_NEXT; + player->state = PLAYERSTATE_NEXT; player->csTimer = 0; gFadeoutType = 4; if (gCurrentLevel == LEVEL_METEO) { @@ -570,7 +570,7 @@ void Cutscene_EnterWarpZone(Player* player) { if (player->csTimer == 0) { gWarpZoneBgAlpha = 0.0f; gStarWarpDistortion = 0.0f; - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; player->unk_014 = 0.0f; player->unk_018 = 0.0f; gDrawSmallRocks = 0; @@ -836,7 +836,7 @@ void Cutscene_AllRangeMode(Player* player) { } if (D_ctx_80177A48[1] > 350.0f) { - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; player->unk_014 = 0.0f; player->unk_018 = 0.1f; player->unk_194 = 10.0f; @@ -1249,7 +1249,7 @@ void Cutscene_CoComplete2(Player* player) { gCsCamAtZ += D_ctx_80177A48[9]; player->draw = false; if (player->csTimer == 0) { - player->state_1C8 = PLAYERSTATE_1C8_NEXT; + player->state = PLAYERSTATE_NEXT; player->csTimer = 0; gFadeoutType = 4; Audio_FadeOutAll(10); @@ -1519,7 +1519,7 @@ void Cutscene_UTurn(Player* player) { } if (player->csTimer == 0) { - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; player->unk_014 = 0.0f; player->unk_018 = 0.0f; } @@ -1576,7 +1576,7 @@ void Cutscene_KillPlayer(Player* player) { Audio_StopPlayerNoise(player->num); Audio_KillSfxBySourceAndId(player->sfxSource, NA_SE_ARWING_DOWN); Player_PlaySfx(player->sfxSource, NA_SE_ARWING_EXPLOSION, player->num); - player->state_1C8 = PLAYERSTATE_1C8_NEXT; + player->state = PLAYERSTATE_NEXT; player->csTimer = 70; player->dmgEffectTimer = 20; gFadeoutType = 7; @@ -2134,7 +2134,7 @@ void func_demo_8004F05C(ActorCutscene* this) { case LEVEL_BOLSE: switch (this->animFrame) { case ACTOR_CS_TEAM_ARWING: - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) { + if (gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO) { this->rot_0F4.z += this->rot_0F4.y; this->vel.x = SIN_DEG(this->rot_0F4.z) * 10.0f; this->obj.rot.z = SIN_DEG(this->rot_0F4.z) * 40.0f; @@ -2313,8 +2313,8 @@ void ActorCutscene_Update(ActorCutscene* this) { return; } - switch (gPlayer[0].state_1C8) { - case PLAYERSTATE_1C8_LEVEL_COMPLETE: + switch (gPlayer[0].state) { + case PLAYERSTATE_LEVEL_COMPLETE: switch (gCurrentLevel) { case LEVEL_SECTOR_Y: if (gPlayer[0].csState >= 3) { @@ -2432,15 +2432,15 @@ void ActorCutscene_Update(ActorCutscene* this) { } break; - case PLAYERSTATE_1C8_LEVEL_INTRO: + case PLAYERSTATE_LEVEL_INTRO: func_demo_8004F05C(this); break; - case PLAYERSTATE_1C8_ENTER_WARP_ZONE: + case PLAYERSTATE_ENTER_WARP_ZONE: func_demo_8004F798(this); break; - case PLAYERSTATE_1C8_STANDBY: + case PLAYERSTATE_STANDBY: if (gCurrentLevel == LEVEL_SECTOR_Y) { SectorY_8019FF00(this); } @@ -2533,7 +2533,7 @@ void ActorCutscene_Draw(ActorCutscene* this) { f32 x; switch (this->animFrame) { - case ACTOR_CS_1000: + case ACTOR_CS_JAMES_ARWING: RCP_SetupDL(&gMasterDisp, SETUPDL_45); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, this->work_046); gSPDisplayList(gMasterDisp++, D_ENMY_PLANET_40018A0); @@ -2655,7 +2655,7 @@ void ActorCutscene_Draw(ActorCutscene* this) { break; } - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) { + if (gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO) { Matrix_Push(&gGfxMatrix); Matrix_RotateX(gGfxMatrix, 20.0f * M_DTOR, MTXF_APPLY); Matrix_RotateY(gGfxMatrix, (gGameFrameCount * 0.5f) * M_DTOR, MTXF_APPLY); @@ -2709,7 +2709,7 @@ void ActorCutscene_Draw(ActorCutscene* this) { gDPSetPrimColor(gMasterDisp++, 0, 0, (s32) D_800CA210, (s32) D_800CA214, (s32) D_800CA218, 128); - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) { + if (gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO) { Matrix_Scale(gGfxMatrix, 1.02f, 1.02f, 1.02f, MTXF_APPLY); } else { Matrix_Scale(gGfxMatrix, 0.97f, 0.97f, 0.97f, MTXF_APPLY); @@ -2724,7 +2724,7 @@ void ActorCutscene_Draw(ActorCutscene* this) { Matrix_Pop(&gGfxMatrix); Matrix_Pop(&gGfxMatrix); - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) { + if (gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE) { Matrix_Scale(gGfxMatrix, 0.075f, 0.075f, 0.075f, MTXF_APPLY); break; } @@ -2742,7 +2742,7 @@ void ActorCutscene_Draw(ActorCutscene* this) { break; case ACTOR_CS_CORNERIAN_FIGHTER: - if ((this->index == 3) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE)) { + if ((this->index == 3) && (gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE)) { gSPDisplayList(gMasterDisp++, aBillShipDL); } else { gSPDisplayList(gMasterDisp++, aKaCornerianFighterDL); @@ -2780,7 +2780,7 @@ void ActorCutscene_Draw(ActorCutscene* this) { gSPDisplayList(gMasterDisp++, aOrbDL); break; - case ACTOR_CS_38: + case ACTOR_CS_SY_ROBOT: animFrameData = Animation_GetFrameData(D_demo_800CA1F4[this->iwork[4]], this->iwork[5], sp144); Math_SmoothStepToVec3fArray(sp144, this->vwork, 1, animFrameData, this->fwork[2], 100.0f, .0f); RCP_SetupDL_30(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar); @@ -2933,7 +2933,7 @@ void Cutscene_DrawGreatFox(void) { } if ((gCurrentLevel != LEVEL_AQUAS) && - ((gCurrentLevel != LEVEL_SECTOR_Z) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE))) { + ((gCurrentLevel != LEVEL_SECTOR_Z) || (gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE))) { RCP_SetupDL_49(); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); for (i = 0, var_s6_2 = D_demo_800CA0BC; i < ARRAY_COUNT(sp9C); i++, var_s6_2++) { diff --git a/src/engine/fox_display.c b/src/engine/fox_display.c index b0bf6289..786f2970 100644 --- a/src/engine/fox_display.c +++ b/src/engine/fox_display.c @@ -45,7 +45,7 @@ void Display_DrawHelpAlert(void) { return; } - if ((gTeamHelpActor->obj.status != OBJ_ACTIVE) || (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_ACTIVE)) { + if ((gTeamHelpActor->obj.status != OBJ_ACTIVE) || (gPlayer[0].state != PLAYERSTATE_ACTIVE)) { gTeamHelpActor = NULL; gTeamHelpTimer = 0; return; @@ -274,7 +274,7 @@ void Display_OnFootMuzzleFlash(Player* player) { FrameInterpolation_RecordOpenChild("Display_OnFootMuzzleFlash", player->num); Matrix_Copy(gGfxMatrix, &gIdentityMatrix); - if ((player->state_1C8 == PLAYERSTATE_1C8_ACTIVE) && (player->csTimer != 0)) { + if ((player->state == PLAYERSTATE_ACTIVE) && (player->csTimer != 0)) { Matrix_Translate(gGfxMatrix, D_display_801613B0[player->num].x, D_display_801613B0[player->num].y, D_display_801613B0[player->num].z, MTXF_APPLY); Matrix_Scale(gGfxMatrix, D_display_800CA23C[player->csTimer - 1], D_display_800CA23C[player->csTimer - 1], @@ -377,7 +377,7 @@ void Display_LandmasterMuzzleFlash(Player* player) { // @port: Tag the transform. FrameInterpolation_RecordOpenChild("Display_LandmasterMuzzleFlash", player->num); - if ((player->state_1C8 == PLAYERSTATE_1C8_ACTIVE) && (player->unk_1A0 != 0)) { + if ((player->state == PLAYERSTATE_ACTIVE) && (player->unk_1A0 != 0)) { Matrix_Translate(gGfxMatrix, D_display_80161548[player->num].x, D_display_80161548[player->num].y, D_display_80161548[player->num].z, MTXF_APPLY); Matrix_Scale(gGfxMatrix, D_display_800CA248[player->unk_1A0 - 1], D_display_800CA248[player->unk_1A0 - 1], @@ -661,7 +661,7 @@ void Display_ArwingWings(ArwingInfo* arwing) { Matrix_SetGfxMtx(&gMasterDisp); RCP_SetupDL_64_2(); - if ((gGameState == GSTATE_PLAY) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) && + if ((gGameState == GSTATE_PLAY) && (gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO) && (gCurrentLevel == LEVEL_CORNERIA)) { gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 120); gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); @@ -762,14 +762,14 @@ void Display_Arwing(Player* player, s32 reflectY) { } } +// Arwing only void Display_Reticle(Player* player) { Vec3f* translate; s32 i; if ((gPlayerNum == player->num) && ((player->form == FORM_ARWING) || (player->form == FORM_LANDMASTER)) && player->draw && - (((gGameState == GSTATE_PLAY) && (player->state_1C8 == PLAYERSTATE_1C8_ACTIVE)) || - (gGameState == GSTATE_MENU))) { + (((gGameState == GSTATE_PLAY) && (player->state == PLAYERSTATE_ACTIVE)) || (gGameState == GSTATE_MENU))) { for (i = 0; i < 2; i++) { FrameInterpolation_RecordOpenChild("Reticle", (player->num << 16) + i); FrameInterpolation_RecordMarker(__FILE__, __LINE__); @@ -869,7 +869,7 @@ void Display_PlayerShadow_Draw(Player* player) { Matrix_RotateX(gGfxMatrix, M_PI / 2, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); - gSPDisplayList(gMasterDisp++, aRadarMarkKaSaucererDL); + gSPDisplayList(gMasterDisp++, aBallDL); gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); Matrix_Pop(&gGfxMatrix); break; @@ -1214,7 +1214,7 @@ void Display_PlayerFeatures(Player* player) { f32 var_fv0; s32 pad[3]; - if (player->draw && (player->state_1C8 != PLAYERSTATE_1C8_DOWN)) { + if (player->draw && (player->state != PLAYERSTATE_DOWN)) { switch (player->form) { case FORM_ARWING: Matrix_RotateY(gCalcMatrix, (player->yRot_114 + player->rot.y + player->damageShake + 180.0f) * M_DTOR, @@ -1292,7 +1292,7 @@ void Display_ArwingWingTrail_Draw(Player* player) { yRot *= 0.25f; sp50 = player->rot.x * 0.25f; - if (player->state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) { + if (player->state == PLAYERSTATE_LEVEL_COMPLETE) { yRot = 0.0f; sp50 = 0.0f; } @@ -1313,7 +1313,7 @@ void Display_ArwingWingTrail_Draw(Player* player) { Matrix_RotateX(gGfxMatrix, M_PI / 2, MTXF_APPLY); Matrix_RotateY(gGfxMatrix, M_DTOR * sp54, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, aRadarMarkKaSaucererDL); + gSPDisplayList(gMasterDisp++, aBallDL); Matrix_Pop(&gGfxMatrix); } @@ -1333,7 +1333,7 @@ void Display_ArwingWingTrail_Draw(Player* player) { Matrix_RotateX(gGfxMatrix, M_PI / 2, MTXF_APPLY); Matrix_RotateY(gGfxMatrix, M_DTOR * sp54, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, aRadarMarkKaSaucererDL); + gSPDisplayList(gMasterDisp++, aBallDL); Matrix_Pop(&gGfxMatrix); } @@ -1781,7 +1781,7 @@ void Display_Update(void) { #endif Matrix_Push(&gGfxMatrix); - if ((gCurrentLevel == LEVEL_AQUAS) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE)) { + if ((gCurrentLevel == LEVEL_AQUAS) && (gPlayer[0].state == PLAYERSTATE_ACTIVE)) { Math_SmoothStepToF(&gCamDistortion, 0.01f, 0.2f, 0.002f, 0.0f); } else { Math_SmoothStepToF(&gCamDistortion, 0.0f, 0.2f, 0.002f, 0.0f); @@ -1822,7 +1822,7 @@ void Display_Update(void) { if (camPlayer->alternateView && (camPlayer->boostSpeed > 5.0f)) { gPlayCamAt.x += SIN_DEG(gGameFrameCount * 150.0f) * camPlayer->boostSpeed * 0.2f; } - } else if (camPlayer->state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) { + } else if (camPlayer->state == PLAYERSTATE_LEVEL_COMPLETE) { Display_CsLevelCompleteHandleCamera(camPlayer); } else { gPlayCamEye.x = camPlayer->cam.eye.x; @@ -1859,7 +1859,7 @@ void Display_Update(void) { if ((gLevelType == LEVELTYPE_PLANET) || (gCurrentLevel == LEVEL_BOLSE)) { if ((gCurrentLevel == LEVEL_TITANIA) && - ((gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_INTRO) || (gPlayer[0].unk_19C != 0))) { + ((gPlayer[0].state != PLAYERSTATE_LEVEL_INTRO) || (gPlayer[0].unk_19C != 0))) { Matrix_Push(&gGfxMatrix); Matrix_Translate(gGfxMatrix, 0.0f, gCameraShakeY, 0.0f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); @@ -1889,7 +1889,7 @@ void Display_Update(void) { Display_SetupPlayerSfxPos(player); } - if ((gGroundSurface == SURFACE_WATER) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_INTRO)) { + if ((gGroundSurface == SURFACE_WATER) && (gPlayer[0].state != PLAYERSTATE_LEVEL_INTRO)) { Lights_SetOneLight(&gMasterDisp, gLight2x, -1 * gLight2y, gLight2z, gLight2R, gLight2G, gLight2B, gAmbientR, gAmbientG, gAmbientB); Matrix_Push(&gGfxMatrix); @@ -1911,7 +1911,8 @@ void Display_Update(void) { TexturedLine_Draw(); gReflectY = 1; PlayerShot_DrawAll(); - if ((gGroundSurface == SURFACE_WATER) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_INTRO)) { + + if ((gGroundSurface == SURFACE_WATER) && (gPlayer[0].state != PLAYERSTATE_LEVEL_INTRO)) { Matrix_Push(&gGfxMatrix); Matrix_Scale(gGfxMatrix, 1.0f, -1.0f, 1.0f, MTXF_APPLY); gReflectY = -1; @@ -1921,7 +1922,7 @@ void Display_Update(void) { gReflectY = -1; - if ((gGroundSurface == SURFACE_WATER) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_INTRO)) { + if ((gGroundSurface == SURFACE_WATER) && (gPlayer[0].state != PLAYERSTATE_LEVEL_INTRO)) { Matrix_Push(&gGfxMatrix); Matrix_Scale(gGfxMatrix, 1.0f, -1.0f, 1.0f, MTXF_APPLY); for (i = 0, player = &gPlayer[0]; i < gCamCount; i++, player++) { @@ -1947,8 +1948,7 @@ void Display_Update(void) { if ((gCurrentLevel != LEVEL_AQUAS) && (((gCurrentLevel != LEVEL_CORNERIA) && (gCurrentLevel != LEVEL_VENOM_ANDROSS)) || - ((gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_COMPLETE) && - (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_INTRO)))) { + ((gPlayer[0].state != PLAYERSTATE_LEVEL_COMPLETE) && (gPlayer[0].state != PLAYERSTATE_LEVEL_INTRO)))) { Effect_Draw(0); } @@ -1965,13 +1965,12 @@ void Display_Update(void) { } } - if ((gCurrentLevel == LEVEL_AQUAS) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE)) { + if ((gCurrentLevel == LEVEL_AQUAS) && (gPlayer[0].state == PLAYERSTATE_ACTIVE)) { Aquas_801AA20C(); } if (((gCurrentLevel == LEVEL_CORNERIA) || (gCurrentLevel == LEVEL_VENOM_ANDROSS)) && - ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) || - (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO))) { + ((gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE) || (gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO))) { Effect_Draw(0); } @@ -1997,14 +1996,13 @@ void Display_Update(void) { } } - if ((gLevelMode == LEVELMODE_TURRET) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE)) { + if ((gLevelMode == LEVELMODE_TURRET) && (gPlayer[0].state == PLAYERSTATE_ACTIVE)) { Turret_Draw(gPlayer); } Background_DrawLensFlare(); - if ((gCamCount != 1) && - ((camPlayer->state_1C8 == PLAYERSTATE_1C8_ACTIVE) || (camPlayer->state_1C8 == PLAYERSTATE_1C8_U_TURN))) { + if ((gCamCount != 1) && ((camPlayer->state == PLAYERSTATE_ACTIVE) || (camPlayer->state == PLAYERSTATE_U_TURN))) { HUD_Draw(); HUD_EdgeArrows_Update(); } @@ -2051,7 +2049,7 @@ void Display_Update(void) { gFillScreenRed = gFillScreenGreen = gFillScreenBlue = 0; gFillScreenAlphaStep = 8; gShowLevelClearStatusScreen = false; - pl->state_1C8 = PLAYERSTATE_1C8_NEXT; + pl->state = PLAYERSTATE_NEXT; pl->csTimer = 0; gFadeoutType = 4; } @@ -2067,14 +2065,14 @@ void Display_Update(void) { } if (gCurrentLevel == LEVEL_SECTOR_X) { gRingPassCount++; - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_ENTER_WARP_ZONE; + gPlayer[0].state = PLAYERSTATE_ENTER_WARP_ZONE; gPlayer[0].csState = 0; gSceneSetup = 1; AUDIO_PLAY_SFX(NA_SE_WARP_HOLE, gDefaultSfxSource, 0); gMissionStatus = MISSION_WARP; gLeveLClearStatus[gCurrentLevel] = 1; } else { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_ENTER_WARP_ZONE; + gPlayer[0].state = PLAYERSTATE_ENTER_WARP_ZONE; gPlayer[0].csState = 0; AUDIO_PLAY_SFX(NA_SE_WARP_HOLE, gDefaultSfxSource, 0); gMissionStatus = MISSION_WARP; @@ -2097,7 +2095,7 @@ void Display_Update(void) { } if (gControllerPress[0].button & L_TRIG) { - pl->state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + pl->state = PLAYERSTATE_LEVEL_COMPLETE; gMissionStatus = MISSION_ACCOMPLISHED; } } @@ -2106,7 +2104,7 @@ void Display_Update(void) { Player* pl2 = &gPlayer[0]; if ((gLevelMode != LEVELMODE_ALL_RANGE) && (gControllerPress[0].button & L_TRIG)) { - pl2->state_1C8 = PLAYERSTATE_1C8_START_360; + pl2->state = PLAYERSTATE_START_360; } } diff --git a/src/engine/fox_edata_info.c b/src/engine/fox_edata_info.c index 71b324cf..19853ce6 100644 --- a/src/engine/fox_edata_info.c +++ b/src/engine/fox_edata_info.c @@ -306,8 +306,8 @@ ObjectInfo gObjectInfo[] = { /* OBJ_ACTOR_ME_LASER_CANNON_2 */ {(void*) aMeLaserCannon2DL, 0, (ObjectFunc) Meteo_MeLaserCannon2_Update, aMeLaserCannon2Hitbox, 200.0f, 0, 1, 39, 0, 1.0f, 1 }, /* OBJ_ACTOR_AQ_UNK_188 */ {(void*) Aquas_Actor188_Draw, 1, (ObjectFunc) Aquas_Actor188_Update, aAqActor188Hitbox, 200.0f, 0, 1, 39, 0, 1.0f, 1 }, /* OBJ_ACTOR_DEBRIS */ {(void*) ActorDebris_Draw, 1, (ObjectFunc) ActorDebris_Update, gNoHitbox, 0.0f, 0, 0, 39, 0, 0.0f, 0 }, - /* OBJ_MISSILE_SEEK_TEAM */ {(void*) ActorMissileSeek_Draw, 1, (ObjectFunc) ActorMissileSeek_Update, gActorMissileSeekHitbox, 100.0f, 0, 1, 39, 0, 1.0f, 0 }, - /* OBJ_MISSILE_SEEK_PLAYER */ {(void*) ActorMissileSeek_Draw, 1, (ObjectFunc) ActorMissileSeek_Update, gActorMissileSeekHitbox, 100.0f, 0, 1, 39, 0, 1.0f, 0 }, + /* OBJ_ACTOR_MISSILE_SEEK_TEAM */ {(void*) ActorMissileSeek_Draw, 1, (ObjectFunc) ActorMissileSeek_Update, gActorMissileSeekHitbox, 100.0f, 0, 1, 39, 0, 1.0f, 0 }, + /* OBJ_ACTOR_MISSILE_SEEK_PLAYER */ {(void*) ActorMissileSeek_Draw, 1, (ObjectFunc) ActorMissileSeek_Update, gActorMissileSeekHitbox, 100.0f, 0, 1, 39, 0, 1.0f, 0 }, /* OBJ_ACTOR_CO_SKIBOT */ {(void*) CoSkibot_Draw, 1, (ObjectFunc) CoSkibot_Update, aCoActorSkibotHitbox, 200.0f, 0, 1, 39, 0, 50.0f, 1 }, /* OBJ_ACTOR_CO_RADAR */ {(void*) CoRadar_Draw, 1, (ObjectFunc) CoRadar_Update, aCoActorRadarHitbox, 100.0f, 0, 1, 39, 0, 0.0f, 0 }, /* OBJ_ACTOR_ME_MORA */ {(void*) MeMora_Draw, 1, (ObjectFunc) MeMora_Update, gMeMoraHitbox, 200.0f, 0, 1, 39, 0, 0.0f, 1 }, diff --git a/src/engine/fox_edisplay.c b/src/engine/fox_edisplay.c index 77c633a6..0fc6f88d 100644 --- a/src/engine/fox_edisplay.c +++ b/src/engine/fox_edisplay.c @@ -1,3 +1,8 @@ +/* + * File: fox_edisplay.c + * Description: Object Draw routines + */ + #include "prevent_bss_reordering.h" #include "global.h" #include "sf64object.h" @@ -40,8 +45,8 @@ void Object_ApplyWaterDistortion(void) { Matrix_SetGfxMtx(&gMasterDisp); } -void Object_SetCullDirection(s32 arg0) { - if (arg0 < 0) { +void Object_SetCullDirection(s32 cullDirection) { + if (cullDirection < 0) { gSPSetGeometryMode(gMasterDisp++, G_CULL_FRONT); gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); } @@ -510,7 +515,7 @@ void Actor_DrawEngineAndContrails(Actor* this) { Matrix_RotateX(gGfxMatrix, M_PI / 2, MTXF_APPLY); Matrix_RotateY(gGfxMatrix, M_DTOR * sp54, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, aRadarMarkKaSaucererDL); + gSPDisplayList(gMasterDisp++, aBallDL); Matrix_Pop(&gGfxMatrix); Matrix_Push(&gGfxMatrix); Matrix_Translate(gGfxMatrix, -70.0f, -10.0f, -100.0f, MTXF_APPLY); @@ -519,7 +524,7 @@ void Actor_DrawEngineAndContrails(Actor* this) { Matrix_RotateX(gGfxMatrix, M_PI / 2, MTXF_APPLY); Matrix_RotateY(gGfxMatrix, M_DTOR * sp54, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, aRadarMarkKaSaucererDL); + gSPDisplayList(gMasterDisp++, aBallDL); Matrix_Pop(&gGfxMatrix); } } @@ -558,15 +563,15 @@ void ActorTeamArwing_Draw(ActorTeamArwing* this) { Matrix_MultVec3f(gGfxMatrix, &src, &dest); if (((/*(fabsf(dest.z) < 3000.0f) && (fabsf(dest.x) < 3000.0f) &&*/ !gBossActive) || - (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_STANDBY) || (gCurrentLevel == LEVEL_VENOM_ANDROSS) || - (gCurrentLevel == LEVEL_VENOM_2) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE)) && + (gPlayer[0].state == PLAYERSTATE_STANDBY) || (gCurrentLevel == LEVEL_VENOM_ANDROSS) || + (gCurrentLevel == LEVEL_VENOM_2) || (gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE)) && (gCurrentLevel != LEVEL_MACBETH) && (gCurrentLevel != LEVEL_TITANIA)) { if (this->obj.id == OBJ_ACTOR_CUTSCENE) { - if (((gCurrentLevel == LEVEL_VENOM_2) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) && + if (((gCurrentLevel == LEVEL_VENOM_2) && (gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE) && (this->index == 10)) || - ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) && (gPlayer[0].csState >= 100) && + ((gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE) && (gPlayer[0].csState >= 100) && (gCurrentLevel == LEVEL_KATINA) && (this->index == 1)) || - ((gCurrentLevel == LEVEL_SECTOR_Y) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_STANDBY) && + ((gCurrentLevel == LEVEL_SECTOR_Y) && (gPlayer[0].state == PLAYERSTATE_STANDBY) && (this->state == 5))) { gActorTeamArwing.rightWingState = gPlayer[0].arwing.rightWingState; gActorTeamArwing.leftWingState = gPlayer[0].arwing.leftWingState; @@ -584,7 +589,7 @@ void ActorTeamArwing_Draw(ActorTeamArwing* this) { gActorTeamArwing.laserGunsYpos = gActorTeamArwing.laserGunsXpos = gActorTeamArwing.wingsXrot = gActorTeamArwing.wingsYrot = gActorTeamArwing.cockpitGlassXrot = gActorTeamArwing.wingsZrot = 0.0f; gActorTeamArwing.unk_28 = this->fwork[17]; - gActorTeamArwing.drawFace = this->iwork[14]; + gActorTeamArwing.drawFace = this->iwork[TEAM_FACE]; gActorTeamArwing.teamFaceXrot = this->fwork[20]; gActorTeamArwing.teamFaceYrot = this->fwork[19]; @@ -681,7 +686,7 @@ void Object_SetShadowDL(ObjectId objId, s32 index) { Matrix_Scale(gGfxMatrix, 1.2f, 0.0f, 1.2f, MTXF_APPLY); Matrix_RotateX(gGfxMatrix, M_PI / 2, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, aRadarMarkKaSaucererDL); + gSPDisplayList(gMasterDisp++, aBallDL); } RCP_SetupDL(&gMasterDisp, SETUPDL_64); break; @@ -725,13 +730,13 @@ void Object_SetShadowDL(ObjectId objId, s32 index) { break; case OBJ_BOSS_KA_SAUCERER: - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_STANDBY) { + if (gPlayer[0].state == PLAYERSTATE_STANDBY) { RCP_SetupDL(&gMasterDisp, SETUPDL_64); gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 0, 0, 0, 200); } Matrix_RotateX(gGfxMatrix, M_PI / 2, MTXF_APPLY); Graphics_SetScaleMtx(150.0f); - gSPDisplayList(gMasterDisp++, aRadarMarkKaSaucererDL); + gSPDisplayList(gMasterDisp++, aBallDL); break; case OBJ_BOSS_CO_CARRIER: @@ -944,7 +949,7 @@ void ItemMeteoWarp_Draw(ItemMeteoWarp* this) { gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK | G_LIGHTING); } -void func_edisplay_8005D008(Object* obj, s32 drawType) { +void Object_SetMatrix(Object* obj, s32 drawType) { bool isBanned = (obj->id >= OBJ_SCENERY_CO_BUILDING_5 && obj->id <= OBJ_SCENERY_CO_BUILDING_8 || obj->id == OBJ_SCENERY_CO_BUILDING_10); bool skipRot = false; @@ -960,7 +965,6 @@ void func_edisplay_8005D008(Object* obj, s32 drawType) { skipRot = prevRot != obj->rot.y; } - if (drawType == 2) { Matrix_Translate(gGfxMatrix, 0.0f, 0.0f, gPathProgress, MTXF_APPLY); Matrix_Translate(gCalcMatrix, obj->pos.x, obj->pos.y, obj->pos.z, MTXF_NEW); @@ -991,7 +995,7 @@ void func_edisplay_8005D008(Object* obj, s32 drawType) { } } -void func_edisplay_8005D1F0(Object* obj, s32 drawType) { +void Boss_SetMatrix(Object* obj, s32 drawType) { if (drawType == 2) { Matrix_Translate(gGfxMatrix, 0.0f, 0.0f, gPathProgress, MTXF_APPLY); Matrix_Translate(gCalcMatrix, obj->pos.x, obj->pos.y, obj->pos.z, MTXF_NEW); @@ -1011,7 +1015,8 @@ void func_edisplay_8005D1F0(Object* obj, s32 drawType) { } } -void func_edisplay_8005D3CC(Object* obj, f32 xRot, f32 yRot, f32 zRot, s32 drawType) { +// Used for EVID_A6_UMBRA_STATION, OBJ_EFFECT_ENEMY_LASER_1 and OBJ_EFFECT_369 +void ObjSpecial_SetMatrix(Object* obj, f32 xRot, f32 yRot, f32 zRot, s32 drawType) { if (drawType == 2) { Matrix_Translate(gGfxMatrix, 0.0f, 0.0f, gPathProgress, MTXF_APPLY); Matrix_Translate(gCalcMatrix, obj->pos.x, obj->pos.y, obj->pos.z, MTXF_NEW); @@ -1038,9 +1043,9 @@ void func_edisplay_8005D3CC(Object* obj, f32 xRot, f32 yRot, f32 zRot, s32 drawT } } -void Scenery_Draw(Scenery* this, s32 arg1) { +void Scenery_Draw(Scenery* this, s32 cullDirection) { this->obj.pos.y += gCameraShakeY; - func_edisplay_8005D008(&this->obj, this->info.drawType); + Object_SetMatrix(&this->obj, this->info.drawType); this->obj.pos.y -= gCameraShakeY; if (this->info.drawType == 0) { @@ -1049,7 +1054,7 @@ void Scenery_Draw(Scenery* this, s32 arg1) { RCP_SetupDL_57(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar); gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK); - if (arg1 < 0) { + if (cullDirection < 0) { Object_ApplyWaterDistortion(); } @@ -1057,15 +1062,15 @@ void Scenery_Draw(Scenery* this, s32 arg1) { RCP_SetupDL_29(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar); } else { if (this->obj.id == OBJ_SCENERY_CO_HIGHWAY_3) { - if (arg1 < 0) { + if (cullDirection < 0) { return; // weird control flow } RCP_SetupDL_60(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar); } - Object_SetCullDirection(arg1); + Object_SetCullDirection(cullDirection); - if (arg1 < 0) { + if (cullDirection < 0) { Object_ApplyWaterDistortion(); } @@ -1076,7 +1081,7 @@ void Scenery_Draw(Scenery* this, s32 arg1) { } } } else if (this->info.draw != NULL) { - Object_SetCullDirection(arg1); + Object_SetCullDirection(cullDirection); this->info.draw(&this->obj); } } @@ -1084,7 +1089,7 @@ void Scenery_Draw(Scenery* this, s32 arg1) { void Sprite_Draw(Sprite* this, s32 arg1) { if (arg1 >= 0) { this->obj.pos.y += gCameraShakeY; - func_edisplay_8005D008(&this->obj, 0); + Object_SetMatrix(&this->obj, 0); this->obj.pos.y -= gCameraShakeY; if (this->info.drawType == 0) { @@ -1113,13 +1118,13 @@ void Actor_DrawOnRails(Actor* this) { } else { if (this->info.unk_19 != 0) { this->obj.pos.y += gCameraShakeY; - func_edisplay_8005D008(&this->obj, this->info.drawType); + Object_SetMatrix(&this->obj, this->info.drawType); this->obj.pos.y -= gCameraShakeY; } else if ((this->obj.id == OBJ_ACTOR_EVENT) && (this->eventType != EVID_A6_UMBRA_STATION)) { - func_edisplay_8005D3CC(&this->obj, this->vwork[29].x, this->vwork[29].y, - this->vwork[29].z + this->rot_0F4.z, this->info.drawType); + ObjSpecial_SetMatrix(&this->obj, this->vwork[29].x, this->vwork[29].y, + this->vwork[29].z + this->rot_0F4.z, this->info.drawType); } else { - func_edisplay_8005D008(&this->obj, this->info.drawType); + Object_SetMatrix(&this->obj, this->info.drawType); } if (this->info.drawType == 0) { @@ -1182,7 +1187,7 @@ void Actor_DrawAllRange(Actor* this) { Matrix_RotateZ(gCalcMatrix, this->obj.rot.z * M_DTOR, MTXF_APPLY); this->info.draw(&this->obj); sDrewActor = true; - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) && (this->obj.id == OBJ_ACTOR_ALLRANGE) && + if ((gPlayer[0].state == PLAYERSTATE_ACTIVE) && (this->obj.id == OBJ_ACTOR_ALLRANGE) && (this->aiType == AI360_MISSILE)) { gTeamArrowsViewPos[0] = sViewPos; } @@ -1193,8 +1198,7 @@ void Actor_DrawAllRange(Actor* this) { Matrix_Translate(gGfxMatrix, this->obj.pos.x, this->obj.pos.y, this->obj.pos.z, MTXF_APPLY); Matrix_MultVec3f(gGfxMatrix, &srcViewPos, &sViewPos); - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) || - (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_STANDBY) || + if ((gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO) || (gPlayer[0].state == PLAYERSTATE_STANDBY) || ((this->obj.id == OBJ_ACTOR_ALLRANGE) && (this->aiType >= AI360_GREAT_FOX)) || ((this->obj.id == OBJ_ACTOR_CUTSCENE) && (this->info.bonus != 0))) { var_ft5 = var_fv0 = 3000.0f; @@ -1221,7 +1225,7 @@ void Actor_DrawAllRange(Actor* this) { Matrix_SetGfxMtx(&gMasterDisp); this->info.draw(&this->obj); sDrewActor = true; - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) && + if ((gPlayer[0].state == PLAYERSTATE_ACTIVE) && (((this->obj.id == OBJ_ACTOR_ALLRANGE) && ((this->aiType <= AI360_PEPPY) || (this->aiType == AI360_KATT) || (this->aiType == AI360_BILL))) || @@ -1265,10 +1269,10 @@ void Boss_Draw(Boss* this, s32 arg1) { if (this->info.unk_19 != 0) { this->obj.pos.y += this->yOffset + gCameraShakeY; - func_edisplay_8005D1F0(&this->obj, this->info.drawType); + Boss_SetMatrix(&this->obj, this->info.drawType); this->obj.pos.y -= this->yOffset + gCameraShakeY; } else { - func_edisplay_8005D1F0(&this->obj, this->info.drawType); + Boss_SetMatrix(&this->obj, this->info.drawType); } Matrix_MultVec3f(&D_edisplay_801615F0, &origin, &D_edisplay_801615D0); @@ -1335,13 +1339,13 @@ void Effect_DrawOnRails(Effect* this, s32 arg1) { } if ((this->obj.id == OBJ_EFFECT_ENEMY_LASER_1) || (this->obj.id == OBJ_EFFECT_369)) { - func_edisplay_8005D3CC(&this->obj, this->unk_60.x, this->unk_60.y, this->unk_60.z, 0); + ObjSpecial_SetMatrix(&this->obj, this->unk_60.x, this->unk_60.y, this->unk_60.z, 0); } else if (this->info.unk_14 == -1) { this->obj.pos.y += gCameraShakeY; - func_edisplay_8005D008(&this->obj, 0); + Object_SetMatrix(&this->obj, 0); this->obj.pos.y -= gCameraShakeY; } else { - func_edisplay_8005D008(&this->obj, 0); + Object_SetMatrix(&this->obj, 0); } if (this->info.draw != NULL) { @@ -1664,7 +1668,7 @@ void Display_SetSecondLight(Vec3f* pos) { sp9C.y = pos->y - gLight3y; sp9C.z = pos->z - gLight3z; lightDist = VEC3F_MAG(&sp9C); - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) { + if (gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO) { lightFade = 700.0f / lightDist; } else { lightFade = 200.0f / lightDist; @@ -1727,7 +1731,7 @@ bool func_edisplay_8005F9DC(Vec3f* arg0) { return false; } -void Object_DrawAll(s32 arg0) { +void Object_DrawAll(s32 cullDirection) { Vec3f spAC; s32 i; s32 pad[5]; // probably separate iterators for each loop @@ -1768,11 +1772,11 @@ void Object_DrawAll(s32 arg0) { if (scenery->obj.status >= OBJ_ACTIVE) { FrameInterpolation_RecordOpenChild(scenery, i); FrameInterpolation_RecordMarker(__FILE__, __LINE__); - if (arg0 > 0) { + if (cullDirection > 0) { Display_SetSecondLight(&scenery->obj.pos); } Matrix_Push(&gGfxMatrix); - Scenery_Draw(scenery, arg0); + Scenery_Draw(scenery, cullDirection); Matrix_Pop(&gGfxMatrix); Object_UpdateSfxSource(scenery->sfxSource); FrameInterpolation_RecordCloseChild(); @@ -1780,7 +1784,7 @@ void Object_DrawAll(s32 arg0) { } } - for (i = 0, boss = gBosses; i < ARRAY_COUNT(gBosses); i++, boss++) { + for (i = 0, boss = &gBosses[0]; i < ARRAY_COUNT(gBosses); i++, boss++) { if ((boss->obj.status >= OBJ_ACTIVE) && (boss->obj.id != OBJ_BOSS_BO_BASE_SHIELD)) { FrameInterpolation_RecordOpenChild(boss, i); FrameInterpolation_RecordMarker(__FILE__, __LINE__); @@ -1790,9 +1794,10 @@ void Object_DrawAll(s32 arg0) { RCP_SetupDL_27(); gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 64, 64, 255, 255); } - Object_SetCullDirection(arg0); + + Object_SetCullDirection(cullDirection); Matrix_Push(&gGfxMatrix); - Boss_Draw(boss, arg0); + Boss_Draw(boss, cullDirection); Matrix_Pop(&gGfxMatrix); if (boss->drawShadow && (D_edisplay_801615D0.y > 0.0f)) { Matrix_Push(&gGfxMatrix); @@ -1806,7 +1811,7 @@ void Object_DrawAll(s32 arg0) { Lights_SetOneLight(&gMasterDisp, gLight1x, gLight1y, gLight1z, gLight1R, gLight1G, gLight1B, gAmbientR, gAmbientG, gAmbientB); - for (i = 0, sprite = gSprites; i < ARRAY_COUNT(gSprites); i++, sprite++) { + for (i = 0, sprite = &gSprites[0]; i < ARRAY_COUNT(gSprites); i++, sprite++) { if ((sprite->obj.status >= OBJ_ACTIVE) && func_enmy_80060FE4(&sprite->obj.pos, -12000.0f)) { FrameInterpolation_RecordOpenChild(sprite, i); FrameInterpolation_RecordMarker(__FILE__, __LINE__); @@ -1818,7 +1823,7 @@ void Object_DrawAll(s32 arg0) { RCP_SetupDL_60(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar); } - Sprite_Draw(sprite, arg0); + Sprite_Draw(sprite, cullDirection); Matrix_Pop(&gGfxMatrix); FrameInterpolation_RecordCloseChild(); } @@ -1848,12 +1853,13 @@ void Object_DrawAll(s32 arg0) { case LEVELMODE_ON_RAILS: case LEVELMODE_TURRET: Matrix_Push(&gGfxMatrix); - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) || - (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) || (gCurrentLevel == LEVEL_AQUAS)) { + + if ((gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO) || + (gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE) || (gCurrentLevel == LEVEL_AQUAS)) { Display_SetSecondLight(&actor->obj.pos); } - Object_SetCullDirection(arg0); + Object_SetCullDirection(cullDirection); Actor_DrawOnRails(actor); Matrix_Pop(&gGfxMatrix); @@ -1891,8 +1897,8 @@ void Object_DrawAll(s32 arg0) { FrameInterpolation_RecordMarker(__FILE__, __LINE__); Matrix_Push(&gGfxMatrix); RCP_SetupDL(&gMasterDisp, SETUPDL_29); - Object_SetCullDirection(arg0); - Item_Draw(item, arg0); + Object_SetCullDirection(cullDirection); + Item_Draw(item, cullDirection); Matrix_Pop(&gGfxMatrix); FrameInterpolation_RecordCloseChild(); } @@ -1958,7 +1964,8 @@ void Effect_DrawAll(s32 arg0) { void Object_Draw(s32 arg0) { gReflectY = 1; Object_DrawAll(1); - if ((gGroundSurface == SURFACE_WATER) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_INTRO)) { + + if ((gGroundSurface == SURFACE_WATER) && (gPlayer[0].state != PLAYERSTATE_LEVEL_INTRO)) { gReflectY = -1; Lights_SetOneLight(&gMasterDisp, gLight1x, -1 * gLight1y, gLight1z, gLight1R, gLight1G, gLight1B, gAmbientR, gAmbientG, gAmbientB); @@ -1975,7 +1982,7 @@ void Effect_Draw(u8 arg0) { if (arg0 == 0) { gReflectY = 1; Effect_DrawAll(1); - } else if ((gGroundSurface == SURFACE_WATER) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_INTRO)) { + } else if ((gGroundSurface == SURFACE_WATER) && (gPlayer[0].state != PLAYERSTATE_LEVEL_INTRO)) { gReflectY = -1; Matrix_Push(&gGfxMatrix); Matrix_Scale(gGfxMatrix, 1.0f, -1.0f, 1.0f, MTXF_APPLY); diff --git a/src/engine/fox_effect.c b/src/engine/fox_effect.c index 53ad582f..16493335 100644 --- a/src/engine/fox_effect.c +++ b/src/engine/fox_effect.c @@ -1,3 +1,9 @@ +/* + * File: fox_effect.c + * System: Effect + * Description: Effect Draw routines + */ + #include "global.h" #include "assets/ast_blue_marine.h" #include "assets/ast_arwing.h" @@ -54,7 +60,7 @@ void BonusText_Update(void) { if (gLevelMode == LEVELMODE_ON_RAILS) { bonus->pos.z -= gPathVelZ; - } else if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) { + } else if (gPlayer[0].state == PLAYERSTATE_ACTIVE) { bonus->pos.x += gPlayer[0].vel.x; bonus->pos.z += gPlayer[0].vel.z; } @@ -227,7 +233,7 @@ void Effect_Effect384_Draw(Effect384* this) { Graphics_SetScaleMtx(this->scale2); if ((this->scale1 == 71.0f) || - ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) && (gCurrentLevel == LEVEL_CORNERIA))) { + ((gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE) && (gCurrentLevel == LEVEL_CORNERIA))) { RCP_SetupDL(&gMasterDisp, SETUPDL_38); } else { RCP_SetupDL(&gMasterDisp, SETUPDL_67); @@ -376,7 +382,7 @@ void Effect_Effect347_Draw(Effect347* this) { void Effect_Effect351_Draw(Effect351* this) { Graphics_SetScaleMtx(this->scale2); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, this->unk_4A); - gSPDisplayList(gMasterDisp++, aRadarMarkKaSaucererDL); + gSPDisplayList(gMasterDisp++, aBallDL); } void Effect_Clouds_Draw(EffectClouds* this) { @@ -694,8 +700,7 @@ void Effect_Effect357_Update(Effect357* this) { this->vel.y -= 0.5f; } - if ((gCurrentLevel == LEVEL_BOLSE) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) && - (gCsFrameCount > 175)) { + if ((gCurrentLevel == LEVEL_BOLSE) && (gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE) && (gCsFrameCount > 175)) { this->vel.x *= 0.95f; this->vel.y *= 0.95f; this->vel.z *= 0.95f; @@ -722,7 +727,7 @@ bool func_effect_800798C4(s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3f* rot, vo void Effect_Effect357_Draw(Effect357* this) { Vec3f frameJointTable[50]; - if ((gCurrentLevel == LEVEL_BOLSE) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE)) { + if ((gCurrentLevel == LEVEL_BOLSE) && (gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE)) { Display_SetSecondLight(&this->obj.pos); } @@ -1484,11 +1489,11 @@ void Effect_Effect362_Spawn(f32 xPos, f32 yPos, f32 zPos, f32 scale2) { } void Effect_Effect362_Update(Effect362* this) { - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) { + if (gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE) { this->obj.rot.x = RAD_TO_DEG(gPlayer[0].camPitch); this->obj.rot.y = RAD_TO_DEG(-gPlayer[0].camYaw); } - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_NEXT) { + if (gPlayer[0].state == PLAYERSTATE_NEXT) { this->unk_46 = 2; this->vel.y -= 0.13f; } @@ -1721,7 +1726,7 @@ void Effect_Effect343_Setup(Effect343* this, f32 xPos, f32 yPos, f32 zPos, f32 s this->unk_48 = -this->unk_48; } - if ((gCurrentLevel == LEVEL_FORTUNA) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_NEXT)) { + if ((gCurrentLevel == LEVEL_FORTUNA) && (gPlayer[0].state != PLAYERSTATE_NEXT)) { this->unk_4A = 180; } else { this->unk_4A = 255; @@ -1759,7 +1764,7 @@ void Effect_Effect387_Update(Effect387* this) { s32 var_v0; var_v0 = 1 - 1; - if ((gCurrentLevel == LEVEL_FORTUNA) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_NEXT)) { + if ((gCurrentLevel == LEVEL_FORTUNA) && (gPlayer[0].state != PLAYERSTATE_NEXT)) { var_v0 = 4 - 1; } @@ -1995,7 +2000,7 @@ void func_effect_8007D2C8(f32 xPos, f32 yPos, f32 zPos, f32 scale2) { void Effect_Effect339_Update(EffectFireSmoke* this) { if (gLevelType == LEVELTYPE_PLANET) { - if ((gCurrentLevel == LEVEL_KATINA) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE)) { + if ((gCurrentLevel == LEVEL_KATINA) && (gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE)) { this->vel.y += 0.1f; if (this->timer_50 == 0) { this->unk_4C++; @@ -2008,7 +2013,7 @@ void Effect_Effect339_Update(EffectFireSmoke* this) { } } } else { - if ((gCurrentLevel == LEVEL_MACBETH) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) && + if ((gCurrentLevel == LEVEL_MACBETH) && (gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE) && (this->vel.x != 0)) { Math_SmoothStepToF(&this->vel.x, -1.0f, 1.0f, 1.0f, 0.0f); Math_SmoothStepToF(&this->vel.z, 4.0f, 1.0f, 1.0f, 0.0f); @@ -3332,8 +3337,9 @@ void func_effect_800815DC(void) { s32 i; for (i = 0; i < ARRAY_COUNT(gEffects); i++) { - if ((gEffects[i].obj.id == OBJ_EFFECT_366 || (gEffects[i].obj.id == OBJ_EFFECT_395 && gEffects[i].state == 1) || - gEffects[i].obj.id == OBJ_EFFECT_364 || gEffects[i].obj.id == OBJ_EFFECT_346) && + if (((gEffects[i].obj.id == OBJ_EFFECT_366) || + ((gEffects[i].obj.id == OBJ_EFFECT_395) && (gEffects[i].state == 1)) || + (gEffects[i].obj.id == OBJ_EFFECT_364) || (gEffects[i].obj.id == OBJ_EFFECT_346)) && gEffects[i].obj.status == OBJ_ACTIVE) { gEffects[i].obj.status = OBJ_FREE; break; @@ -3504,7 +3510,7 @@ void Effect_Effect395_Update(Effect395* this) { velocity.y = this->vel.y; velocity.z = this->vel.z; - //! FAKE: Probably some debug stuff printing different messages depending on what unk_4E is. + //! FAKE: Probably some debug stuff printing different messages depending on what state is. if ((this->state != 0) && (this->state != 6) && (this->state != 7) && (this->state != 11)) { if (gCurrentLevel) {} PRINTF("ZO_MOVE HELP %d\n"); diff --git a/src/engine/fox_enmy.c b/src/engine/fox_enmy.c index 8094e378..3f4a7c55 100644 --- a/src/engine/fox_enmy.c +++ b/src/engine/fox_enmy.c @@ -98,7 +98,7 @@ bool func_enmy_80060FE4(Vec3f* arg0, f32 arg1) { Vec3f src; Vec3f dest; - if ((gLevelMode != LEVELMODE_ALL_RANGE) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_INTRO)) { + if ((gLevelMode != LEVELMODE_ALL_RANGE) && (gPlayer[0].state != PLAYERSTATE_LEVEL_INTRO)) { return true; } @@ -125,7 +125,7 @@ bool func_enmy_80061148(Vec3f* arg0, f32 arg1) { return true; } - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) { + if (gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE) { return func_enmy_80060FE4(arg0, arg1); } @@ -333,7 +333,6 @@ void func_enmy_80061B68(void) { for (i = 0; i < ARRAY_COUNT(gEffects); i++) { if (gEffects[i].obj.status == OBJ_FREE) { - x = gPlayer[0].pos.x + RAND_FLOAT_CENTERED(2000.0f) + (5.0f * gPlayer[0].vel.x); y = 0; while (y <= gGroundHeight) { @@ -1232,8 +1231,8 @@ void Object_Init(s32 index, ObjectId objId) { gActors[index].obj.status = OBJ_FREE; } break; - case OBJ_MISSILE_SEEK_TEAM: - case OBJ_MISSILE_SEEK_PLAYER: + case OBJ_ACTOR_MISSILE_SEEK_TEAM: + case OBJ_ACTOR_MISSILE_SEEK_PLAYER: AUDIO_PLAY_SFX(NA_SE_EN_MISSILE_ENGINE, gActors[index].sfxSource, 4); break; case OBJ_ACTOR_CO_SKIBOT: @@ -1457,7 +1456,7 @@ void func_enmy_800654E4(Object* obj) { void func_enmy_800655C8(ActorMissileSeekTeam* this, f32 xPos, f32 yPos, f32 zPos, s32 eventType) { Actor_Initialize(this); this->obj.status = OBJ_INIT; - this->obj.id = OBJ_MISSILE_SEEK_TEAM; + this->obj.id = OBJ_ACTOR_MISSILE_SEEK_TEAM; this->obj.pos.x = xPos; this->obj.pos.y = yPos; this->obj.pos.z = zPos; @@ -1508,7 +1507,7 @@ void ActorMissileSeek_Update(Actor* this) { var_ra = (gLevelMode == LEVELMODE_ALL_RANGE) ? 2 : 0; if (this->iwork[2] == 0) { - if (this->obj.id == OBJ_MISSILE_SEEK_TEAM) { + if (this->obj.id == OBJ_ACTOR_MISSILE_SEEK_TEAM) { for (i = 0; i < 3; i++) { spB4[i] = gTeamShields[i + 1]; spA8[i] = var_ra + i; @@ -1653,7 +1652,7 @@ void ActorMissileSeek_Update(Actor* this) { sp8C.z = this->vel.z; if ((Object_CheckCollision(this->index, &this->obj.pos, &sp8C, 1) != 0) || (this->dmgType != DMG_NONE) || - (this->obj.pos.y < (gGroundHeight + 10.0f)) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE)) { + (this->obj.pos.y < (gGroundHeight + 10.0f)) || (gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE)) { func_effect_8007D2C8(this->obj.pos.x, this->obj.pos.y, this->obj.pos.z, 3.0f); Object_Kill(&this->obj, this->sfxSource); if (this->dmgType != DMG_NONE) { @@ -1985,7 +1984,7 @@ void func_enmy_80066EE4(Sprite* this) { void Item_CheckBounds(Item* this) { f32 var_fa1; - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_STANDBY)) { + if ((gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE) || (gPlayer[0].state == PLAYERSTATE_STANDBY)) { Object_Kill(&this->obj, this->sfxSource); } @@ -2138,7 +2137,7 @@ void ActorSupplies_Update(ActorSupplies* this) { gRadarMarks[63].yRot = 0.0f; } -void ActorSupplies_Draw(Actor* this) { +void ActorSupplies_Draw(ActorEvent* this) { s32 i; Lights_SetOneLight(&gMasterDisp, -60, -60, 60, 150, 150, 150, 20, 20, 20); @@ -2406,7 +2405,7 @@ void ItemMeteoWarp_Update(ItemMeteoWarp* this) { gRingPassCount++; if (gRingPassCount >= 7) { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_ENTER_WARP_ZONE; + gPlayer[0].state = PLAYERSTATE_ENTER_WARP_ZONE; gPlayer[0].csState = 0; AUDIO_PLAY_SFX(NA_SE_WARP_HOLE, gDefaultSfxSource, 0); gMissionStatus = MISSION_WARP; @@ -2475,14 +2474,15 @@ void ItemRingCheck_Update(Item* this) { void ItemPathChange_Update(Item* this) { gLastPathChange = this->obj.id; - if (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_ACTIVE) { + + if (gPlayer[0].state != PLAYERSTATE_ACTIVE) { Object_Kill(&this->obj, this->sfxSource); } else if (((gCurrentLevel == LEVEL_METEO) || (gCurrentLevel == LEVEL_SECTOR_X)) && (gLevelPhase == 1)) { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; gPlayer[0].csState = 0; Object_Kill(&this->obj, this->sfxSource); } else if (gCurrentLevel == LEVEL_TRAINING) { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_START_360; + gPlayer[0].state = PLAYERSTATE_START_360; gPlayer[0].csState = 0; Object_Kill(&this->obj, this->sfxSource); } else if (this->state == 0) { @@ -2617,7 +2617,7 @@ void Object_Dying(s32 index, ObjectId objId) { break; case OBJ_BOSS_TI_GORAS: - Titania_801990DC(&gBosses[index]); + Titania_TiGoras_Dying(&gBosses[index]); break; case OBJ_ACTOR_TI_RASCO: @@ -2647,7 +2647,7 @@ void Actor_Move(Actor* this) { if ((this->obj.id == OBJ_ACTOR_ZO_DODORA) || (gCurrentLevel == LEVEL_MACBETH) || ((this->obj.id == OBJ_ACTOR_EVENT) && (this->eventType == EVID_TI_GREAT_FOX))) { var_fv0 = 8000.0f; - } else if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ENTER_WARP_ZONE) { + } else if (gPlayer[0].state == PLAYERSTATE_ENTER_WARP_ZONE) { var_fv0 = 100000.0f; } @@ -2698,7 +2698,7 @@ void Boss_Move(Boss* this) { } void Scenery_Move(Scenery* this) { - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) { + if (gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO) { this->obj.pos.z += this->effectVel.z; if ((this->info.cullDistance * 1.5f) < this->obj.pos.z) { Object_Kill(&this->obj, this->sfxSource); @@ -2997,7 +2997,7 @@ void TexturedLine_Update(TexturedLine* this) { if (gGameState == GSTATE_PLAY) { if (((this->mode == 1) || (this->mode == 101) || (this->mode == 50)) && - (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) && (gPlayer[0].hitTimer == 0)) { + (gPlayer[0].state == PLAYERSTATE_ACTIVE) && (gPlayer[0].hitTimer == 0)) { Matrix_RotateX(gCalcMatrix, -this->xRot, MTXF_NEW); Matrix_RotateY(gCalcMatrix, -this->yRot, MTXF_APPLY); @@ -3057,13 +3057,13 @@ void Object_Update(void) { gCullObjects = false; if ((gLevelMode == LEVELMODE_ON_RAILS) && - ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_INIT) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) || - (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_DOWN) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ENTER_WARP_ZONE) || - (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_START_360) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_NEXT))) { + ((gPlayer[0].state == PLAYERSTATE_INIT) || (gPlayer[0].state == PLAYERSTATE_ACTIVE) || + (gPlayer[0].state == PLAYERSTATE_DOWN) || (gPlayer[0].state == PLAYERSTATE_ENTER_WARP_ZONE) || + (gPlayer[0].state == PLAYERSTATE_START_360) || (gPlayer[0].state == PLAYERSTATE_NEXT))) { gCullObjects = true; } if (gLevelMode != LEVELMODE_ALL_RANGE) { - if ((gLoadLevelObjects != 0) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_INTRO)) { + if ((gLoadLevelObjects != 0) && (gPlayer[0].state != PLAYERSTATE_LEVEL_INTRO)) { Object_LoadLevelObjects(); } for (i = 0, scenery = gScenery; i < ARRAY_COUNT(gScenery); i++, scenery++) { diff --git a/src/engine/fox_enmy2.c b/src/engine/fox_enmy2.c index 220f59bf..3306fd1c 100644 --- a/src/engine/fox_enmy2.c +++ b/src/engine/fox_enmy2.c @@ -1184,7 +1184,7 @@ void ActorEvent_ProcessScript(ActorEvent* this) { this->drawShadow = true; } - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) { + if (gPlayer[0].state == PLAYERSTATE_ACTIVE) { if (this->eventType == EVID_KATT) { Audio_PlayFanfare(NA_BGM_KATT, 20, 10, 10); } @@ -1331,7 +1331,7 @@ void ActorEvent_ProcessScript(ActorEvent* this) { case EV_OPC(EVOP_PLAY_MSG): msg = Message_PtrFromId(actorScript[this->aiIndex + 1]); - if ((msg != NULL) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE)) { + if ((msg != NULL) && (gPlayer[0].state == PLAYERSTATE_ACTIVE)) { Radio_PlayMessage(msg, actorScript[this->aiIndex] & 0x1FF); } this->aiIndex += 2; @@ -1840,7 +1840,7 @@ void ActorEvent_ProcessActions(ActorEvent* this) { Vec3f sp6C; Sprite* sprite; - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) && (this->eventType != EVID_SARUMARINE_PERISCOPE) && + if ((gPlayer[0].state == PLAYERSTATE_ACTIVE) && (this->eventType != EVID_SARUMARINE_PERISCOPE) && (this->eventType != EVID_ANDROSS_GATE) && (this->eventType != EVID_ANDROSS_GATE_2) && (this->eventType != EVID_SY_ROBOT_1) && (this->eventType != EVID_SY_ROBOT_2) && (this->eventType != EVID_SY_ROBOT_3)) { @@ -3042,7 +3042,7 @@ void ActorEvent_Update(ActorEvent* this) { Vec3f spAC; Vec3f spA0; - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) || gKillEventActors) { + if ((gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE) || gKillEventActors) { Object_Kill(&this->obj, this->sfxSource); return; } @@ -3459,7 +3459,7 @@ void ActorEvent_Update(ActorEvent* this) { this->vel.z -= gPathVelZ; } - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ENTER_WARP_ZONE) { + if (gPlayer[0].state == PLAYERSTATE_ENTER_WARP_ZONE) { this->vel.z = 100.0f; } diff --git a/src/engine/fox_hud.c b/src/engine/fox_hud.c index 89d7b618..3196171b 100644 --- a/src/engine/fox_hud.c +++ b/src/engine/fox_hud.c @@ -13,7 +13,7 @@ s32 D_801616D0[13]; s32 D_hud_80161704; s32 D_hud_80161708; s32 D_hud_8016170C; -s32 D_hud_80161710; +s32 gRadarMissileAlarmTimer; s32 gTotalHits; s32 D_80161718; s32 D_8016171C; @@ -192,7 +192,7 @@ void HUD_TeamDownWrench_Draw(s32 arg0) { RCP_SetupDL(&gMasterDisp, SETUPDL_36); if (arg0 == 0) { for (i = 1; i < 4; i++) { - if (((gTeamShields[i] != 0) || (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_COMPLETE)) && + if (((gTeamShields[i] != 0) || (gPlayer[0].state != PLAYERSTATE_LEVEL_COMPLETE)) && (gTeamShields[i] <= 0) && (gTeamShields[i] != -2)) { Matrix_Push(&gGfxMatrix); Matrix_Translate(gGfxMatrix, sTeamDownWrenchPos[i - 1].x, sTeamDownWrenchPos[i - 1].y, @@ -499,7 +499,7 @@ void HUD_TeamShields_Draw(f32 xPos, f32 yPos, s32 arg2) { ((gPlayState == PLAY_PAUSE) || (gShowLevelClearStatusScreen == 1) || (gLevelStartStatusScreenTimer != 0))) { RCP_SetupDL(&gMasterDisp, SETUPDL_76_POINT); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255); - if ((arg2 == 0) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE)) { + if ((arg2 == 0) && (gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE)) { Graphics_DisplaySmallText(xPos + (8.0f * xScale) + 4.0f, yPos + 2.0f, 1.0f, 1.0f, " OK "); } else { Graphics_DisplaySmallText(xPos + (8.0f * xScale) + 4.0f, yPos + 2.0f, 1.0f, 1.0f, "DOWN"); @@ -1467,7 +1467,7 @@ void HUD_PauseScreen_Update(void) { break; case 2: - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_STANDBY; + gPlayer[0].state = PLAYERSTATE_STANDBY; gFillScreenRed = gFillScreenGreen = gFillScreenBlue = 0; gFillScreenAlphaTarget = 255; gFillScreenAlphaStep = 32; @@ -1589,7 +1589,7 @@ void HUD_PauseScreen_Update(void) { gSavedHitCount = gSavedObjectLoadIndex = 0; Audio_StopPlayerNoise(0); - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_NEXT; + gPlayer[0].state = PLAYERSTATE_NEXT; gScreenFlashTimer = 0; gPlayer[0].csTimer = 0; gFillScreenAlpha = gFillScreenAlphaTarget = 255; @@ -1758,7 +1758,7 @@ void HUD_RadarMark_KaSaucerer_Draw(void) { gDPSetPrimColor(gMasterDisp++, 0, 0, 0, 0, 0, 255); Matrix_Scale(gGfxMatrix, 125.0f, 125.0f, 1.0f, MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); - gSPDisplayList(gMasterDisp++, aRadarMarkKaSaucererDL); + gSPDisplayList(gMasterDisp++, aBallDL); } void HUD_RadarMark_Missile_Draw(void) { @@ -1874,7 +1874,7 @@ void HUD_RadarMark_Draw(s32 type) { arwingMarkColor = 1; } - if (gPlayer[type].state_1C8 == PLAYERSTATE_1C8_VS_STANDBY) { + if (gPlayer[type].state == PLAYERSTATE_VS_STANDBY) { break; } } @@ -1971,7 +1971,7 @@ void HUD_RadarMarks_Setup(void) { Item* item; for (i = 0; i < gCamCount; i++) { - if (gPlayer[i].state_1C8 == PLAYERSTATE_1C8_NEXT) { + if (gPlayer[i].state == PLAYERSTATE_NEXT) { continue; } gRadarMarks[i].enabled = true; @@ -1988,7 +1988,7 @@ void HUD_RadarMarks_Setup(void) { continue; } - if (gPlayer[i].state_1C8 != PLAYERSTATE_1C8_ACTIVE) { + if (gPlayer[i].state != PLAYERSTATE_ACTIVE) { continue; } @@ -2178,11 +2178,11 @@ s32 HUD_RadarMarks_Update(void) { Matrix_Push(&gGfxMatrix); Matrix_Translate(gGfxMatrix, x1 + gHudOffsetPers, y1, z1, MTXF_APPLY); - if ((gCurrentLevel == LEVEL_SECTOR_Z) && (D_hud_80161710 != 0)) { + if ((gCurrentLevel == LEVEL_SECTOR_Z) && (gRadarMissileAlarmTimer != 0)) { Matrix_Push(&gGfxMatrix); HUD_RadarMissileAlarm_Draw(); Matrix_Pop(&gGfxMatrix); - D_hud_80161710--; + gRadarMissileAlarmTimer--; } for (i = ARRAY_COUNT(gRadarMarks) - 1; i >= 0; i--) { @@ -2220,19 +2220,20 @@ s32 ActorMissileSeek_ModeCheck(ActorMissileSeekMode mode) { for (i = 0, actor = &gActors[0]; i < 60; i++, actor++) { switch (mode) { case MISSILE_SEEK_TEAMMATES: - if ((actor->obj.status == OBJ_ACTIVE) && (actor->obj.id == OBJ_MISSILE_SEEK_TEAM)) { + if ((actor->obj.status == OBJ_ACTIVE) && (actor->obj.id == OBJ_ACTOR_MISSILE_SEEK_TEAM)) { ret++; } break; case MISSILE_SEEK_PLAYER: - if ((actor->obj.status == OBJ_ACTIVE) && (actor->obj.id == OBJ_MISSILE_SEEK_PLAYER)) { + if ((actor->obj.status == OBJ_ACTIVE) && (actor->obj.id == OBJ_ACTOR_MISSILE_SEEK_PLAYER)) { ret++; } break; case MISSILE_SEEK_EITHER: - if (((actor->obj.id == OBJ_MISSILE_SEEK_TEAM) || (actor->obj.id == OBJ_MISSILE_SEEK_PLAYER)) && + if (((actor->obj.id == OBJ_ACTOR_MISSILE_SEEK_TEAM) || + (actor->obj.id == OBJ_ACTOR_MISSILE_SEEK_PLAYER)) && (actor->obj.status == OBJ_ACTIVE)) { ret++; } @@ -3295,7 +3296,7 @@ void HUD_Radar(void) { HUD_RadarMarks_Update(); } -void HUD_Hitpoints_Update(f32 xPos, f32 yPos) { +void HUD_Score_Update(f32 xPos, f32 yPos) { f32 r; f32 g; f32 b; @@ -3381,24 +3382,22 @@ void HUD_Hitpoints_Update(f32 xPos, f32 yPos) { r = 255; g = 255; b = 255; + } else if (medalStatus) { + r = 200; + g = 100; + b = 50; } else { - if (medalStatus) { - r = 200; - g = 100; - b = 50; - } else { - r = 90; - g = 160; - b = 200; - } + r = 90; + g = 160; + b = 200; } RCP_SetupDL(&gMasterDisp, SETUPDL_76_POINT); gDPSetPrimColor(gMasterDisp++, 0, 0, r, g, b, 255); - HUD_Hitpoints_Draw(xPos, yPos); + HUD_Score_Draw(xPos, yPos); } -void HUD_Shield_GoldRings_HitPoints(f32 xPos, f32 yPos) { - HUD_Hitpoints_Update(xPos, yPos); +void HUD_Shield_GoldRings_Score(f32 xPos, f32 yPos) { + HUD_Score_Update(xPos, yPos); HUD_PlayerShield_GoldRings(); } @@ -3626,7 +3625,7 @@ void HUD_SinglePlayer(void) { HUD_IncomingMsg(); if (D_hud_80161708 != 0) { - HUD_Shield_GoldRings_HitPoints(24.0f, 30.0f); + HUD_Shield_GoldRings_Score(24.0f, 30.0f); if (gCurrentLevel != LEVEL_TRAINING) { HUD_LivesCount2_Draw(248.0f, 11.0f, gLifeCount[gPlayerNum]); } @@ -3753,13 +3752,13 @@ void HUD_Draw(void) { gDPSetTextureFilter(gMasterDisp++, G_TF_BILERP); } -void FoBase_Draw(Boss* boss) { +void FoBase_Draw(Boss* this) { RCP_SetupDL_29(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar); gSPDisplayList(gMasterDisp++, aFoBaseDL2); RCP_SetupDL_34(gFogRed, gFogGreen, gFogBlue, gFogAlpha, gFogNear, gFogFar); gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK); gDPSetTextureFilter(gMasterDisp++, G_TF_POINT); - gDPSetPrimColor(gMasterDisp++, 0, 0, 0, (s32) boss->fwork[1], (s32) boss->fwork[2], 255); + gDPSetPrimColor(gMasterDisp++, 0, 0, 0, (s32) this->fwork[1], (s32) this->fwork[2], 255); gSPDisplayList(gMasterDisp++, aFoBaseDL1); gDPSetTextureFilter(gMasterDisp++, G_TF_BILERP); } @@ -4247,7 +4246,7 @@ void ActorTeamBoss_SetAction(ActorTeamBoss* this) { this->state = 3; } - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) { + if (gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE) { if ((this->state != 2) && (this->state != 3)) { this->iwork[4] = 1; this->state = 2; @@ -4534,7 +4533,7 @@ void ActorTeamBoss_Radarmarks_Init(ActorTeamBoss* this) { void ActorTeamBoss_DmgEffect(ActorTeamBoss* this) { s32 mask; - if ((gTeamShields[this->aiType] < 64) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_COMPLETE)) { + if ((gTeamShields[this->aiType] < 64) && (gPlayer[0].state != PLAYERSTATE_LEVEL_COMPLETE)) { mask = 8 - 1; if (gTeamShields[this->aiType] > 16) { mask = 16 - 1; @@ -4830,14 +4829,14 @@ void ActorTeamBoss_Update(ActorTeamBoss* this) { } if ((this->iwork[10] != 0) && (gLevelMode == LEVELMODE_ALL_RANGE) && (this->iwork[9] == 0) && - (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_COMPLETE)) { + (gPlayer[0].state != PLAYERSTATE_LEVEL_COMPLETE)) { this->work_048 = 2; this->work_04A = 0; } if ((gLevelMode == LEVELMODE_ALL_RANGE) && (fabsf(this->obj.pos.x > range) || fabsf(this->obj.pos.z > range)) && - (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_COMPLETE)) { + (gPlayer[0].state != PLAYERSTATE_LEVEL_COMPLETE)) { this->work_048 = 2; this->work_04A = 1; } @@ -4877,7 +4876,7 @@ void Aquas_CsIntroActors_Update(ActorCutscene* this) { if (this->state == 0) { switch (this->animFrame) { case 1: - if ((player->state_1C8 != PLAYERSTATE_1C8_LEVEL_INTRO) || (this->animFrame != 1)) { + if ((player->state != PLAYERSTATE_LEVEL_INTRO) || (this->animFrame != 1)) { if (gCsFrameCount > 1588) { this->fwork[0] = 5.0f; } else { @@ -4942,8 +4941,7 @@ void Aquas_Effect363_Spawn(f32 x, f32 y, f32 z, f32 arg3) { effect->obj.pos.y = y; effect->obj.pos.z = z; - if ((player->state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) && (gCurrentLevel == LEVEL_AQUAS) && - (player->csState < 2)) { + if ((player->state == PLAYERSTATE_LEVEL_INTRO) && (gCurrentLevel == LEVEL_AQUAS) && (player->csState < 2)) { effect->scale1 = 0.4f; effect->unk_44 = 0; effect->unk_46 = 24; @@ -5362,7 +5360,7 @@ void Aquas_CsLevelStart(Player* player) { if (player->csTimer <= 900) { gLevelStartStatusScreenTimer = 50; - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; player->csState = 0; player->csTimer = 0; @@ -5418,7 +5416,7 @@ f32 D_800D24CC = 0.02f; void Aquas_Effect363_Update(Effect363* this) { Player* player = &gPlayer[0]; - if ((player->state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) && (gCurrentLevel == LEVEL_AQUAS) && (player->csState < 2)) { + if ((player->state == PLAYERSTATE_LEVEL_INTRO) && (gCurrentLevel == LEVEL_AQUAS) && (player->csState < 2)) { switch (this->state) { case 0: this->unk_44 += this->unk_46; @@ -5449,12 +5447,12 @@ void Aquas_Effect363_Update(Effect363* this) { } this->obj.rot.z += this->unk_48; } else { - if (player->state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) { + if (player->state == PLAYERSTATE_LEVEL_COMPLETE) { this->obj.rot.x = RAD_TO_DEG(player->camPitch); this->obj.rot.y = RAD_TO_DEG(-player->camYaw); } - if (player->state_1C8 == PLAYERSTATE_1C8_NEXT) { + if (player->state == PLAYERSTATE_NEXT) { this->unk_46 = 2; if (player->csState >= 4) { this->vel.y -= 0.13f; @@ -5464,8 +5462,8 @@ void Aquas_Effect363_Update(Effect363* this) { this->scale2 += 0.8f; this->unk_4A -= this->unk_46; - if ((this->unk_4A < 0) || ((player->state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) && - (gCurrentLevel == LEVEL_AQUAS) && (player->csState == 5))) { + if ((this->unk_4A < 0) || + ((player->state == PLAYERSTATE_LEVEL_INTRO) && (gCurrentLevel == LEVEL_AQUAS) && (player->csState == 5))) { Object_Kill(&this->obj, this->sfxSource); } this->obj.rot.z += this->unk_48; @@ -5473,8 +5471,7 @@ void Aquas_Effect363_Update(Effect363* this) { } void Aquas_Effect363_Draw(Effect363* this) { - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) && (gCurrentLevel == LEVEL_AQUAS) && - (gPlayer[0].csState < 2)) { + if ((gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO) && (gCurrentLevel == LEVEL_AQUAS) && (gPlayer[0].csState < 2)) { RCP_SetupDL(&gMasterDisp, SETUPDL_68); gDPSetPrimColor(gMasterDisp++, 0, 0, 0, 21, 34, this->unk_4A); gDPSetEnvColor(gMasterDisp++, 255, 255, 251, 0); @@ -5492,7 +5489,7 @@ void stub_80094D10(void) { void stub_80094D18(void) { } -void HUD_Hitpoints_Draw(f32 x, f32 y) { +void HUD_Score_Draw(f32 x, f32 y) { u8* D_800D24DC[] = { aLargeText_0, aLargeText_1, aLargeText_2, aLargeText_3, aLargeText_4, aLargeText_5, aLargeText_6, aLargeText_7, aLargeText_8, aLargeText_9 }; s32 D_800D2504[] = { 100, 10, 1 }; @@ -5665,7 +5662,7 @@ void Aquas_AqCoralReef2_Setup(ActorCutscene* this, s32 posIdx) { this->obj.id = OBJ_ACTOR_CUTSCENE; this->obj.pos = sAqCoralReef2Pos[posIdx]; this->obj.pos.z -= gPathProgress; - this->animFrame = 46; + this->animFrame = ACTOR_CS_AQ_CORAL_REEF_2; Object_SetInfo(&this->info, this->obj.id); } @@ -5680,7 +5677,7 @@ void Aquas_AqRock_Setup(ActorCutscene* this, s32 posIdx) { this->obj.id = OBJ_ACTOR_CUTSCENE; this->obj.pos = sAqRockPos[posIdx]; this->obj.pos.z -= gPathProgress; - this->animFrame = 47; + this->animFrame = ACTOR_CS_AQ_ROCK; Object_SetInfo(&this->info, this->obj.id); } @@ -5966,7 +5963,7 @@ void Aquas_CsLevelComplete(Player* player) { if (gFillScreenAlpha == 255) { gLeveLClearStatus[LEVEL_AQUAS] = Play_CheckMedalStatus(150) + 1; - player->state_1C8 = PLAYERSTATE_1C8_NEXT; + player->state = PLAYERSTATE_NEXT; player->csTimer = 0; Audio_FadeOutAll(10); gFadeoutType = 4; @@ -6189,7 +6186,7 @@ void Venom1_LevelStart2(Player* player) { if (gCsFrameCount == 300) { gPathTexScroll = 0; gLevelStartStatusScreenTimer = 50; - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; player->baseSpeed = gArwingSpeed; player->csState = 0; player->csTimer = 0; diff --git a/src/engine/fox_play.c b/src/engine/fox_play.c index 0ef05370..48e5e526 100644 --- a/src/engine/fox_play.c +++ b/src/engine/fox_play.c @@ -436,7 +436,7 @@ void Play_Setup360_CO(void) { } } - for (i = 0, sprite = gSprites; i < ARRAY_COUNT(gSprites); i++) { + for (i = 0, sprite = &gSprites[0]; i < ARRAY_COUNT(gSprites); i++) { if (gLevelObjects[i].id <= OBJ_INVALID) { break; } @@ -1656,8 +1656,7 @@ void Player_CheckItemCollect(Player* player) { for (i = 0, item = gItems; i < ARRAY_COUNT(gItems); i++, item++) { if ((item->obj.status == OBJ_ACTIVE) && - ((player->state_1C8 == PLAYERSTATE_1C8_ACTIVE) || (player->state_1C8 == PLAYERSTATE_1C8_U_TURN)) && - (item->timer_4A == 0) && + ((player->state == PLAYERSTATE_ACTIVE) || (player->state == PLAYERSTATE_U_TURN)) && (item->timer_4A == 0) && Player_CheckHitboxCollision(player, item->info.hitbox, &sp6C, item->obj.pos.x, item->obj.pos.y, item->obj.pos.z, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)) { item->collected = true; @@ -1801,7 +1800,7 @@ void Player_CollisionCheck(Player* player) { break; } } else if (player->form == FORM_ARWING) { - if ((player->hit1.y < (gGroundHeight + 13.0f)) && (player->state_1C8 != PLAYERSTATE_1C8_DOWN)) { + if ((player->hit1.y < (gGroundHeight + 13.0f)) && (player->state != PLAYERSTATE_DOWN)) { if (gGroundSurface == SURFACE_WATER) { player->hitTimer = 7; player->rot.x = (player->baseSpeed + player->boostSpeed) * 0.5f; @@ -1814,7 +1813,7 @@ void Player_CollisionCheck(Player* player) { Effect_Effect362_Spawn(player->hit1.x, player->hit1.y, player->hit1.z, 6.0f); } } - if ((player->hit2.y < (gGroundHeight + 13.0f)) && (player->state_1C8 != PLAYERSTATE_1C8_DOWN)) { + if ((player->hit2.y < (gGroundHeight + 13.0f)) && (player->state != PLAYERSTATE_DOWN)) { if (gGroundSurface == SURFACE_WATER) { player->hitTimer = 7; player->rot.x = (player->baseSpeed + player->boostSpeed) * 0.5f; @@ -2058,7 +2057,7 @@ void Player_CollisionCheck(Player* player) { } } - for (i = 0, boss = gBosses; i < ARRAY_COUNT(gBosses); i++, boss++) { + for (i = 0, boss = &gBosses[0]; i < ARRAY_COUNT(gBosses); i++, boss++) { if (boss->obj.status == OBJ_ACTIVE) { if ((boss->obj.id == OBJ_BOSS_VE2_BASE) || (boss->obj.id == OBJ_BOSS_FO_BASE) || (boss->obj.id == OBJ_BOSS_SZ_GREAT_FOX) || (boss->obj.id == OBJ_BOSS_BO_BASE)) { @@ -2216,7 +2215,7 @@ void Player_CollisionCheck(Player* player) { } } else { actor->dmgType = DMG_COLLISION; - if (actor->obj.id == OBJ_MISSILE_SEEK_TEAM) { + if (actor->obj.id == OBJ_ACTOR_MISSILE_SEEK_TEAM) { actor->dmgType = -1; } if (actor->info.damage) { @@ -2258,7 +2257,7 @@ void Player_CollisionCheck(Player* player) { if (gCamCount == 4) { for (opponent = &gPlayer[3], i = 3; i >= 0; i--, opponent--) { - if ((i != gPlayerNum) && (opponent->state_1C8 == PLAYERSTATE_1C8_ACTIVE)) { + if ((i != gPlayerNum) && (opponent->state == PLAYERSTATE_ACTIVE)) { spC8.x = 25.0f; if (player->form == FORM_ON_FOOT) { spC8.x = 4.0f; @@ -2316,7 +2315,7 @@ void Player_CollisionCheck(Player* player) { player->knockback.y = 30.0f; player->rot.x = (player->baseSpeed + player->boostSpeed) * 0.8f; } - if (player->state_1C8 == PLAYERSTATE_1C8_DOWN) { + if (player->state == PLAYERSTATE_DOWN) { player->radioDamageTimer = 2; Effect_Effect382_Spawn(player->pos.x, player->trueZpos, 30.0f, 0.0f, 5.0f); Effect_Effect382_Spawn(player->pos.x, player->trueZpos, -30.0f, 0.0f, 5.0f); @@ -2851,7 +2850,7 @@ void Play_Init(void) { gSceneSetup = 0; } - gShowHud = 1; + gShowHud = true; gDrawGround = gDrawBackdrop = 1; gAqDrawMode = sOverheadCam = 0; gCamDistortion = sOverheadCamDist = 0.0f; @@ -2945,7 +2944,7 @@ void Play_Init(void) { MEM_ARRAY_ALLOCATE(gPlayer, gCamCount); Player_InitializeAll(); for (i = 0; i < gCamCount; i++) { - gPlayer[i].state_1C8 = PLAYERSTATE_1C8_INIT; + gPlayer[i].state = PLAYERSTATE_INIT; gPlayerGlareAlphas[i] = D_ctx_801783C0[i] = 0; gControllerRumbleTimers[i] = 0; gPlayerScores[i] = 0; @@ -3298,8 +3297,8 @@ bool Player_CanLockOn(s32 playerNum) { if (gVersusMode) { for (i = 0; i < gCamCount; i++) { - if (((gPlayer[playerNum].state_1C8 == PLAYERSTATE_1C8_ACTIVE) || - (gPlayer[playerNum].state_1C8 == PLAYERSTATE_1C8_U_TURN)) && + if (((gPlayer[playerNum].state == PLAYERSTATE_ACTIVE) || + (gPlayer[playerNum].state == PLAYERSTATE_U_TURN)) && (gVsLockOnTimers[i][playerNum] != 0)) { return false; } @@ -3321,7 +3320,7 @@ bool Player_UpdateLockOn(Player* player) { Object_PlayerSfx(player->sfxSource, NA_SE_LOCK_SEARCH, player->num); } if (!((gInputHold->button & R_TRIG) && (gInputHold->button & Z_TRIG) && (player->form == FORM_ARWING) && - (player->state_1C8 == PLAYERSTATE_1C8_ACTIVE)) && + (player->state == PLAYERSTATE_ACTIVE)) && ((gGameFrameCount % 4) == 0) && Player_CanLockOn(player->num)) { if (gChargeTimers[player->num] > 20) { for (i = 0; i < 13; i++) { // bug? should be 11 @@ -3673,7 +3672,7 @@ void Player_CheckBounds360(Player* player) { var_fv1 = 100000.0f; } if ((var_fv1 < fabsf(player->pos.x)) || (var_fv1 < fabsf(player->pos.z))) { - player->state_1C8 = PLAYERSTATE_1C8_U_TURN; + player->state = PLAYERSTATE_U_TURN; player->unk_19C = 0; player->csState = 0; player->unk_000 = 0.0f; @@ -4721,7 +4720,7 @@ void Player_Setup(Player* playerx) { Camera_Update360(player, true); } - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; player->wingPosition = gLevelType; if ((gLevelMode == LEVELMODE_ALL_RANGE) && !gVersusMode) { @@ -4755,7 +4754,7 @@ void Player_Setup(Player* playerx) { switch (gCurrentLevel) { case LEVEL_CORNERIA: - player->state_1C8 = PLAYERSTATE_1C8_LEVEL_INTRO; + player->state = PLAYERSTATE_LEVEL_INTRO; player->wingPosition = 1; gGroundSurface = gSavedGroundSurface = SURFACE_WATER; Play_dummy_MuteSfx(); @@ -4777,10 +4776,10 @@ void Player_Setup(Player* playerx) { case LEVEL_KATINA: case LEVEL_SECTOR_Z: case LEVEL_VENOM_2: - player->state_1C8 = PLAYERSTATE_1C8_LEVEL_INTRO; + player->state = PLAYERSTATE_LEVEL_INTRO; break; case LEVEL_METEO: - player->state_1C8 = PLAYERSTATE_1C8_LEVEL_INTRO; + player->state = PLAYERSTATE_LEVEL_INTRO; break; } } else { @@ -4805,7 +4804,7 @@ void Player_Setup(Player* playerx) { } } - if (player->state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) { + if (player->state == PLAYERSTATE_LEVEL_INTRO) { player->draw = true; switch (gCurrentLevel) { case LEVEL_CORNERIA: @@ -4885,7 +4884,7 @@ void Player_Setup(Player* playerx) { Display_SetupPlayerSfxPos(player); if (!gVersusMode && (((gCurrentLevel != LEVEL_TITANIA) && (gCurrentLevel != LEVEL_SOLAR)) || gVersusMode || - (player->state_1C8 != PLAYERSTATE_1C8_LEVEL_INTRO))) { + (player->state != PLAYERSTATE_LEVEL_INTRO))) { Audio_StartPlayerNoise(gPlayerNum); } @@ -5055,7 +5054,7 @@ void Player_UpdateTankRoll(Player* player) { void Player_ArwingBoost(Player* player) { f32 sp2C; f32 sp28; - s32 var; + s32 stickY; if ((player->boostMeter != 0.0f) && (gInputHold->button & gBrakeButton[player->num]) && (gInputHold->button & gBoostButton[player->num])) { @@ -5073,7 +5072,8 @@ void Player_ArwingBoost(Player* player) { player->sfx.boost = 0; - var = gInputPress->stick_y; // fake? + stickY = gInputPress->stick_y; // fake? + if (gLoopDownTimers[gPlayerNum] != 0) { gLoopDownTimers[gPlayerNum]--; } @@ -5082,7 +5082,7 @@ void Player_ArwingBoost(Player* player) { gLoopBoostTimers[gPlayerNum]--; } if (!player->somersault && (gDrawBackdrop < 5)) { - if (var >= -50) { + if (stickY >= -50) { gLoopDownTimers[gPlayerNum] = 5; } if ((gLoopDownTimers[gPlayerNum] > 0) && (gLoopDownTimers[gPlayerNum] < 5) && @@ -5131,7 +5131,7 @@ void Player_ArwingBoost(Player* player) { } } if ((gInputHold->button & gBoostButton[player->num]) && !(gInputHold->button & gBrakeButton[player->num]) && - (player->state_1C8 != PLAYERSTATE_1C8_U_TURN) && !player->boostCooldown) { + (player->state != PLAYERSTATE_U_TURN) && !player->boostCooldown) { if (player->boostMeter == 0.0f) { Player_PlaySfx(player->sfxSource, NA_SE_ARWING_BOOST, player->num); player->unk_194 = 5.0f; @@ -5218,7 +5218,7 @@ void Player_ArwingBrake(Player* player) { (gUturnBrakeTimers[gPlayerNum] != 0)) { gUturnDownTimers[gPlayerNum] = 0; gUturnBrakeTimers[gPlayerNum] = 0; - player->state_1C8 = PLAYERSTATE_1C8_U_TURN; + player->state = PLAYERSTATE_U_TURN; player->csState = 0; player->unk_19C = 1; player->unk_000 = 0.0f; @@ -5231,7 +5231,7 @@ void Player_ArwingBrake(Player* player) { } if ((gInputHold->button & gBrakeButton[player->num]) && !(gInputHold->button & gBoostButton[player->num]) && - (player->state_1C8 != PLAYERSTATE_1C8_U_TURN) && !player->boostCooldown) { + (player->state != PLAYERSTATE_U_TURN) && !player->boostCooldown) { if (player->boostMeter == 0.0f) { Player_PlaySfx(player->sfxSource, NA_SE_ARWING_BRAKE, player->num); if ((gLevelMode == LEVELMODE_ALL_RANGE) && (gInputPress->button & gBrakeButton[player->num])) { @@ -5513,7 +5513,7 @@ void Player_UpdateEffects(Player* player) { if (player->form == FORM_ARWING) { player->damageShake = SIN_DEG(player->hitTimer * 400.0f) * player->hitTimer * D_800D3164[player->hitDirection]; - if (player->state_1C8 == PLAYERSTATE_1C8_ACTIVE) { + if (player->state == PLAYERSTATE_ACTIVE) { player->xShake = SIN_DEG(player->hitTimer * 400.0f) * player->hitTimer * D_800D3164[player->hitDirection] * 0.8f; } @@ -5606,7 +5606,8 @@ void Play_dummy_800B41E0(Player* player) { } void Player_Down(Player* player) { - player->state_1C8 = PLAYERSTATE_1C8_DOWN; + player->state = PLAYERSTATE_DOWN; + if (!gVersusMode) { SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 1); SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 1); @@ -5622,7 +5623,7 @@ void Player_Down(Player* player) { player->hitTimer = 0; player->radioDamageTimer = 0; player->damageShake = 0.0f; - gShowHud = 0; + gShowHud = false; } void Player_UpdateOnRails(Player* player) { @@ -5760,7 +5761,7 @@ void Player_Update360(Player* player) { void Player_LowHealthMsg(Player* player) { s32 teamId; - if ((player->state_1C8 == PLAYERSTATE_1C8_ACTIVE) && (gTeamLowHealthMsgTimer >= 0)) { + if ((player->state == PLAYERSTATE_ACTIVE) && (gTeamLowHealthMsgTimer >= 0)) { gTeamLowHealthMsgTimer++; if (gTeamLowHealthMsgTimer > 32 * 30) { gTeamLowHealthMsgTimer = 0; @@ -5832,13 +5833,13 @@ void Player_Update(Player* player) { *gControllerRumble = 1; } } - if (player->state_1C8 > PLAYERSTATE_1C8_INIT) { + if (player->state > PLAYERSTATE_INIT) { Player_UpdateEffects(player); } player->flags_228 = 0; - if ((player->state_1C8 > PLAYERSTATE_1C8_INIT) && (player->form == FORM_ARWING) && !gVersusMode) { + if ((player->state > PLAYERSTATE_INIT) && (player->form == FORM_ARWING) && !gVersusMode) { switch (player->wingPosition) { case 0: sp1C4 = Animation_GetFrameData(&D_arwing_3015AF4, 0, sp58); @@ -5858,28 +5859,28 @@ void Player_Update(Player* player) { player->whooshTimer--; } - switch (player->state_1C8) { - case PLAYERSTATE_1C8_STANDBY: + switch (player->state) { + case PLAYERSTATE_STANDBY: player->draw = false; - gShowHud = 0; + gShowHud = false; gPauseEnabled = false; break; - case PLAYERSTATE_1C8_INIT: + case PLAYERSTATE_INIT: Player_Setup(player); gFillScreenAlphaTarget = 0; gPauseEnabled = false; break; - case PLAYERSTATE_1C8_LEVEL_INTRO: - gShowHud = 0; + case PLAYERSTATE_LEVEL_INTRO: + gShowHud = false; gPauseEnabled = false; player->arwing.drawFace = true; Cutscene_LevelStart(player); break; - case PLAYERSTATE_1C8_ACTIVE: - gShowHud = 1; + case PLAYERSTATE_ACTIVE: + gShowHud = true; Player_LowHealthMsg(player); player->arwing.drawFace = false; D_hud_80161704 = 255; @@ -5914,7 +5915,7 @@ void Player_Update(Player* player) { sp1C4 = RAND_INT(3.9f); } while (gPlayerInactive[sp1C4]); player->attacker = sp1C4 + 1; - player->state_1C8 = PLAYERSTATE_1C8_VS_STANDBY; + player->state = PLAYERSTATE_VS_STANDBY; player->csState = 0; Camera_FollowPlayer(player, player->attacker - 1, 1); } else { @@ -5943,11 +5944,11 @@ void Player_Update(Player* player) { } break; - case PLAYERSTATE_1C8_DOWN: + case PLAYERSTATE_DOWN: Cutscene_PlayerDown(player); break; - case PLAYERSTATE_1C8_U_TURN: + case PLAYERSTATE_U_TURN: if (gVersusMode) { gVsLockOnTimers[player->num][0] = gVsLockOnTimers[player->num][1] = gVsLockOnTimers[player->num][2] = gVsLockOnTimers[player->num][3] = 0; @@ -5969,7 +5970,8 @@ void Player_Update(Player* player) { Player_CheckItemCollect(player); } break; - case PLAYERSTATE_1C8_LEVEL_COMPLETE: + + case PLAYERSTATE_LEVEL_COMPLETE: player->alternateView = false; gPauseEnabled = false; Player_UpdateShields(player); @@ -5978,14 +5980,14 @@ void Player_Update(Player* player) { gShowHud = gChargeTimers[player->num] = 0; break; - case PLAYERSTATE_1C8_ENTER_WARP_ZONE: + case PLAYERSTATE_ENTER_WARP_ZONE: gPauseEnabled = false; Player_UpdateShields(player); Cutscene_EnterWarpZone(player); - gShowHud = 0; + gShowHud = false; break; - case PLAYERSTATE_1C8_START_360: + case PLAYERSTATE_START_360: gPauseEnabled = false; Player_UpdateShields(player); Cutscene_AllRangeMode(player); @@ -5993,21 +5995,21 @@ void Player_Update(Player* player) { gChargeTimers[player->num] = player->alternateView = gShowHud = 0; break; - case PLAYERSTATE_1C8_GFOX_REPAIR: + case PLAYERSTATE_GFOX_REPAIR: gPauseEnabled = false; AllRange_GreatFoxRepair(player); - gShowHud = 0; + gShowHud = false; break; - case PLAYERSTATE_1C8_ANDROSS_MOUTH: + case PLAYERSTATE_ANDROSS_MOUTH: Andross_8018C390(player); Player_UpdateShields(player); break; - case PLAYERSTATE_1C8_12: + case PLAYERSTATE_UNK_12: break; - case PLAYERSTATE_1C8_VS_STANDBY: + case PLAYERSTATE_VS_STANDBY: player->draw = false; if (gPlayerInactive[player->num] == true) { Camera_FollowPlayer(player, player->attacker - 1, 0); @@ -6027,8 +6029,8 @@ void Player_Update(Player* player) { } break; - case PLAYERSTATE_1C8_NEXT: - gShowHud = 0; + case PLAYERSTATE_NEXT: + gShowHud = false; if (!gVersusMode) { gPauseEnabled = false; @@ -6048,7 +6050,7 @@ void Player_Update(Player* player) { } if (player->csTimer == 0) { if (gCamCount == 4) { - player->state_1C8 = PLAYERSTATE_1C8_VS_STANDBY; + player->state = PLAYERSTATE_VS_STANDBY; player->csTimer = 200; } else { gFillScreenRed = gFillScreenGreen = gFillScreenBlue = 0; @@ -6126,7 +6128,7 @@ void Player_Update(Player* player) { Math_SmoothStepToF(&player->pathWidth, sp1C8, 1.0f, 10.0f, 0.0f); if (player->form == FORM_ARWING) { Math_SmoothStepToF(&player->unk_194, player->unk_190, 0.5f, 5.0f, 0.0f); - if (player->boostCooldown && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE)) { + if (player->boostCooldown && (gPlayer[0].state == PLAYERSTATE_ACTIVE)) { player->unk_190 = 0.5f; } else { player->unk_190 = 1.0f; @@ -6144,14 +6146,15 @@ void Camera_UpdateArwingOnRails(Player* player) { f32 temp; gCsCamEyeX = (player->pos.x - player->xPath) * player->unk_148; - if (((player->form == FORM_ARWING) && (player->state_1C8 == PLAYERSTATE_1C8_ACTIVE)) || - (player->state_1C8 == PLAYERSTATE_1C8_U_TURN)) { + + if (((player->form == FORM_ARWING) && (player->state == PLAYERSTATE_ACTIVE)) || + (player->state == PLAYERSTATE_U_TURN)) { gCsCamEyeY = (player->pos.y - player->yPath) * player->unk_148; } var_fv1 = gInputPress->stick_x; var_fv0 = -gInputPress->stick_y; - if ((player->state_1C8 != PLAYERSTATE_1C8_ACTIVE) || player->somersault) { + if ((player->state != PLAYERSTATE_ACTIVE) || player->somersault) { var_fv0 = 0.0f; var_fv1 = 0; } @@ -6266,7 +6269,7 @@ void Camera_FollowPlayer(Player* player, s32 playerNum, bool arg2) { if (((gGameFrameCount & mask) == (gPlayerNum * 32)) || arg2) { for (i = 0; i < 100; i++) { playerNum = RAND_INT(3.9f); - if ((gPlayer[playerNum].state_1C8 != PLAYERSTATE_1C8_VS_STANDBY) && !gPlayerInactive[playerNum]) { + if ((gPlayer[playerNum].state != PLAYERSTATE_VS_STANDBY) && !gPlayerInactive[playerNum]) { break; } } @@ -6373,7 +6376,7 @@ void Camera_UpdateArwing360(Player* player, bool arg1) { var_fv0 = (player->somersault) ? 1.0f : 0.79f; atY = (player->pos.y * (var_fv0)) + player->damageShake + (player->xRock * 5.0f); atY += (player->unk_02C * 0.5f); - if (player->state_1C8 == PLAYERSTATE_1C8_U_TURN) { + if (player->state == PLAYERSTATE_U_TURN) { atY = player->pos.y; } atZ = player->pos.z; @@ -6390,7 +6393,8 @@ void Camera_UpdateArwing360(Player* player, bool arg1) { eyeZ += sp68.z; atX += sp68.x; atZ += sp68.z; - if (player->state_1C8 == PLAYERSTATE_1C8_ACTIVE) { + + if (player->state == PLAYERSTATE_ACTIVE) { Math_SmoothStepToF(&player->cam.eye.x, eyeX, player->unk_014, 30000.0f, 0); Math_SmoothStepToF(&player->cam.eye.y, eyeY, player->unk_014, 30000.0f, 0); Math_SmoothStepToF(&player->cam.eye.z, eyeZ, player->unk_014, 30000.0f, 0); @@ -6564,8 +6568,7 @@ void Camera_SetStarfieldPos(f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 gStarfieldX = FloatMod(sp34, starfieldWidth); gStarfieldY = FloatMod(sp30, starfieldHeight); - // Special case handling for specific game state and level - if ((gGameState == GSTATE_PLAY) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) && + if ((gGameState == GSTATE_PLAY) && (gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO) && (gCurrentLevel == LEVEL_METEO)) { if (fabsf(gStarfieldX - sp20) < 50.0f) { D_bg_8015F96C = 0.0f; @@ -6591,8 +6594,8 @@ void Camera_Update360(Player* player, bool arg1) { } void Camera_Update(Player* player) { - switch (player->state_1C8) { - case PLAYERSTATE_1C8_ACTIVE: + switch (player->state) { + case PLAYERSTATE_ACTIVE: switch (gLevelMode) { case LEVELMODE_ON_RAILS: if (player->form == FORM_ARWING) { @@ -6618,12 +6621,12 @@ void Camera_Update(Player* player) { } break; - case PLAYERSTATE_1C8_U_TURN: + case PLAYERSTATE_U_TURN: player->camRoll -= player->camRoll * 0.1f; Camera_Update360(player, false); break; - case PLAYERSTATE_1C8_DOWN: + case PLAYERSTATE_DOWN: if ((gLevelMode == LEVELMODE_ON_RAILS) && (player->form == FORM_ARWING)) { player->cam.eye.x += (player->pos.x - player->cam.eye.x) * 0.1f; player->cam.eye.y += (player->pos.y - player->cam.eye.y) * 0.1f; @@ -6636,8 +6639,9 @@ void Camera_Update(Player* player) { player->cam.at.z = player->trueZpos + gPathProgress - 1.0f; } break; - case PLAYERSTATE_1C8_NEXT: - case PLAYERSTATE_1C8_LEVEL_COMPLETE: + + case PLAYERSTATE_NEXT: + case PLAYERSTATE_LEVEL_COMPLETE: break; } } @@ -6647,7 +6651,7 @@ void Camera_SetupLights(Player* player) { Vec3f dest; f32 pad; - if ((gCurrentLevel == LEVEL_AQUAS) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_INTRO)) { + if ((gCurrentLevel == LEVEL_AQUAS) && (gPlayer[0].state != PLAYERSTATE_LEVEL_INTRO)) { gEnvLightyRot = gLight1yRotTarget = gLight1yRotTarget = gLight2yRotTarget = gLight1yRotTarget = 110.0f; if ((gGameFrameCount & 0x20) != 0) { gEnvLightyRot = gLight1yRotTarget = gLight1yRotTarget = gLight2yRotTarget = gLight1yRotTarget = 90.0f; @@ -6777,8 +6781,8 @@ void Play_UpdateLevel(void) { break; case LEVEL_VENOM_2: - if ((gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_COMPLETE) && (gLevelPhase == 2)) { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + if ((gPlayer[0].state != PLAYERSTATE_LEVEL_COMPLETE) && (gLevelPhase == 2)) { + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; gPlayer[0].csState = 0; gPlayer[0].draw = true; gPlayer[0].pos.z = 15000.0f; @@ -6810,7 +6814,7 @@ void Play_UpdateLevel(void) { case LEVEL_SECTOR_X: if (gLevelPhase == 1) { gBlurAlpha = 128; - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) { + if (gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE) { Math_SmoothStepToF(&gWarpZoneBgAlpha, 0.0f, 1.0f, 1.0f, 0.0f); } else { Math_SmoothStepToF(&gWarpZoneBgAlpha, 128.0f, 1.0f, 1.0f, 0.0f); @@ -6819,7 +6823,7 @@ void Play_UpdateLevel(void) { if ((gCurrentLevel == LEVEL_SECTOR_X) && (gLevelPhase == 0) && (gRingPassCount == 4)) { gRingPassCount++; - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_ENTER_WARP_ZONE; + gPlayer[0].state = PLAYERSTATE_ENTER_WARP_ZONE; gPlayer[0].csState = 0; gSceneSetup = 1; AUDIO_PLAY_SFX(NA_SE_WARP_HOLE, gDefaultSfxSource, 0); @@ -6845,7 +6849,7 @@ void Play_UpdateLevel(void) { for (gPathTexScroll; gPathTexScroll >= 10.0f; gPathTexScroll -= 10.0f) { Lib_Texture_Scroll(D_SO_6005710, 32, 32, 1); } - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_NEXT) { + if (gPlayer[0].state == PLAYERSTATE_NEXT) { Lib_Texture_Scroll(D_SO_6005710, 32, 32, 1); } Lib_Texture_Mottle(D_SO_601E1E8, D_SO_6020F60, 3); @@ -6875,7 +6879,7 @@ void Play_UpdateLevel(void) { #endif } - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) && ((gGameFrameCount & cycleMask) == 0)) { + if ((gPlayer[0].state == PLAYERSTATE_ACTIVE) && ((gGameFrameCount & cycleMask) == 0)) { gPlayer[0].shields--; if (gPlayer[0].shields <= 0) { gPlayer[0].shields = 0; @@ -6893,7 +6897,7 @@ void Play_UpdateLevel(void) { Audio_SetHeatAlarmParams(shields, heightParam); - if (((gGameFrameCount % 8) == 0) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_COMPLETE)) { + if (((gGameFrameCount % 8) == 0) && (gPlayer[0].state != PLAYERSTATE_LEVEL_COMPLETE)) { Solar_8019E8B8(RAND_FLOAT_CENTERED(6000.0f), -80.0f, gPlayer[0].trueZpos + (RAND_FLOAT(2000.0f) + -6000.0f), RAND_FLOAT(10.0f) + 20.0f); // check @@ -6911,7 +6915,7 @@ void Play_UpdateLevel(void) { for (gPathTexScroll; gPathTexScroll >= 20.0f; gPathTexScroll -= 20.0f) { Lib_Texture_Scroll(D_ZO_602C2CC, 32, 32, 1); } - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_NEXT) { + if (gPlayer[0].state == PLAYERSTATE_NEXT) { Lib_Texture_Scroll(D_ZO_602C2CC, 32, 32, 1); } @@ -7094,7 +7098,7 @@ void Play_Main(void) { Play_Update(); if ((gControllerPress[gMainController].button & START_BUTTON) && - (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_INTRO) && + (gPlayer[0].state == PLAYERSTATE_LEVEL_INTRO) && gSaveFile.save.data.planet[sSaveSlotFromLevel[gCurrentLevel]].normalClear) { Audio_ClearVoice(); Audio_SetEnvSfxReverb(0); @@ -7127,7 +7131,7 @@ void Play_Main(void) { case PLAY_PAUSE: if (!gVersusMode) { if ((gControllerPress[gMainController].button & R_TRIG) && (gPlayer[0].form != FORM_BLUE_MARINE) && - (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_STANDBY)) { + (gPlayer[0].state != PLAYERSTATE_STANDBY)) { if (gShowReticles[0] = 1 - gShowReticles[0]) { AUDIO_PLAY_SFX(NA_SE_MAP_WINDOW_OPEN, gDefaultSfxSource, 4); } else { diff --git a/src/engine/fox_radio.c b/src/engine/fox_radio.c index 28312d9c..21052f1d 100644 --- a/src/engine/fox_radio.c +++ b/src/engine/fox_radio.c @@ -757,7 +757,7 @@ void Radio_Draw(void) { } if ((gActors[idx].obj.status != OBJ_ACTIVE) && (gGameFrameCount & 4) && - (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) && (gCurrentRadioPortrait != RCID_STATIC) && + (gPlayer[0].state == PLAYERSTATE_ACTIVE) && (gCurrentRadioPortrait != RCID_STATIC) && (gCurrentRadioPortrait != RCID_STATIC + 1) && (gCurrentRadioPortrait != RCID_1000)) { RCP_SetupDL(&gMasterDisp, SETUPDL_76_POINT); gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 0, 255); @@ -779,6 +779,7 @@ void Radio_Draw(void) { } } +// Unused in VERSION_US and absent in VERSION_EU, probably a leftover from VERSION_JP ? void func_radio_800BC040(void) { if (gPlayState != PLAY_PAUSE) { if (gRadioStateTimer > 0) { diff --git a/src/engine/fox_save.c b/src/engine/fox_save.c index 42153c93..4fd0b4ea 100644 --- a/src/engine/fox_save.c +++ b/src/engine/fox_save.c @@ -1,27 +1,128 @@ #include "global.h" SaveFile gSaveFile; + +// clang-format off + Save gDefaultSave = { - { - // Replace with SaveData once that struct is complete - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x02, 0x03, 0x04, 0x00, 0x63, 0x63, 0x63, 0x46, 0x4F, 0x58, 0x50, 0x45, 0x50, 0x53, 0x4C, 0x50, 0x46, - 0x41, 0x4C, 0x57, 0x4C, 0x46, 0x4C, 0x4F, 0x4E, 0x50, 0x49, 0x47, 0x41, 0x4E, 0x52, 0x42, 0x49, 0x4C, - 0x4B, 0x41, 0x54, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x90, 0x09, 0x57, 0x09, 0xB7, 0x09, 0x87, - 0x09, 0x37, 0x09, 0x17, 0x09, 0xF7, 0x5A, 0x90, 0x09, 0x54, 0x09, 0x64, 0x09, 0xD4, 0x09, 0x74, 0x09, - 0x14, 0x09, 0xF4, 0x50, 0x90, 0x09, 0x02, 0x09, 0xC2, 0x09, 0x42, 0x09, 0xA2, 0x09, 0x22, 0x09, 0xE2, - 0x46, 0x90, 0x09, 0x01, 0x09, 0xC1, 0x09, 0x41, 0x09, 0xA1, 0x09, 0x21, 0x09, 0xE1, 0x3C, 0x90, 0x09, - 0x05, 0x09, 0xC5, 0x09, 0x45, 0x09, 0xA5, 0x09, 0x25, 0x09, 0xE5, 0x32, 0x90, 0x04, 0x03, 0x09, 0xC3, - 0x09, 0x43, 0x09, 0xA3, 0x09, 0x23, 0x09, 0xE3, 0x28, 0x90, 0x01, 0x06, 0x02, 0xC6, 0x09, 0x46, 0x09, - 0xA6, 0x09, 0x26, 0x09, 0xE6, 0x1E, 0x90, 0x01, 0x02, 0x01, 0xC4, 0x01, 0x47, 0x08, 0xA5, 0x09, 0x23, - 0x09, 0xE6, 0x14, 0x90, 0x01, 0x03, 0x01, 0xC5, 0x01, 0x47, 0x01, 0xA4, 0x06, 0x22, 0x09, 0xE1, 0x0A, - 0x90, 0x01, 0x07, 0x01, 0xC4, 0x01, 0x44, 0x01, 0xA2, 0x01, 0x21, 0x04, 0xE5, 0xFF, 0x09, 0x01, 0x02, - 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, - }, - 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // PlanetData + + 0x01, 0x02, 0x03, 0x04, // pad10 + + SOUNDMODE_STEREO, + 99, // musicVolume + 99, // voiceVolume + 99, // sfxVolume + + // rankNameEntry + 'F', 'O', 'X', + 'P', 'E', 'P', + 'S', 'L', 'P', + 'F', 'A', 'L', + 'W', 'L', 'F', + 'L', 'O', 'N', + 'P', 'I', 'G', + 'A', 'N', 'R', + 'B', 'I', 'L', + 'K', 'A', 'T', + + // rankingRoute + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + // rankingLives + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + // rankingMedal + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + // stats + PLANET_STATS(100, PLANET_CORNERIA, false, false, false), + PLANET_STATS(9, PLANET_SECTOR_Y, true, true, true), + PLANET_STATS(9, PLANET_AQUAS, true, true, true), + PLANET_STATS(9, PLANET_ZONESS, true, true, true), + PLANET_STATS(9, PLANET_SECTOR_Z, true, true, true), + PLANET_STATS(9, PLANET_AREA_6, true, true, true), + PLANET_STATS(9, SAVE_SLOT_VENOM_2, true, true, true), + + PLANET_STATS(90, PLANET_CORNERIA, false, false, false), + PLANET_STATS(9, PLANET_SECTOR_Y, true, false, false), + PLANET_STATS(9, PLANET_KATINA, true, false, false), + PLANET_STATS(9, PLANET_VENOM, true, false, false), + PLANET_STATS(9, PLANET_MACBETH, true, false, false), + PLANET_STATS(9, PLANET_AREA_6, true, false, false), + PLANET_STATS(9, SAVE_SLOT_VENOM_2, true, false, false), + + PLANET_STATS(80, PLANET_CORNERIA, false, false, false), + PLANET_STATS(9, PLANET_METEO, false, true, false), + PLANET_STATS(9, PLANET_FORTUNA, false, true, false), + PLANET_STATS(9, PLANET_SECTOR_X, false, true, false), + PLANET_STATS(9, PLANET_TITANIA, false, true, false), + PLANET_STATS(9, PLANET_BOLSE, false, true, false), + PLANET_STATS(9, SAVE_SLOT_VENOM_1, false, true, false), + + PLANET_STATS(70, PLANET_CORNERIA, false, false, false), + PLANET_STATS(9, PLANET_METEO, false, false, true), + PLANET_STATS(9, PLANET_FORTUNA, false, false, true), + PLANET_STATS(9, PLANET_SECTOR_X, false, false, true), + PLANET_STATS(9, PLANET_TITANIA, false, false, true), + PLANET_STATS(9, PLANET_BOLSE, false, false, true), + PLANET_STATS(9, SAVE_SLOT_VENOM_1, false, false, true), + + PLANET_STATS(60, PLANET_CORNERIA, false, false, false), + PLANET_STATS(9, PLANET_METEO, true, false, true), + PLANET_STATS(9, PLANET_FORTUNA, true, false, true), + PLANET_STATS(9, PLANET_SECTOR_X, true, false, true), + PLANET_STATS(9, PLANET_TITANIA, true, false, true), + PLANET_STATS(9, PLANET_BOLSE, true, false, true), + PLANET_STATS(9, SAVE_SLOT_VENOM_1, true, false, true), + + PLANET_STATS(50, PLANET_CORNERIA, false, false, false), + PLANET_STATS(4, PLANET_METEO, false, true, true), + PLANET_STATS(9, PLANET_FORTUNA, false, true, true), + PLANET_STATS(9, PLANET_SECTOR_X, false, true, true), + PLANET_STATS(9, PLANET_TITANIA, false, true, true), + PLANET_STATS(9, PLANET_BOLSE, false, true, true), + PLANET_STATS(9, SAVE_SLOT_VENOM_1, false, true, true), + + PLANET_STATS(40, PLANET_CORNERIA, false, false, false), + PLANET_STATS(1, PLANET_METEO, true, true, false), + PLANET_STATS(2, PLANET_FORTUNA, true, true, false), + PLANET_STATS(9, PLANET_SECTOR_X, true, true, false), + PLANET_STATS(9, PLANET_TITANIA, true, true, false), + PLANET_STATS(9, PLANET_BOLSE, true, true, false), + PLANET_STATS(9, SAVE_SLOT_VENOM_1, true, true, false), + + PLANET_STATS(30, PLANET_CORNERIA, false, false, false), + PLANET_STATS(1, PLANET_METEO, false, true, false), + PLANET_STATS(1, PLANET_FORTUNA, true, false, false), + PLANET_STATS(1, PLANET_SECTOR_X, true, true, true), + PLANET_STATS(8, PLANET_TITANIA, true, false, true), + PLANET_STATS(9, PLANET_BOLSE, false, true, true), + PLANET_STATS(9, SAVE_SLOT_VENOM_1, true, true, false), + + PLANET_STATS(20, PLANET_CORNERIA, false, false, false), + PLANET_STATS(1, PLANET_METEO, false, true, true), + PLANET_STATS(1, PLANET_FORTUNA, true, false, true), + PLANET_STATS(1, PLANET_SECTOR_X, true, true, true), + PLANET_STATS(1, PLANET_TITANIA, true, false, false), + PLANET_STATS(6, PLANET_BOLSE, false, true, false), + PLANET_STATS(9, SAVE_SLOT_VENOM_1, false, false, true), + + PLANET_STATS(10, PLANET_CORNERIA, false, false, false), + PLANET_STATS(1, PLANET_METEO, true, true, true), + PLANET_STATS(1, PLANET_FORTUNA, true, false, false), + PLANET_STATS(1, PLANET_SECTOR_X, true, false, false), + PLANET_STATS(1, PLANET_TITANIA, false, true, false), + PLANET_STATS(1, PLANET_BOLSE, false, false, true), + PLANET_STATS(4, SAVE_SLOT_VENOM_1, true, false, true), + + // unk_EA + 0xFF, + + // padding + 0x09, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, }; +// clang-format on u16 Save_Checksum(Save* arg0) { u16 var_v1; diff --git a/src/engine/fox_std_lib.c b/src/engine/fox_std_lib.c index c34a617d..df06c881 100644 --- a/src/engine/fox_std_lib.c +++ b/src/engine/fox_std_lib.c @@ -229,10 +229,12 @@ void Animation_DrawSkeleton(s32 mode, Limb** skeletonSegment, Vec3f* jointTable, Matrix_Push(&gCalcMatrix); Matrix_Copy(gCalcMatrix, transform); - skeleton = LOAD_ASSET(skeletonSegment); + + skeleton = SEGMENTED_TO_VIRTUAL(skeletonSegment); rootLimb = SEGMENTED_TO_VIRTUAL(skeleton[0]); rootIndex = Animation_GetLimbIndex(skeleton[0], skeleton); baseRot = jointTable[rootIndex]; + if (mode & 1) { baseTrans.x = rootLimb->trans.x; baseTrans.y = rootLimb->trans.y; @@ -242,6 +244,7 @@ void Animation_DrawSkeleton(s32 mode, Limb** skeletonSegment, Vec3f* jointTable, baseTrans.y = jointTable[0].y; baseTrans.z = jointTable[0].z; } + dList = rootLimb->dList; Matrix_Push(&gGfxMatrix); @@ -249,11 +252,11 @@ void Animation_DrawSkeleton(s32 mode, Limb** skeletonSegment, Vec3f* jointTable, FrameInterpolation_RecordOpenChild(TAG_LIMB(rootLimb, data), rootIndex); if (overrideLimbDraw == NULL) { - override = 0; + override = false; } else { override = overrideLimbDraw(rootIndex - 1, &dList, &baseTrans, &baseRot, data); } - if (override == 0) { + if (!override) { Matrix_Translate(gCalcMatrix, baseTrans.x, baseTrans.y, baseTrans.z, MTXF_APPLY); Matrix_RotateZ(gCalcMatrix, baseRot.z * M_DTOR, MTXF_APPLY); Matrix_RotateY(gCalcMatrix, baseRot.y * M_DTOR, MTXF_APPLY); @@ -272,10 +275,12 @@ void Animation_DrawSkeleton(s32 mode, Limb** skeletonSegment, Vec3f* jointTable, FrameInterpolation_RecordCloseChild(); Matrix_Pop(&gGfxMatrix); + if (rootLimb->child != NULL) { Animation_DrawLimb(mode, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, data); } Matrix_Pop(&gCalcMatrix); + if (mode >= 2) { Matrix_Mult(gGfxMatrix, gCalcMatrix, MTXF_APPLY); } diff --git a/src/engine/fox_tank.c b/src/engine/fox_tank.c index 37046d84..1b0b0f61 100644 --- a/src/engine/fox_tank.c +++ b/src/engine/fox_tank.c @@ -490,7 +490,7 @@ void func_tank_80044868(Player* player) { if ((gCurrentLevel == LEVEL_TITANIA) && !gBossActive) { func_tank_80043280(D_landmaster_3005EA8, D_TI_6009BB8, gGameFrameCount * -55.0f); } - if ((gCurrentLevel == LEVEL_MACBETH) && (player->state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE)) { + if ((gCurrentLevel == LEVEL_MACBETH) && (player->state == PLAYERSTATE_LEVEL_COMPLETE)) { // Using D_TI_6009BB8 since it's the same texture, D_Tex_800DACB8 might be imported incorrectly. func_tank_80043280(D_landmaster_3005EA8, /* D_Tex_800DACB8 */ D_TI_6009BB8, gGameFrameCount * -55.0f); } @@ -1305,7 +1305,7 @@ void func_tank_80047FBC(Player* player) { if (!(D_800C9F08 & 1)) { Math_SmoothStepToF(&player->rot.z, -((player->vel.z / 5.0f) * 4.0f), 0.4f, 8.0f, 0.01f); if (player->rot.z >= 3.0f) { - if (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_COMPLETE) { + if (gPlayer[0].state != PLAYERSTATE_LEVEL_COMPLETE) { AUDIO_PLAY_SFX(NA_SE_RAILWAY_BOUND, player->sfxSource, 0); } D_800C9F08 |= 1; @@ -1471,7 +1471,8 @@ void func_tank_800481F4(Player* player) { actor->obj.rot.y, actor->obj.rot.z, 0.0f, 0.0f, 0.0f); if (temp_v0 != 0) { actor->dmgType = DMG_COLLISION; - if ((actor->obj.id == OBJ_ACTOR_TI_LANDMINE) || (actor->obj.id == OBJ_MISSILE_SEEK_TEAM)) { + if ((actor->obj.id == OBJ_ACTOR_TI_LANDMINE) || + (actor->obj.id == OBJ_ACTOR_MISSILE_SEEK_TEAM)) { actor->dmgType = -1; } if (actor->info.damage) { diff --git a/src/engine/fox_versus.c b/src/engine/fox_versus.c index eece919a..fb56a60e 100644 --- a/src/engine/fox_versus.c +++ b/src/engine/fox_versus.c @@ -267,7 +267,7 @@ void func_versus_800BDE44(void) { gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255); for (i = 0; i < 4; i++) { - if ((gPlayer[i].state_1C8 == PLAYERSTATE_1C8_ACTIVE) || (gPlayer[i].state_1C8 == PLAYERSTATE_1C8_U_TURN)) { + if ((gPlayer[i].state == PLAYERSTATE_ACTIVE) || (gPlayer[i].state == PLAYERSTATE_U_TURN)) { if ((gPlayerScores[i] != sVsDisplayedScores[i]) || (D_80178810[i] != 0)) { D_80178810[i] += 4; if (D_80178810[i] > 15) { @@ -590,7 +590,7 @@ s32 Versus_UpdatePlayerStatus(void) { for (i = 0, ret = 0; i < 4; i++) { D_80178850[i] = true; - if (gPlayer[i].state_1C8 != PLAYERSTATE_1C8_VS_STANDBY) { + if (gPlayer[i].state != PLAYERSTATE_VS_STANDBY) { D_80178850[i] = false; sPlayerRespawnTimer[i] = 150; continue; @@ -714,7 +714,7 @@ void func_versus_800BF750(void) { RCP_SetupDL(&gMasterDisp, SETUPDL_76); for (i = 0; i < 4; i++) { - if (gPlayer[i].state_1C8 != PLAYERSTATE_1C8_ACTIVE) { + if (gPlayer[i].state != PLAYERSTATE_ACTIVE) { continue; } for (j = 0, temp = 0; j < 4; j++) { @@ -737,10 +737,10 @@ bool Versus_CheckForWinner(void) { switch (gVsMatchType) { case VS_MATCH_POINTS: for (i = 0, numDown = 0; i < 4; i++) { - if (gPlayer[i].state_1C8 != PLAYERSTATE_1C8_VS_STANDBY) { + if (gPlayer[i].state != PLAYERSTATE_VS_STANDBY) { sVsWinner = i; } - if (gPlayer[i].state_1C8 == PLAYERSTATE_1C8_VS_STANDBY) { + if (gPlayer[i].state == PLAYERSTATE_VS_STANDBY) { numDown++; } } @@ -772,7 +772,7 @@ bool Versus_CheckForWinner(void) { if (gPlayer[j].attacker >= 0) { gPlayer[j].attacker = i + 1; } - gPlayer[j].state_1C8 = PLAYERSTATE_1C8_VS_STANDBY; + gPlayer[j].state = PLAYERSTATE_VS_STANDBY; } gVsMatchWon = true; sVsWinner = i; @@ -781,10 +781,10 @@ bool Versus_CheckForWinner(void) { case VS_MATCH_BATTLE: for (i = 0, numDown = 0; i < 4; i++) { - if (gPlayer[i].state_1C8 != PLAYERSTATE_1C8_VS_STANDBY) { + if (gPlayer[i].state != PLAYERSTATE_VS_STANDBY) { sVsWinner = i; } - if (gPlayer[i].state_1C8 == PLAYERSTATE_1C8_VS_STANDBY) { + if (gPlayer[i].state == PLAYERSTATE_VS_STANDBY) { numDown++; } } @@ -811,7 +811,7 @@ bool Versus_CheckForWinner(void) { if (gPlayer[j].attacker >= 0) { gPlayer[j].attacker = i + 1; } - gPlayer[j].state_1C8 = PLAYERSTATE_1C8_VS_STANDBY; + gPlayer[j].state = PLAYERSTATE_VS_STANDBY; } gVsMatchWon = true; } @@ -824,8 +824,7 @@ bool Versus_CheckForWinner(void) { if (gVsMatchType == VS_MATCH_TIME) { for (i = 0; i < 4; i++) { - if ((gPlayer[i].state_1C8 == PLAYERSTATE_1C8_DOWN) || - (gPlayer[i].state_1C8 == PLAYERSTATE_1C8_VS_STANDBY)) { + if ((gPlayer[i].state == PLAYERSTATE_DOWN) || (gPlayer[i].state == PLAYERSTATE_VS_STANDBY)) { gPlayerScores[i] = D_80178838[i] = sVsDisplayedScores[i] = D_80178810[i] = 0; sPlayerDownFrames[i]++; } @@ -912,7 +911,7 @@ bool Versus_CheckForWinner(void) { gPlayer[j].attacker = i + 1; } - gPlayer[j].state_1C8 = PLAYERSTATE_1C8_VS_STANDBY; + gPlayer[j].state = PLAYERSTATE_VS_STANDBY; } gVsMatchWon = true; break; diff --git a/src/mods/object_ram.c b/src/mods/object_ram.c index 092a3bfd..7272265c 100644 --- a/src/mods/object_ram.c +++ b/src/mods/object_ram.c @@ -413,7 +413,7 @@ void CheatRam_SpawnCheckpoint(void) { static ItemCheckpoint* checkpoint = NULL; s32 i; - if ((gLevelMode != LEVELMODE_ON_RAILS) || (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_ACTIVE)) { + if ((gLevelMode != LEVELMODE_ON_RAILS) || (gPlayer[0].state != PLAYERSTATE_ACTIVE)) { return; } @@ -564,7 +564,7 @@ void CheatRam_UpdateEntry(CheatEntry* cheat) { } break; case CHEAT_COMPLETE: - if ((gCurrentLevel == LEVEL_CORNERIA) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_COMPLETE)) { + if ((gCurrentLevel == LEVEL_CORNERIA) && (gPlayer[0].state != PLAYERSTATE_LEVEL_COMPLETE)) { if ((gLevelMode == LEVELMODE_ON_RAILS) && (cheat->option == MISSION_COMPLETE)) { gScenery360 = Memory_Allocate(200 * sizeof(Scenery360)); gLevelMode = LEVELMODE_ALL_RANGE; @@ -572,7 +572,7 @@ void CheatRam_UpdateEntry(CheatEntry* cheat) { gLevelMode = LEVELMODE_ON_RAILS; } } - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; default: cheat->ram[0].data.i = cheat->option; break; @@ -670,8 +670,8 @@ void RamMod_Update(void) { return; } - if ((contPress->button & START_BUTTON) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE)) { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_NEXT; + if ((contPress->button & START_BUTTON) && (gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE)) { + gPlayer[0].state = PLAYERSTATE_NEXT; Audio_FadeOutAll(10); gFadeoutType = 4; gLeveLClearStatus[gCurrentLevel] = Play_CheckMedalStatus(medalCount[gCurrentLevel]) + 1; diff --git a/src/mods/spawner.c b/src/mods/spawner.c index f7e4a219..4733bd2f 100644 --- a/src/mods/spawner.c +++ b/src/mods/spawner.c @@ -312,9 +312,9 @@ void Spawner_Playground(void) { #if 0 if (gControllerPress[0].button & L_JPAD) { - gArwingSpeed-=50; + gArwingSpeed -= 50; } else if (gControllerPress[0].button & R_JPAD) { - gArwingSpeed+=50; + gArwingSpeed += 50; } #endif } diff --git a/src/overlays/ovl_ending/fox_end2.c b/src/overlays/ovl_ending/fox_end2.c index bf152e06..b94a8e23 100644 --- a/src/overlays/ovl_ending/fox_end2.c +++ b/src/overlays/ovl_ending/fox_end2.c @@ -239,12 +239,13 @@ bool Ending_8018DCB4(void) { teamAlive += (gMissionTeamStatus[i] & TEAMSTATUS_FALCO) & 1; } - for (i = 0; i < 10; i += 1) { + for (i = 0; i < 10; i++) { temp4[i] = 0; unk40[i] = gSaveFile.save.data.rankingLives[i]; - for (j = 0; j < 7; j += 1) { - temp4[i] += gSaveFile.save.data.stats[i][j].hitCount + (gSaveFile.save.data.stats[i][j].unk_C * 256); + for (j = 0; j < 7; j++) { + temp4[i] += + gSaveFile.save.data.stats[i][j].hitCount + (gSaveFile.save.data.stats[i][j].hitCountOver256 * 256); stats[i][0] += gSaveFile.save.data.stats[i][j].peppyAlive & 1; stats[i][1] += gSaveFile.save.data.stats[i][j].slippyAlive & 1; stats[i][2] += gSaveFile.save.data.stats[i][j].falcoAlive & 1; @@ -809,7 +810,7 @@ void Ending_80190CF0(u32 arg0, AssetInfo* asset) { gSPDisplayList(gMasterDisp++, D_END_7000000); } -void Ending_80191234(s32 arg0, s32 arg1) { +void Ending_80191234(u32 arg0, AssetInfo* asset) { gLastGameState = GSTATE_ENDING; gGameState = GSTATE_MENU; gNextGameStateTimer = 2; diff --git a/src/overlays/ovl_ending/fox_end2_data.c b/src/overlays/ovl_ending/fox_end2_data.c index d7c15137..db3fb8e6 100644 --- a/src/overlays/ovl_ending/fox_end2_data.c +++ b/src/overlays/ovl_ending/fox_end2_data.c @@ -72,7 +72,7 @@ void Ending_80190274(u32 arg0, AssetInfo* asset); void Ending_80190648(s32 arg0, AssetInfo* asset); void Ending_80190778(u32 arg0, AssetInfo* asset); void Ending_80190CF0(u32 arg0, AssetInfo* asset); -void Ending_80191234(s32 arg0, s32 arg1); +void Ending_80191234(u32 arg0, AssetInfo* asset); void Ending_80191294(u32 arg0, AssetInfo* asset); // clang-format off diff --git a/src/overlays/ovl_i1/fox_co.c b/src/overlays/ovl_i1/fox_co.c index 1904dd87..07ce439e 100644 --- a/src/overlays/ovl_i1/fox_co.c +++ b/src/overlays/ovl_i1/fox_co.c @@ -77,7 +77,7 @@ void Corneria_CoGranga_ShootLaser(CoGranga* this, f32 x, f32 y, f32 z) { this->obj.pos.z + dest.z, 100.0f); } -void Corneria_Granga_SpawnItem(Boss* arg0, f32 x, f32 y, f32 z, ObjectId itemId) { +void Corneria_Granga_SpawnItem(Boss* this, f32 x, f32 y, f32 z, ObjectId itemId) { s32 i; for (i = 0; i < ARRAY_COUNT(gItems); i++) { @@ -101,8 +101,8 @@ void Corneria_Granga_Init(CoGranga* this) { gBossFrameCount = 0; if (gLevelMode == LEVELMODE_ON_RAILS) { - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_START_360; + if (gPlayer[0].state == PLAYERSTATE_ACTIVE) { + gPlayer[0].state = PLAYERSTATE_START_360; gPlayer[0].csState = 0; SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); @@ -185,9 +185,8 @@ void Corneria_CoGranga_HandleDamage(CoGranga* this) { gCsFrameCount = 0; - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) || - (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_U_TURN)) { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + if ((gPlayer[0].state == PLAYERSTATE_ACTIVE) || (gPlayer[0].state == PLAYERSTATE_U_TURN)) { + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; gPlayer[0].csState = gPlayer[0].csTimer = 0; gPlayer[0].rot.y += gPlayer[0].yRot_114; @@ -397,9 +396,9 @@ ObjectId Corneria_CoGranga_ChooseMissileTarget(CoGranga* this) { */ if (this->swork[GRANGA_MISSILE_COUNT] >= 5) { this->swork[GRANGA_MISSILE_COUNT] = 0; - return OBJ_MISSILE_SEEK_PLAYER; + return OBJ_ACTOR_MISSILE_SEEK_PLAYER; } else if (ActorMissileSeek_ModeCheck(0) < 4) { - return OBJ_MISSILE_SEEK_TEAM; + return OBJ_ACTOR_MISSILE_SEEK_TEAM; } else { return 0; } @@ -620,7 +619,7 @@ void Corneria_CoGranga_Update(CoGranga* this) { Vec3f sp6C = { 0.0f, 0.0f, -30.0f }; f32 sp5C; - if (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_START_360) { + if (gPlayer[0].state != PLAYERSTATE_START_360) { if (!this->swork[GRANGA_INIT]) { this->swork[GRANGA_INIT]++; @@ -1642,10 +1641,10 @@ void Corneria_CoGarudaDestroy_Draw(CoGarudaDestroy* this) { void Corneria_CoCarrier_ChooseMissileTarget(CoCarrier* this, f32 xPos, f32 yPos, f32 zPos, f32 arg4, s32 arg5, s32 eventType) { - ObjectId objId = OBJ_MISSILE_SEEK_PLAYER; + ObjectId objId = OBJ_ACTOR_MISSILE_SEEK_PLAYER; if (ActorMissileSeek_ModeCheck(0) < 4) { - objId = OBJ_MISSILE_SEEK_TEAM; + objId = OBJ_ACTOR_MISSILE_SEEK_TEAM; } Corneria_BossMissile_Spawn(this->obj.pos.x + xPos, this->obj.pos.y + yPos, this->obj.pos.z + zPos, arg4, @@ -2193,8 +2192,7 @@ void Corneria_CoCarrier_Update(CoCarrier* this) { this->vel.y *= 1.5f; gMissionStatus = MISSION_ACCOMPLISHED; - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) || - (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_U_TURN)) { + if ((gPlayer[0].state == PLAYERSTATE_ACTIVE) || (gPlayer[0].state == PLAYERSTATE_U_TURN)) { Boss_CompleteLevel(gPlayer, this->obj.pos.x, this->obj.pos.y, this->obj.pos.z); } @@ -2850,7 +2848,6 @@ void Corneria_CsTeamSetup(ActorCutscene* this, s32 teamIdx) { this->fwork[0] = RAND_FLOAT(360.0f); Object_SetInfo(&this->info, this->obj.id); - this->drawShadow = true; this->iwork[11] = 1; this->info.cullDistance = 200.0f; @@ -2975,9 +2972,9 @@ void Corneria_LevelStart(Player* player) { Corneria_CsTeamSetup(slippy, 1); Corneria_CsTeamSetup(peppy, 2); - falco->iwork[14] = 2; - slippy->iwork[14] = 3; - peppy->iwork[14] = 4; + falco->iwork[TEAM_FACE] = FACE_FALCO; + slippy->iwork[TEAM_FACE] = FACE_SLIPPY; + peppy->iwork[TEAM_FACE] = FACE_PEPPY; player->cam.eye.x = gCsCamEyeX = player->pos.x - 400.0f; gPlayer[0].cam.eye.y = gCsCamEyeY = player->pos.y + 600.0f; @@ -3334,7 +3331,7 @@ void Corneria_LevelStart(Player* player) { player->cam.eye.x = player->pos.x; player->cam.eye.y = (player->pos.y * player->unk_148) + 50.0f; player->cam.eye.z = 30.0f; - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; player->csState = 0; player->cam.at.x = player->pos.x; player->cam.at.y = (player->pos.y * player->unk_148) + 20.0f; @@ -3619,7 +3616,7 @@ void Corneria_LevelComplete1(Player* player) { gFillScreenAlphaStep = 8; if (gFillScreenAlpha == 255) { - player->state_1C8 = PLAYERSTATE_1C8_NEXT; + player->state = PLAYERSTATE_NEXT; player->csTimer = 0; gFadeoutType = 4; gLeveLClearStatus[gCurrentLevel] = Play_CheckMedalStatus(150) + 1; diff --git a/src/overlays/ovl_i1/fox_tr360.c b/src/overlays/ovl_i1/fox_tr360.c index 55f03cdb..702b48d1 100644 --- a/src/overlays/ovl_i1/fox_tr360.c +++ b/src/overlays/ovl_i1/fox_tr360.c @@ -195,7 +195,7 @@ void Training_SpawnEnemies(void) { aiTypeIndex = 0; } - if (((gGameFrameCount % 4) == 0) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE)) { + if (((gGameFrameCount % 4) == 0) && (gPlayer[0].state == PLAYERSTATE_ACTIVE)) { src.x = 0.0f; src.y = 0.0f; src.z = -15000.0f; diff --git a/src/overlays/ovl_i1/fox_ve1.c b/src/overlays/ovl_i1/fox_ve1.c index aa82782a..370a3cdb 100644 --- a/src/overlays/ovl_i1/fox_ve1.c +++ b/src/overlays/ovl_i1/fox_ve1.c @@ -2385,7 +2385,7 @@ void Venom1_80198414(void) { void Venom1_Ve1Golemech_Dying(Ve1Golemech* this) { this->obj.pos.z = gPlayer[0].pos.z; - if ((this->timer_052 <= 0) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE)) { + if ((this->timer_052 <= 0) && (gPlayer[0].state == PLAYERSTATE_ACTIVE)) { Venom1_80198414(); } } diff --git a/src/overlays/ovl_i2/fox_me.c b/src/overlays/ovl_i2/fox_me.c index c064f1d9..678dbfe0 100644 --- a/src/overlays/ovl_i2/fox_me.c +++ b/src/overlays/ovl_i2/fox_me.c @@ -791,7 +791,7 @@ void Meteo_Effect370_Update(Effect370* this) { } void Meteo_Effect371_Update(Effect371* this) { - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) { + if (gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE) { Object_Kill(&this->obj, this->sfxSource); } @@ -1044,9 +1044,8 @@ void Meteo_MeCrusher_Update(MeCrusher* this) { this->vel.x = 0.0f; this->vel.y = 0.0f; - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) || - (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_U_TURN)) { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + if ((gPlayer[0].state == PLAYERSTATE_ACTIVE) || (gPlayer[0].state == PLAYERSTATE_U_TURN)) { + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; gPlayer[0].csState = 0; gCsFrameCount = 0; } @@ -1152,9 +1151,9 @@ void Meteo_MeCrusher_Update(MeCrusher* this) { s32 objId; if (ActorMissileSeek_ModeCheck(0) >= 4) { - objId = OBJ_MISSILE_SEEK_PLAYER; + objId = OBJ_ACTOR_MISSILE_SEEK_PLAYER; } else { - objId = OBJ_MISSILE_SEEK_TEAM; + objId = OBJ_ACTOR_MISSILE_SEEK_TEAM; } AUDIO_PLAY_SFX(NA_SE_EN_BARREL_SHOT, this->sfxSource, 4); @@ -1374,7 +1373,7 @@ void Meteo_MeCrusher_Update(MeCrusher* this) { this->obj.rot.z = this->obj.rot.z + ((0.0f - this->obj.rot.z) * 0.02f); Math_SmoothStepToF(&this->fwork[0x15], 4.0f, 1.0f, 0.1f, 0.0f); - if (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_NEXT) { + if (gPlayer[0].state != PLAYERSTATE_NEXT) { gFillScreenRed = gFillScreenAlpha = gFillScreenGreen = gFillScreenBlue = 0; if ((this->timer_050 == 10) || (this->timer_050 == 30) || (this->timer_050 == 50) || @@ -1913,7 +1912,7 @@ void Meteo_LevelStart_SetupTeam(ActorCutscene* this, s32 teamIdx) { Object_SetInfo(&this->info, this->obj.id); this->info.cullDistance = 200.0f; - if (this->animFrame == 0) { + if (this->animFrame == ACTOR_CS_TEAM_ARWING) { this->iwork[11] = 1; AUDIO_PLAY_SFX(NA_SE_ARWING_ENGINE_FG, this->sfxSource, 4); @@ -2267,7 +2266,7 @@ void Meteo_LevelStart(Player* player) { if (player->csTimer == 0) { AUDIO_PLAY_BGM(gBgmSeqId); gLevelStartStatusScreenTimer = 80; - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; player->csState = 0; player->csTimer = 0; player->csEventTimer = 0; @@ -2532,7 +2531,7 @@ void Meteo_LevelComplete(Player* player) { gFillScreenRed = gFillScreenGreen = gFillScreenBlue = 0; gFillScreenAlphaStep = 8; if (gFillScreenAlpha == 255) { - player->state_1C8 = PLAYERSTATE_1C8_NEXT; + player->state = PLAYERSTATE_NEXT; player->csTimer = 0; gFadeoutType = 4; gLeveLClearStatus[LEVEL_METEO] = Play_CheckMedalStatus(200) + 1; diff --git a/src/overlays/ovl_i2/fox_sx.c b/src/overlays/ovl_i2/fox_sx.c index 54703d76..2f516d2a 100644 --- a/src/overlays/ovl_i2/fox_sx.c +++ b/src/overlays/ovl_i2/fox_sx.c @@ -111,10 +111,10 @@ void SectorX_SxSlippy_Update(SxSlippy* this) { gBosses[0].swork[6] = 0; gTeamShields[TEAM_ID_SLIPPY] = -2; - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_STANDBY; + gPlayer[0].state = PLAYERSTATE_STANDBY; this->timer_0BC = 200; - this->iwork[14] = 3; + this->iwork[TEAM_FACE] = FACE_SLIPPY; this->fwork[0] = 0.0f; this->fwork[1] = 0.0f; @@ -146,7 +146,7 @@ void SectorX_SxSlippy_Update(SxSlippy* this) { Math_SmoothStepToF(&gPlayer[0].cam.eye.y, this->obj.pos.y, this->fwork[1], 20.0f, 0.0f); if (this->timer_0BC == 0) { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_ACTIVE; + gPlayer[0].state = PLAYERSTATE_ACTIVE; if (gPlayer[0].alternateView) { Camera_UpdateCockpitOnRails(&gPlayer[0], 1); } @@ -503,7 +503,7 @@ void SectorX_SxSpyborg_Update(SxSpyborg* this) { } } - if (((this->state != 8) && (this->state != 20)) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_ACTIVE)) { + if (((this->state != 8) && (this->state != 20)) && (gPlayer[0].state != PLAYERSTATE_ACTIVE)) { this->state = 8; this->fwork[0] = 0.0f; Audio_KillSfxBySourceAndId(D_i2_80195D88, NA_SE_EN_SZMIS_ENGINE); @@ -902,7 +902,7 @@ void SectorX_SxSpyborg_Update(SxSpyborg* this) { this->animFrame++; if (this->animFrame >= Animation_GetFrameCount(&D_SX_60123BC)) { this->animFrame = Animation_GetFrameCount(&D_SX_60123BC) - 1; - if (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_STANDBY) { + if (gPlayer[0].state != PLAYERSTATE_STANDBY) { this->animFrame = 0; this->state = 10; this->fwork[0] = 0.0f; @@ -1087,8 +1087,8 @@ void SectorX_SxSpyborg_Update(SxSpyborg* this) { } if (this->timer_050 == 120) { - if ((gPlayer[0].state_1C8 != PLAYERSTATE_1C8_NEXT) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_DOWN)) { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + if ((gPlayer[0].state != PLAYERSTATE_NEXT) && (gPlayer[0].state != PLAYERSTATE_DOWN)) { + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; gPlayer[0].csState = 0; gPlayer[0].draw = true; } @@ -1343,13 +1343,13 @@ void SectorX_SxSpyborg_PostLimbDraw(s32 limbIndex, Vec3f* rot, void* thisx) { } } -Vec3f D_i2_801956B0[5] = { { 0.0f, 2300.0f, -5000.0f }, - { -600.0f, 2200.0f, -5000.0f }, - { -300.0f, 2270.0f, -5000.0f }, - { 300.0f, 2270.0f, -5000.0f }, - { 600.0f, 2200.0f, -5000.0f } }; +Vec3f sSxCsCommanderPos[5] = { { 0.0f, 2300.0f, -5000.0f }, + { -600.0f, 2200.0f, -5000.0f }, + { -300.0f, 2270.0f, -5000.0f }, + { 300.0f, 2270.0f, -5000.0f }, + { 600.0f, 2200.0f, -5000.0f } }; -Vec3f D_i2_801956EC[3] = { +Vec3f sLevelStartTeamSetupPos[3] = { { 150.0f, 250.0f, 50.0f }, { -150.0f, -50.0f, 50.0f }, { 150.0f, -50.0f, 50.0f }, @@ -1362,7 +1362,7 @@ f32 D_i2_80195740[4] = { -150.0f, 150.0f, 0.0f, 0.0f }; f32 D_i2_80195750[4] = { 20.0f, 0.0f, -70.0f, 0.0f }; f32 D_i2_80195760[4] = { -250.0f, -200.0f, -400.0f, -8000.0f }; f32 D_i2_80195770[3] = { 120.0f, 180.0f, -150.0f }; -s16 D_i2_8019577C[3] = { 2, 3, 4 }; +s16 sSxTeamFaces[3] = { FACE_FALCO, FACE_SLIPPY, FACE_PEPPY }; void SectorX_SxSpyborg_Draw(SxSpyborg* this) { f32 fwork; @@ -1435,32 +1435,32 @@ void SectorX_SxSpyborg_Draw(SxSpyborg* this) { } } -void SectorX_80193800(ActorCutscene* this, s32 index) { +void SectorX_CsCommander_Setup(ActorCutscene* this, s32 index) { Actor_Initialize(this); this->obj.status = OBJ_ACTIVE; this->obj.id = OBJ_ACTOR_CUTSCENE; - this->obj.pos.x = D_i2_801956B0[index].x; - this->obj.pos.y = D_i2_801956B0[index].y; - this->obj.pos.z = D_i2_801956B0[index].z; + this->obj.pos.x = sSxCsCommanderPos[index].x; + this->obj.pos.y = sSxCsCommanderPos[index].y; + this->obj.pos.z = sSxCsCommanderPos[index].z; this->vel.z = 30.0f; this->vel.y = -16.0f; - this->animFrame = 20; + this->animFrame = ACTOR_CS_COMMANDER; this->obj.rot.x = 15.0f; Object_SetInfo(&this->info, this->obj.id); AUDIO_PLAY_SFX(NA_SE_EN_ENGINE_01, this->sfxSource, 4); } -void SectorX_801938D8(ActorCutscene* this, s32 index) { +void SectorX_LevelStart_SetupTeam(ActorCutscene* this, s32 teamIdx) { Actor_Initialize(this); this->obj.status = OBJ_ACTIVE; this->obj.id = OBJ_ACTOR_CUTSCENE; - this->obj.pos.x = gPlayer[0].cam.eye.x + D_i2_801956EC[index].x; - this->obj.pos.y = gPlayer[0].cam.eye.y + D_i2_801956EC[index].y; - this->obj.pos.z = gPlayer[0].cam.eye.z + D_i2_801956EC[index].z; + this->obj.pos.x = gPlayer[0].cam.eye.x + sLevelStartTeamSetupPos[teamIdx].x; + this->obj.pos.y = gPlayer[0].cam.eye.y + sLevelStartTeamSetupPos[teamIdx].y; + this->obj.pos.z = gPlayer[0].cam.eye.z + sLevelStartTeamSetupPos[teamIdx].z; this->state = 1; this->iwork[11] = 1; @@ -1469,7 +1469,7 @@ void SectorX_801938D8(ActorCutscene* this, s32 index) { this->obj.rot.y = 180.0f; this->obj.rot.x = 10.0f; - if (index == 2) { + if (teamIdx == 2) { this->obj.rot.z = -20.0f; } @@ -1492,7 +1492,7 @@ void SectorX_LevelStart(Player* player) { case 0: gCsFrameCount = 0; for (i = 0; i < 5; i++) { - SectorX_80193800(&gActors[5 + i], i); + SectorX_CsCommander_Setup(&gActors[5 + i], i); } player->csState = 1; player->cam.eye.x = gCsCamEyeX = 100.0f; @@ -1581,17 +1581,17 @@ void SectorX_LevelStart(Player* player) { switch (gCsFrameCount) { case 195: if (gTeamShields[TEAM_ID_FALCO] > 0) { - SectorX_801938D8(&gActors[0], 0); + SectorX_LevelStart_SetupTeam(&gActors[0], 0); } break; case 213: if (gTeamShields[TEAM_ID_SLIPPY] > 0) { - SectorX_801938D8(&gActors[1], 1); + SectorX_LevelStart_SetupTeam(&gActors[1], 1); } break; case 229: if (gTeamShields[TEAM_ID_PEPPY] > 0) { - SectorX_801938D8(&gActors[2], 2); + SectorX_LevelStart_SetupTeam(&gActors[2], 2); } break; } @@ -1628,7 +1628,7 @@ void SectorX_LevelStart(Player* player) { player->baseSpeed = gArwingSpeed; AUDIO_PLAY_BGM(gBgmSeqId); gLevelStartStatusScreenTimer = 80; - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; player->csState = player->csTimer = player->csEventTimer = 0; player->cam.eye.y = player->pos.y * player->unk_148 + 50.0f; player->cam.eye.z = 400.0f; @@ -1663,7 +1663,7 @@ void SectorX_LevelStart(Player* player) { player->trueZpos = player->pos.z + player->camDist; } -void SectorX_801944D4(ActorCutscene* this, s32 index) { +void SectorX_LevelComplete_SetupTeam(ActorCutscene* this, s32 teamIdx) { Vec3f srcA; Vec3f destA; Vec3f srcB; @@ -1671,12 +1671,14 @@ void SectorX_801944D4(ActorCutscene* this, s32 index) { Player* player = &gPlayer[0]; Matrix_RotateY(gCalcMatrix, player->rot.y * M_DTOR, MTXF_NEW); - srcA.x = D_i2_80195710[index]; - srcA.y = D_i2_80195720[index]; - srcA.z = D_i2_80195730[index]; - srcB.x = D_i2_80195740[index]; - srcB.y = D_i2_80195750[index]; - srcB.z = D_i2_80195760[index]; + + srcA.x = D_i2_80195710[teamIdx]; + srcA.y = D_i2_80195720[teamIdx]; + srcA.z = D_i2_80195730[teamIdx]; + srcB.x = D_i2_80195740[teamIdx]; + srcB.y = D_i2_80195750[teamIdx]; + srcB.z = D_i2_80195760[teamIdx]; + Matrix_MultVec3fNoTranslate(gCalcMatrix, &srcA, &destA); Matrix_MultVec3fNoTranslate(gCalcMatrix, &srcB, &destB); @@ -1697,16 +1699,16 @@ void SectorX_801944D4(ActorCutscene* this, s32 index) { Object_SetInfo(&this->info, this->obj.id); - if (index == 3) { + if (teamIdx == 3) { this->animFrame = ACTOR_CS_GREAT_FOX; this->state = 20; this->obj.rot.x = -player->rot.x - 10.0f; this->obj.rot.y = (player->rot.y + 180.0f) - 10.0f; this->fwork[9] = 10.0f; } else { - this->obj.rot.z = D_i2_80195770[index]; + this->obj.rot.z = D_i2_80195770[teamIdx]; this->iwork[11] = 1; - this->iwork[14] = D_i2_8019577C[index]; + this->iwork[TEAM_FACE] = sSxTeamFaces[teamIdx]; AUDIO_PLAY_SFX(NA_SE_ARWING_ENGINE_FG, this->sfxSource, 4); } } @@ -1793,7 +1795,7 @@ void SectorX_LevelComplete(Player* player) { gFillScreenRed = gFillScreenGreen = gFillScreenBlue = 0; gFillScreenAlphaTarget = 255; if (gFillScreenAlpha == 255) { - player->state_1C8 = PLAYERSTATE_1C8_NEXT; + player->state = PLAYERSTATE_NEXT; gFadeoutType = 4; player->csTimer = 0; Play_ClearObjectData(); @@ -1814,13 +1816,13 @@ void SectorX_LevelComplete(Player* player) { case 100: if (gTeamShields[TEAM_ID_FALCO] > 0) { - SectorX_801944D4(&gActors[1], 0); + SectorX_LevelComplete_SetupTeam(&gActors[1], 0); } if (gTeamShields[TEAM_ID_SLIPPY] > 0) { - SectorX_801944D4(&gActors[2], 1); + SectorX_LevelComplete_SetupTeam(&gActors[2], 1); } if (gTeamShields[TEAM_ID_PEPPY] > 0) { - SectorX_801944D4(&gActors[3], 2); + SectorX_LevelComplete_SetupTeam(&gActors[3], 2); } break; @@ -1837,8 +1839,8 @@ void SectorX_LevelComplete(Player* player) { break; case 920: - gActors[1].iwork[14] = gActors[2].iwork[14] = gActors[3].iwork[14] = 0; - SectorX_801944D4(&gActors[0], 3); + gActors[1].iwork[TEAM_FACE] = gActors[2].iwork[TEAM_FACE] = gActors[3].iwork[TEAM_FACE] = FACE_NONE; + SectorX_LevelComplete_SetupTeam(&gActors[0], 3); AUDIO_PLAY_SFX(NA_SE_GREATFOX_ENGINE, gActors[0].sfxSource, 0); break; diff --git a/src/overlays/ovl_i3/fox_a6.c b/src/overlays/ovl_i3/fox_a6.c index a91fc318..3647d921 100644 --- a/src/overlays/ovl_i3/fox_a6.c +++ b/src/overlays/ovl_i3/fox_a6.c @@ -361,7 +361,7 @@ void Area6_ActorMissileSeekPlayer_Setup(ActorMissileSeekPlayer* this, f32 xPos, PRINTF("おふ\n"); // Off Actor_Initialize(this); this->obj.status = OBJ_INIT; - this->obj.id = OBJ_MISSILE_SEEK_PLAYER; + this->obj.id = OBJ_ACTOR_MISSILE_SEEK_PLAYER; this->obj.pos.x = xPos; this->obj.pos.y = yPos; @@ -1142,7 +1142,8 @@ void Area6_A6Gorgon_Update(A6Gorgon* this) { } if ((gActors[spf124].obj.status == OBJ_FREE) || - (gActors[spf124].obj.id != OBJ_MISSILE_SEEK_PLAYER) || (D_i3_801C2250[A6_BSS_24] == 0)) { + (gActors[spf124].obj.id != OBJ_ACTOR_MISSILE_SEEK_PLAYER) || + (D_i3_801C2250[A6_BSS_24] == 0)) { D_i3_801C2250[A6_BSS_12_0 + var_s0] = 0; spf124 = 0; @@ -1184,9 +1185,9 @@ void Area6_A6Gorgon_Update(A6Gorgon* this) { break; case 11: - if ((this->timer_052 == 160) && ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) || - (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_U_TURN))) { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + if ((this->timer_052 == 160) && + ((gPlayer[0].state == PLAYERSTATE_ACTIVE) || (gPlayer[0].state == PLAYERSTATE_U_TURN))) { + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; gPlayer[0].csState = 0; } @@ -2487,7 +2488,7 @@ void Area6_LevelStart(Player* player) { player->csTimer = 0; AUDIO_PLAY_BGM(NA_BGM_STAGE_A6); - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; } break; } @@ -2574,7 +2575,7 @@ void Area6_LevelStart(Player* player) { Matrix_RotateY(gCalcMatrix, (player->rot.y + player->yRot_114 + 180.0f) * M_DTOR, MTXF_NEW); Matrix_RotateX(gCalcMatrix, -(player->rot.x * M_DTOR), MTXF_APPLY); - if (player->state_1C8 != PLAYERSTATE_1C8_ACTIVE) { + if (player->state != PLAYERSTATE_ACTIVE) { sp74.x = 0.0f; sp74.y = 0.0f; sp74.z = player->baseSpeed; @@ -2666,7 +2667,7 @@ void Area6_8018EC38(ActorCutscene* this, s32 teamIdx) { // @port: Setup team faces (original code was omitting Peppy) if ((teamIdx + 1 != 3) || (CVarGetInteger("gTeamFaces", 1) == 1)) { - this->iwork[14] = teamIdx + 2; + this->iwork[TEAM_FACE] = teamIdx + 2; } Object_SetInfo(&this->info, this->obj.id); diff --git a/src/overlays/ovl_i3/fox_aq.c b/src/overlays/ovl_i3/fox_aq.c index 87f86ef1..6e4b58ad 100644 --- a/src/overlays/ovl_i3/fox_aq.c +++ b/src/overlays/ovl_i3/fox_aq.c @@ -643,6 +643,7 @@ void Aquas_801A9ED0(Player* player) { Aquas_801A9DE4(player); } +// Blue Marine Reticle void Aquas_801AA20C(void) { s32 i; f32 x; @@ -805,7 +806,7 @@ void Aquas_UpdateCamera(Player* player) { f32 stickY = -gInputPress->stick_y; f32 zRot; - if (player->state_1C8 != PLAYERSTATE_1C8_ACTIVE) { + if (player->state != PLAYERSTATE_ACTIVE) { stickX = stickY = 0.0f; } @@ -1509,7 +1510,7 @@ void Aquas_BlueMarineBoost(Player* player) { } if ((gBoostButton[player->num] & gInputHold->button) && (player->unk_230 == 0) && - (player->state_1C8 != PLAYERSTATE_1C8_U_TURN) && (player->boostCooldown == 0)) { + (player->state != PLAYERSTATE_U_TURN) && (player->boostCooldown == 0)) { if (player->boostMeter == 0) { AUDIO_PLAY_SFX(NA_SE_MARINE_BOOST, player->sfxSource, 4); } @@ -1557,7 +1558,7 @@ void Aquas_BlueMarineBrake(Player* player) { player->sfx.brake = false; if ((gInputHold->button & gBrakeButton[player->num]) && (player->unk_230 == 0) && - (player->state_1C8 != PLAYERSTATE_1C8_U_TURN) && (player->boostCooldown == 0)) { + (player->state != PLAYERSTATE_U_TURN) && (player->boostCooldown == 0)) { if (player->boostMeter == 0) { AUDIO_PLAY_SFX(NA_SE_MARINE_BRAKE, player->sfxSource, 4); } @@ -1821,6 +1822,7 @@ void Aquas_801ADF7C(f32 xPos, f32 yPos, f32 zPos, f32 xRot, f32 yRot, f32 zRot, Matrix_Pop(&gGfxMatrix); } +// Bacoon Snake void Aquas_Actor255_Draw(Actor255* this) { s32 i; f32 xz; @@ -2653,6 +2655,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 40); Radio_PlayMessage(gMsg_ID_15100, RCID_FOX); } + if (fabsf(this->obj.pos.z - gPlayer[0].trueZpos) <= 3000.0f) { D_i3_801C4190[6] = 1; this->timer_056 = 20; @@ -2660,6 +2663,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { this->state = 1; } break; + case 1: if (this->timer_056 == 0) { D_i3_801C4308[14] = 80.0f; @@ -2669,6 +2673,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { AUDIO_PLAY_SFX(NA_SE_BUBBLE_UP, this->sfxSource, 0); } break; + case 2: Aquas_801B0FCC(this); if (!(this->timer_056 & 1)) { @@ -2683,12 +2688,14 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { this->state = 3; } break; + case 3: Aquas_801B0FCC(this); Math_SmoothStepToF(&D_i3_801C4308[12], -45.0f, 0.5f, 1.0f, 0.01f); Math_SmoothStepToF(&D_i3_801C4308[13], 30.0f, 0.5f, 1.0f, 0.01f); Math_SmoothStepToAngle(&D_i3_801C4308[14], 0.0f, 1.0f, 2.0f, 0.0f); Math_SmoothStepToAngle(&D_i3_801C4308[15], D_i3_801C0190[this->swork[AQ_SWK_20]], 1.0f, 10, 0.0f); + if (this->timer_056 == 0) { this->timer_056 = 10; this->swork[AQ_SWK_20]++; @@ -2697,33 +2704,41 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { } } break; + case 4: Aquas_801B0FCC(this); Math_SmoothStepToF(&D_i3_801C4308[58], 0.25f, 0.3f, 1.0f, 0.0f); + if (this->timer_056 == 0) { this->timer_056 = 20; this->state = 5; } break; + case 5: Aquas_801B0FCC(this); Math_SmoothStepToF(&D_i3_801C4308[58], 0.25f, 0.3f, 1.0f, 0.0f); + if (this->timer_056 == 0) { this->timer_056 = 30; this->state = 6; } break; + case 6: Aquas_801B0FCC(this); if (this->timer_056 == 0) { this->state = 7; } break; + case 7: this->swork[AQ_SWK_19] = 500; D_i3_801C4308[79] = -28.0f; + Math_SmoothStepToF(&D_i3_801C4308[54], 1.0f, 0.001f, 0.01f, 0.0f); Math_SmoothStepToF(&D_i3_801C4308[61], 1.0f, 0.001f, 0.01f, 0.0f); + if (D_i3_801C4308[54] >= 0.9f) { this->timer_056 = 20; D_i3_801C4308[79] = 0.0f; @@ -2731,6 +2746,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { this->state = 8; } break; + case 8: if (this->timer_056 == 0) { this->timer_056 = 20; @@ -2741,19 +2757,23 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { this->state = 9; } break; + case 9: if (this->timer_056 == 0) { this->state = 10; } break; + case 10: case 11: case 12: Aquas_801B1008(this, 500); break; + case 13: Aquas_801B1008(this, 60); break; + case 14: if (this->timer_056 == 58) { AUDIO_PLAY_SFX(NA_SE_EN_SHELL_FILLOPEN, this->sfxSource, 4); @@ -2766,6 +2786,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { Radio_PlayMessage(gMsg_ID_15140, RCID_PEPPY); } break; + case 15: if (this->swork[AQ_SWK_2] == 0) { this->swork[AQ_SWK_2] = 100 + RAND_INT(50.0f); @@ -2774,8 +2795,10 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { this->swork[AQ_SWK_3] = 100 + RAND_INT(50.0f); } break; + case 16: D_ctx_801779A8[0] = 20.0f; + if (gCameraShake == 0) { gFillScreenAlpha = gFillScreenRed = gFillScreenGreen = gFillScreenBlue = gFillScreenAlphaTarget = 255; @@ -2784,11 +2807,14 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { gFillScreenAlphaStep = 25; gCameraShake = 20 + RAND_FLOAT(20); } + if (gCameraShake == 29) { gFillScreenRed = gFillScreenGreen = gFillScreenBlue = gFillScreenAlpha = 0; } + Math_SmoothStepToF(&D_i3_801C41B8[25], D_bg_8015F970, 1.0f, 100, 0.f); Math_SmoothStepToF(&D_i3_801C41B8[26], 128.0f, 1.0f, 100, 0.f); + for (i3 = 0; i3 < AQ_LIMB_MAX; i3++) { if (sAqBacoonlimbTimers[i3] == 0) { sAqBacoonlimbTimers[i3] = 100; @@ -2808,47 +2834,58 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { this->obj.pos.y + 200.0f + RAND_FLOAT_CENTERED(400.0f), this->obj.pos.z + 1000.0f + RAND_FLOAT_CENTERED(800.0f), 10.0f); } - if (i3 && i3) {} + + if (i3 && i3) {} //! FAKE + for (i3 = 0; i3 < 3; i3++) { func_effect_80081A8C(this->obj.pos.x + RAND_FLOAT_CENTERED(1200.0f), this->obj.pos.y + 200.0f + RAND_FLOAT_CENTERED(200.0f), this->obj.pos.z + 1000.0f + RAND_FLOAT_CENTERED(800.0f), 3.0f + RAND_FLOAT(3.0f), 5); } + if (this->timer_056 == 0) { gEffects[98].obj.status = OBJ_FREE; gEffects[99].obj.status = OBJ_FREE; Effect_Effect383_Spawn(this->obj.pos.x, this->obj.pos.y, this->obj.pos.z + 600.0f, 40.0f); this->timer_056 = 50; + for (i3 = 0; i3 < AQ_LIMB_MAX; i3++) { sAqBacoonlimbTimers[i3] = 100; } + gFillScreenRed = gFillScreenGreen = gFillScreenBlue = gFillScreenAlpha = 0; this->state = 17; } break; + case 17: if (this->timer_056 == 20) { gEffects[96].obj.status = OBJ_FREE; gEffects[97].obj.status = OBJ_FREE; Effect_Effect383_Spawn(this->obj.pos.x, this->obj.pos.y, this->obj.pos.z + 600.0f, 80.0f); } + D_i3_801C42A0[0] -= 4; if (D_i3_801C42A0[0] < 0) { D_i3_801C42A0[0] = 0; } + for (i3 = 0; i3 < 21; i3++) { Math_SmoothStepToF(&D_i3_801C4308[52 + i3], 0.1f, 0.1f, 1.0f, 0.0f); } + Math_SmoothStepToF(&this->fwork[AQ_FWK_8], 0.1f, 0.1f, 1.0f, 0.0f); Math_SmoothStepToF(&this->fwork[AQ_FWK_9], 0.1f, 0.1f, 1.0f, 0.0f); Math_SmoothStepToF(&this->fwork[AQ_FWK_10], 0.1f, 0.1f, 1.0f, 0.0f); - if (((gGameFrameCount % 2) == 0)) { + + if ((gGameFrameCount % 2) == 0) { Effect_Effect390_Spawn(this->obj.pos.x + RAND_FLOAT_CENTERED(1200.0f), this->obj.pos.y + 400.0f + RAND_FLOAT_CENTERED(400.0f), this->obj.pos.z + 1000.0f + RAND_FLOAT_CENTERED(800.0f), this->vel.x, this->vel.y, this->vel.z, 0.7f, 15); } + if (this->timer_056 == 1) { for (i3 = 0; i3 < AQ_LIMB_MAX; i3++) { if (i3 != AQ_LIMB_27) { @@ -2861,6 +2898,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { this->state = 18; } break; + case 18: if (this->timer_056 != 0) { for (i3 = 0; i3 < 30; i3++) { @@ -2871,6 +2909,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { } break; } + switch (this->swork[AQ_SWK_0]) { case 0: if (D_i3_801C42A0[23] == 0) { @@ -2880,14 +2919,17 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { } Math_SmoothStepToF(&D_i3_801C4308[10], D_i3_801C4308[79], 0.05f, 0.3f, 0.0f); break; + case 1: Math_SmoothStepToF(&D_i3_801C4308[10], -28.0f, 0.05f, 0.3f, 0.0f); if (this->timer_052 < 3) { Aquas_801B0F88(this); } break; + case 2: break; + case 3: Math_SmoothStepToF(&D_i3_801C4308[10], D_i3_801C4308[79], 0.5f, 10.0f, 0.0f); if (fabsf(D_i3_801C4308[10]) <= 5.0f) { @@ -2895,7 +2937,9 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { this->timer_052 = 0; this->swork[AQ_SWK_19] = 500; D_i3_801C4308[79] = 0.0f; + AUDIO_PLAY_SFX(NA_SE_EN_SHELL_CLOSE, this->sfxSource, 4); + if (this->state < 14) { for (i3 = 0, actor = &gActors[0]; i3 < ARRAY_COUNT(gActors); i3++, actor++) { if ((actor->obj.id == OBJ_ACTOR_AQ_GAROA) && (actor->obj.status == OBJ_ACTIVE)) { @@ -2908,6 +2952,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { AUDIO_PLAY_SFX(NA_SE_WATER_PRESSURE, this->sfxSource, 0); func_enmy_80062B60(this->obj.pos.x, this->obj.pos.z + 800.0f, 0, 100.0f); var_fs3 = 80.0f; + for (i2 = 0; i2 < 3; i2++, var_fs3 += 10.0f) { for (i3 = 0; i3 < 9; i3++) { var_fs0 = SIN_DEG((27 + 2 * i3) * (10.0f + 3 * i2)) * var_fs3 * 10.0f; @@ -2920,6 +2965,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { } } break; + case 4: this->swork[AQ_SWK_19] = 50; Math_SmoothStepToF(&D_i3_801C4308[10], D_i3_801C4308[79], 0.5f, 5.0f, 0.0f); @@ -2941,8 +2987,10 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { } break; } + Math_SmoothStepToF(&D_i3_801C4308[80], 0.0f, 1.0f, 2.0f, 0); Math_SmoothStepToF(&D_i3_801C4308[11], D_i3_801C4308[80], 0.1f, 2.0f, 0); + if (this->dmgType != DMG_NONE) { this->dmgType = DMG_NONE; if (fabsf(D_i3_801C4308[10]) >= 5.0f) { @@ -2960,6 +3008,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { AUDIO_PLAY_SFX(NA_SE_EN_REFLECT, this->sfxSource, 4); } break; + case 14: if (this->damage == 31) { if (D_i3_801C42A0[23] != 0) { @@ -2979,6 +3028,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { } } break; + case 15: if (this->damage == 31) { if (D_i3_801C42A0[23] != 0) { @@ -2998,6 +3048,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { } } break; + case 16: if (this->damage == 31) { if (D_i3_801C42A0[23] != 0) { @@ -3007,6 +3058,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { } } break; + case 17: if (this->damage == 31) { if (D_i3_801C42A0[23] != 0) { @@ -3016,6 +3068,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { } } break; + case 18: if ((this->damage == 31) && (this->swork[AQ_SWK_1] != 2) && (this->swork[AQ_SWK_12] == 0) && (this->state == 15) && (this->health != 0)) { @@ -3042,9 +3095,9 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { Boss_AwardBonus(this); Radio_PlayMessage(gMsg_ID_15252, RCID_SLIPPY); gTeamLowHealthMsgTimer = -1; - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) || - (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_U_TURN)) { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + if ((gPlayer[0].state == PLAYERSTATE_ACTIVE) || + (gPlayer[0].state == PLAYERSTATE_U_TURN)) { + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; gPlayer[0].csState = 0; } D_i3_801C4190[1] = 0; @@ -3063,6 +3116,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { } } break; + case 19: case 20: if (this->damage == 31) { @@ -3073,22 +3127,26 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { } } break; + default: AUDIO_PLAY_SFX(NA_SE_EN_REFLECT, this->sfxSource, 4); break; } } } + if (this->state >= 15) { switch (this->swork[AQ_SWK_1]) { case 0: Math_SmoothStepToF(&D_i3_801C4308[12], -45.0f, 1.0f, this->fwork[AQ_FWK_1], 0.01f); Math_SmoothStepToF(&D_i3_801C4308[13], 30.0f, 1.0f, this->fwork[AQ_FWK_1], 0.01f); + if ((this->timer_050 == 0) && (*(&D_i3_801C4308[12]) == -45.0f)) { this->timer_050 = 7; this->swork[AQ_SWK_1]++; } break; + case 1: var_fs0 = 2.0f * this->fwork[AQ_FWK_1]; Math_SmoothStepToF(&D_i3_801C4308[12], 0.0f, 1.0f, var_fs0, 0.0001f); @@ -3098,6 +3156,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { this->timer_050 = 40.0f - ((this->health - 150) / 5.0f); } break; + case 2: if (D_i3_801C42A0[7] != 0) { Math_SmoothStepToF(&D_i3_801C4308[12], -80.0f, 1.0f, 10.0f, 0.0001f); @@ -3109,9 +3168,11 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { break; } } + this->swork[AQ_SWK_14] += D_i3_801C0150[this->swork[AQ_SWK_18]][0]; this->swork[AQ_SWK_15] += D_i3_801C0150[this->swork[AQ_SWK_18]][1]; this->swork[AQ_SWK_16] += D_i3_801C0150[this->swork[AQ_SWK_18]][2]; + if (this->swork[AQ_SWK_14] < 0) { this->swork[AQ_SWK_14] = 0; } @@ -3126,6 +3187,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { this->swork[AQ_SWK_18]++; this->swork[AQ_SWK_18] &= 3; } + if ((this->state >= 4) && (this->state < 16)) { sp104 = gPlayer[0].pos.x - this->obj.pos.x; sp100 = gPlayer[0].pos.y - this->obj.pos.y; @@ -3140,16 +3202,19 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { Math_SmoothStepToAngle(&D_i3_801C4308[14], spE4, 1.0f, 5.0f, 0.001f); } } + for (i3 = 0; i3 < 6; i3++) { if ((D_i3_801C42A0[i3 + 1] == 0) && (this->state < 17)) { if ((i3 + 1 != this->swork[AQ_SWK_6]) && (i3 + 1 != this->swork[AQ_SWK_7])) { i2 = D_i3_801C42A0[i3 + 16]; + Math_SmoothStepToF(&D_i3_801C4308[52 + i3], D_i3_801BFC94[4 * i3 + i2].x, D_i3_801BFE18[4 * i3 + i2].x, D_i3_801BFF38[4 * i3 + i2].x, 0.00001f); Math_SmoothStepToF(&D_i3_801C4308[59 + i3], D_i3_801BFC94[4 * i3 + i2].y, D_i3_801BFE18[4 * i3 + i2].y, D_i3_801BFF38[4 * i3 + i2].y, 0.00001f); Math_SmoothStepToF(&D_i3_801C4308[66 + i3], D_i3_801BFC94[4 * i3 + i2].z, D_i3_801BFE18[4 * i3 + i2].z, D_i3_801BFF38[4 * i3 + i2].z, 0.00001f); + D_i3_801C42A0[i3 + 10]++; if (D_i3_801C42A0[i3 + 10] >= D_i3_801BFDB4[4 * i3 + i2]) { D_i3_801C42A0[i3 + 16]++; @@ -3175,6 +3240,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { spF0 = sqrtf(SQ(spF8) + SQ(spF0)); spE4 = Math_RadToDeg(-Math_Atan2F(sp100, spFC)); spEC = Math_RadToDeg(-Math_Atan2F(spF4, spF0)); + if ((spE8 <= 15.0f) || (spE8 >= 310.0f)) { Math_SmoothStepToAngle(&D_i3_801C4308[18], spE8, 1.0f, 5.0f, 0.001f); } @@ -3187,6 +3253,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { if ((spEC <= 12.0f) || (spEC >= 330.0f)) { Math_SmoothStepToAngle(&D_i3_801C4308[17], spEC, 1.0f, 5.0f, 0.001f); } + if ((this->swork[AQ_SWK_2] == 1) && (this->swork[AQ_SWK_8] != 0) && (this->health != 0) && (this->swork[AQ_SWK_6] == 0)) { D_i3_801C42A0[10] = D_i3_801C42A0[16] = 0; @@ -3197,16 +3264,19 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { D_i3_801C42A0[11] = D_i3_801C42A0[17] = 0; this->swork[AQ_SWK_7] = 2; } + if (this->health != 0) { for (i7 = 0; i7 < 2; i7++) { if (this->swork[AQ_SWK_6 + i7] != 0) { i2 = this->swork[AQ_SWK_4 + i7]; + Math_SmoothStepToF(&D_i3_801C4308[52 + i7], D_i3_801C00B0[0][i2], D_i3_801C00F0[0][i2], D_i3_801C0120[0][i2], 0.00001f); Math_SmoothStepToF(&D_i3_801C4308[59 + i7], D_i3_801C00B0[1][i2], D_i3_801C00F0[1][i2], D_i3_801C0120[1][i2], 0.00001f); Math_SmoothStepToF(&D_i3_801C4308[66 + i7], D_i3_801C00B0[2][i2], D_i3_801C00F0[2][i2], D_i3_801C0120[2][i2], 0.00001f); + D_i3_801C42A0[i7 + 10]++; if (D_i3_801C42A0[i7 + 10] >= D_i3_801C00E0[i2]) { this->swork[AQ_SWK_4 + i7]++; @@ -3225,9 +3295,11 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { spD4.x = D_i3_801C4308[73 + 3 * i7]; spD4.y = D_i3_801C4308[74 + 3 * i7]; spD4.z = D_i3_801C4308[75 + 3 * i7]; + Effect_SpawnTimedSfxAtPos(&spD4, NA_SE_EN_P_BALL_SHOT); + i2 = 0; - for (i3 = 0; i2 <= i && i3 < ARRAY_COUNT(gActors); i3++) { + for (i3 = 0; (i2 <= i) && (i3 < ARRAY_COUNT(gActors)); i3++) { if ((gActors[i3].obj.status == OBJ_FREE) && (i3 < ARRAY_COUNT(gActors))) { Actor_Initialize(&gActors[i3]); @@ -3236,6 +3308,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { gActors[i3].obj.pos.x = D_i3_801C4308[73 + 3 * i7]; gActors[i3].obj.pos.y = D_i3_801C4308[74 + 3 * i7] + 30.0f; gActors[i3].obj.pos.z = D_i3_801C4308[75 + 3 * i7] + 150.0f; + if (Rand_ZeroOne() < 0.5f) { var_fs1 = Math_ModF(D_i3_801C4308[i7 + 16] + RAND_FLOAT_CENTERED(60.0f), 360.0f); var_fs0 = Math_ModF(D_i3_801C4308[i7 + 18] + RAND_FLOAT_CENTERED(60.0f), 360.0f); @@ -3256,6 +3329,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { var_fs1 = Math_ModF(D_i3_801C4308[i7 + 16] + RAND_FLOAT_CENTERED(30.0f), 360.0f); var_fs0 = Math_ModF(D_i3_801C4308[i7 + 18] + RAND_FLOAT_CENTERED(30.0f), 360.0f); } + gActors[i3].fwork[3] = var_fs1; gActors[i3].fwork[4] = var_fs0; // gActors[i3].timer_0BC = i2 * 3; @@ -3278,6 +3352,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { } } } + for (i7 = 26; i7 < 107; i7 += 10) { var_fs0 = D_i3_801C4308[10] - 10; if (fabsf(D_i3_801C4308[10]) <= 5.0f) { @@ -3285,6 +3360,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { } this->info.hitbox[i7] = var_fs0; } + if (this->state >= 10) { sp110 = D_i3_801C42A0[9]; i2 = (gGameFrameCount & 0x1F); // % 0x20 if possible @@ -3297,9 +3373,11 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { } D_i3_801C42A0[9] = sp110; } + if (D_i3_801C42A0[7] != 0) { Math_SmoothStepToF(&D_ctx_801779A8[0], 20.0f, 1.0f, 5.0f, 0); } + for (i2 = 45, i3 = 1, i7 = 0; i7 < 14; i3++, i2++, i7 += 2) { if (D_i3_801C42A0[i3] != 0) { D_i3_801C4308[i2] = SIN_DEG(D_i3_801C0060[i7 + 0] * D_i3_801C42A0[i3]) * @@ -3307,6 +3385,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { D_i3_801C42A0[i3]--; } } + if (this->swork[AQ_SWK_12] != 0) { if (D_i3_801C42A0[3] != 0) { var_fs3 = 1.0f; @@ -3345,12 +3424,15 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { } } } + if ((D_i3_801C42A0[7] != 0) || (this->state >= 16)) { var_fs3 = 0.25f; } else { var_fs3 = 1.0f; } + Math_SmoothStepToF(&D_i3_801C4308[58], var_fs3, 0.3f, 1.0f, 0); + for (i3 = 0; i3 < 2; i3++) { if (this->swork[AQ_SWK_8 + i3] == 0) { if (this->swork[AQ_SWK_10 + i3] == 1) { @@ -3359,6 +3441,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { spD4.z = D_i3_801C4308[75 + 3 * i3]; Effect_SpawnTimedSfxAtPos(&spD4, NA_SE_EN_P_GUN_APPEAR); } + if ((fabsf(D_i3_801C4308[10]) <= 3.0f) || (this->swork[AQ_SWK_10 + i3] == 0)) { Math_SmoothStepToF(&D_i3_801C4308[52 + i3], 1.0f, 0.1f, 0.5f, 0.0f); Math_SmoothStepToF(&D_i3_801C4308[59 + i3], 1.0f, 0.1f, 0.5f, 0.0f); @@ -3380,6 +3463,7 @@ void Aquas_AqBacoon_Update(AqBacoon* this) { } } } + if (this->swork[AQ_SWK_2] != 0) { this->swork[AQ_SWK_2]--; } @@ -6483,7 +6567,7 @@ void Aquas_801BDF14(void) { actor->obj.pos.y = D_i3_801C0504[i].y; actor->obj.pos.z = D_i3_801C0504[i].z; actor->rot_0F4.y = D_i3_801C075C[i]; - actor->animFrame = 41; + actor->animFrame = ACTOR_CS_AQ_FISHGROUP; actor->iwork[0] = RAND_INT(20.0f); actor->iwork[2] = i; actor->timer_0BC = 231; diff --git a/src/overlays/ovl_i3/fox_so.c b/src/overlays/ovl_i3/fox_so.c index a95681e5..456ceea5 100644 --- a/src/overlays/ovl_i3/fox_so.c +++ b/src/overlays/ovl_i3/fox_so.c @@ -743,7 +743,7 @@ void Solar_Effect392_Update(Effect392* this) { } } - if (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_COMPLETE) { + if (gPlayer[0].state != PLAYERSTATE_LEVEL_COMPLETE) { func_effect_8007A774(&gPlayer[0], this, this->scale2 * 12.0f); } @@ -822,7 +822,7 @@ void Solar_Effect392_Update(Effect392* this) { Math_SmoothStepToF(&this->vel.y, -65.0f, 2.0f, 1.0f, 0.5f); } - if (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_COMPLETE) { + if (gPlayer[0].state != PLAYERSTATE_LEVEL_COMPLETE) { func_effect_8007A774(&gPlayer[0], this, this->scale2 * 12.0f); } @@ -872,7 +872,7 @@ void Solar_Effect392_Update(Effect392* this) { this->vel.y = COS_DEG(this->unk_60.z) * (this->unk_60.x * 10.0f); this->vel.z = gPlayer[0].vel.z + 15.0f; - if (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_COMPLETE) { + if (gPlayer[0].state != PLAYERSTATE_LEVEL_COMPLETE) { func_effect_8007A774(&gPlayer[0], this, this->scale2 * 18.0f); if ((this->unk_4C == 0) && ((this->scale2 >= 9.8f) || (this->scale2 <= 4.4f))) { AUDIO_PLAY_SFX(NA_SE_EN_SOBOSS_BREATH, this->sfxSource, 4); @@ -900,7 +900,7 @@ void Solar_Effect392_Update(Effect392* this) { this->vel.y = COS_DEG(this->unk_60.z) * sp50 * 50.0f; this->vel.z = gPlayer[0].vel.z + 80.0f; - if (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_COMPLETE) { + if (gPlayer[0].state != PLAYERSTATE_LEVEL_COMPLETE) { func_effect_8007A774(&gPlayer[0], this, this->scale2 * 18.0f); if ((this->unk_4C == 0) && ((this->scale2 >= 9.8f) || (this->scale2 <= 4.4f))) { AUDIO_PLAY_SFX(NA_SE_EN_SOBOSS_BREATH, this->sfxSource, 4); @@ -1228,7 +1228,7 @@ void Solar_LevelStart(Player* player) { player->baseSpeed = gArwingSpeed; Play_ClearObjectData(); gLevelStartStatusScreenTimer = 50; - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; player->csState = 0; player->pos.y = 350.0f; @@ -2040,8 +2040,8 @@ void Solar_801A3C4C(SoVulkain* this) { AUDIO_PLAY_SFX(NA_SE_EN_DOWN_IMPACT, this->sfxSource, 4); - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + if (gPlayer[0].state == PLAYERSTATE_ACTIVE) { + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; gPlayer[0].csTimer = 0; gPlayer[0].csState = gPlayer[0].csTimer; @@ -3405,7 +3405,7 @@ void Solar_LevelComplete(Player* player) { if (gFillScreenAlpha == 255) { Audio_StopPlayerNoise(0); Audio_FadeOutAll(10); - player->state_1C8 = PLAYERSTATE_1C8_NEXT; + player->state = PLAYERSTATE_NEXT; player->csTimer = 0; gFadeoutType = 4; gLeveLClearStatus[LEVEL_SOLAR] = Play_CheckMedalStatus(100) + 1; diff --git a/src/overlays/ovl_i3/fox_zo.c b/src/overlays/ovl_i3/fox_zo.c index fb744f6a..60a8cb27 100644 --- a/src/overlays/ovl_i3/fox_zo.c +++ b/src/overlays/ovl_i3/fox_zo.c @@ -9,6 +9,8 @@ #include "assets/ast_zoness.h" #include "port/interpolation/FrameInterpolation.h" +#define TRAP_ENEMY_LASERS (1000) + typedef struct { f32 id; Vec3f tilt; @@ -2583,10 +2585,9 @@ void Zoness_ZoSarumarine_Update(ZoSarumarine* this) { sZoFwork[ZO_BSF_23] = 10.0f; gShowBossHealth = false; Effect_Effect383_Spawn(this->obj.pos.x, this->obj.pos.y, this->obj.pos.z, 80.0f); - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) || - (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_U_TURN)) { + if ((gPlayer[0].state == PLAYERSTATE_ACTIVE) || (gPlayer[0].state == PLAYERSTATE_U_TURN)) { gCsFrameCount = 0; - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; gPlayer[0].csState = gPlayer[0].csTimer = 0; gPlayer[0].rot.y += gPlayer[0].yRot_114; if (gPlayer[0].rot.y > 360.0f) { @@ -3213,7 +3214,7 @@ void Zoness_ZoSarumarine_Update(ZoSarumarine* this) { } void Zoness_801986FC(ZoSarumarine* this, s32 arg1, f32 xOff, f32 yOff, f32 zOff, f32 yRot) { - ZoBall* actor245 = NULL; + ZoBall* zoBall = NULL; Vec3f src = { 0.0f, 0.0f, 50.0f }; Vec3f dest = { 0 }; s32 i = 0; @@ -3229,18 +3230,18 @@ void Zoness_801986FC(ZoSarumarine* this, s32 arg1, f32 xOff, f32 yOff, f32 zOff, sZoSwork[ZO_BSS_0 + arg1] = 40; } - for (i = 0, actor245 = &gActors[0]; i < ARRAY_COUNT(gActors); i++, actor245++) { - if (actor245->obj.status == OBJ_FREE) { + for (i = 0, zoBall = &gActors[0]; i < ARRAY_COUNT(gActors); i++, zoBall++) { + if (zoBall->obj.status == OBJ_FREE) { D_ctx_801779A8[0] = 20.0f; - Actor_Initialize(actor245); - actor245->obj.status = OBJ_INIT; - actor245->obj.id = OBJ_ACTOR_ZO_BALL; + Actor_Initialize(zoBall); + zoBall->obj.status = OBJ_INIT; + zoBall->obj.id = OBJ_ACTOR_ZO_BALL; - actor245->obj.pos.x = this->obj.pos.x + xOff; - actor245->obj.pos.y = this->obj.pos.y + yOff; - actor245->obj.pos.z = this->obj.pos.z + zOff; + zoBall->obj.pos.x = this->obj.pos.x + xOff; + zoBall->obj.pos.y = this->obj.pos.y + yOff; + zoBall->obj.pos.z = this->obj.pos.z + zOff; - actor245->health = 10; + zoBall->health = 10; Matrix_RotateY(gCalcMatrix, this->obj.rot.y * M_DTOR, MTXF_NEW); Matrix_RotateX(gCalcMatrix, this->obj.rot.x * M_DTOR, MTXF_APPLY); @@ -3250,19 +3251,18 @@ void Zoness_801986FC(ZoSarumarine* this, s32 arg1, f32 xOff, f32 yOff, f32 zOff, Matrix_MultVec3fNoTranslate(gCalcMatrix, &src, &dest); - actor245->vel.x = dest.x; - actor245->vel.y = dest.y; - actor245->vel.z = this->vel.z + dest.z; + zoBall->vel.x = dest.x; + zoBall->vel.y = dest.y; + zoBall->vel.z = this->vel.z + dest.z; - Object_SetInfo(&actor245->info, actor245->obj.id); + Object_SetInfo(&zoBall->info, zoBall->obj.id); sZoFwork[ZO_BSF_35 + arg1] = 40.0f; AUDIO_PLAY_SFX(NA_SE_EN_S_BALL_SHOT, this->sfxSource, 4); for (i = 0; i < 4; i++) { - Zoness_Effect394_Spawn3(actor245->obj.pos.x + (dest.x * 4.3f), - actor245->obj.pos.y + (dest.y * 4.3f), - actor245->obj.pos.z + (dest.z * 4.3f) + 100.0f, 30.0f); + Zoness_Effect394_Spawn3(zoBall->obj.pos.x + (dest.x * 4.3f), zoBall->obj.pos.y + (dest.y * 4.3f), + zoBall->obj.pos.z + (dest.z * 4.3f) + 100.0f, 30.0f); } break; } @@ -3271,9 +3271,9 @@ void Zoness_801986FC(ZoSarumarine* this, s32 arg1, f32 xOff, f32 yOff, f32 zOff, #ifndef AVOID_UB // @Bug: checking out of bounds - // If this passes the boss kills himself. + // If this passes the boss kills himself, since gActors[60] overflows to gBosses[0]. if (i >= ARRAY_COUNT(gActors)) { - actor245->obj.status = OBJ_FREE; + zoBall->obj.status = OBJ_FREE; } #endif } @@ -4003,38 +4003,42 @@ void Zoness_ZoSpikeBall_Draw(ZoSpikeBall* this) { gSPDisplayList(gMasterDisp++, D_ZO_601BCC0); } -Vec3f D_i3_801BF744[3] = { - { 0.0f, 50.0f, -200.0f }, +Vec3f sTankerContainerInitPos[3] = { + { 0.0f, 50.0f, -200.0f }, // first position seems unused { 0.0f, 50.0f, 200.0f }, { 0.0f, 50.0f, 600.0f }, }; -Vec3f D_i3_801BF768[3] = { - { 0.0f, 300.0f, 0.0f }, +Vec3f sSupplyCraneContainerInitPos[3] = { + { 0.0f, 300.0f, 0.0f }, // first position seems unused { 0.0f, 300.0f, -200.0f }, { 0.0f, 300.0f, 300.0f }, }; s32 D_i3_801BF78C[30] = { 0, 7, 7, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 4, 7, 0, 0, 0, 0, 327, 324, 0, 322, 327, 0, 324, 324, 0, 336, 0, }; -f32 D_i3_801BF804[8] = { 0.0f, 0.0f, 270.0f, 90.0f, 0.0f, 180.0f, 400.0f, 400.0f }; +f32 sZoSupplyCraneXRots[8] = { 0.0f, 0.0f, 270.0f, 90.0f, 0.0f, 180.0f, 400.0f, 400.0f }; void Zoness_ZoTanker_Init(ZoTanker* actor) { s32 temp_v1; s32 containerIdx; s32 i; s32 j; - Vec3f sp84; - Vec3f sp78; - Vec3f sp6C; + Vec3f containerOffsetPos; + Vec3f tankerVelSrc; + Vec3f tankerVelDest; actor->obj.pos.y = 120.0f; actor->scale = -1.0f; + Matrix_RotateY(gCalcMatrix, actor->obj.rot.y * M_DTOR, MTXF_NEW); - sp78.x = sp78.y = 0.0f; - sp78.z = actor->obj.rot.z; - Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp78, &sp6C); - actor->vel.x = sp6C.x; - actor->vel.z = sp6C.z; + + tankerVelSrc.x = tankerVelSrc.y = 0.0f; + tankerVelSrc.z = actor->obj.rot.z; + + Matrix_MultVec3fNoTranslate(gCalcMatrix, &tankerVelSrc, &tankerVelDest); + + actor->vel.x = tankerVelDest.x; + actor->vel.z = tankerVelDest.z; actor->obj.rot.z = 0.0f; containerIdx = 1; @@ -4047,9 +4051,9 @@ void Zoness_ZoTanker_Init(ZoTanker* actor) { for (i = 0, j = 0; (containerIdx < 3) && (i < ARRAY_COUNT(gActors)); i++) { if (gActors[i].obj.status == OBJ_FREE) { if (actor->state == 0) { - Matrix_MultVec3f(gCalcMatrix, &D_i3_801BF744[containerIdx], &sp84); + Matrix_MultVec3f(gCalcMatrix, &sTankerContainerInitPos[containerIdx], &containerOffsetPos); } else { - Matrix_MultVec3f(gCalcMatrix, &D_i3_801BF768[containerIdx], &sp84); + Matrix_MultVec3f(gCalcMatrix, &sSupplyCraneContainerInitPos[containerIdx], &containerOffsetPos); } Actor_Initialize(&gActors[i]); @@ -4060,10 +4064,13 @@ void Zoness_ZoTanker_Init(ZoTanker* actor) { } else { gActors[i].obj.id = OBJ_ACTOR_ZO_SUPPLYCRANE; } - gActors[i].obj.pos.x = actor->obj.pos.x + sp84.x; - gActors[i].obj.pos.y = actor->obj.pos.y + sp84.y; - gActors[i].obj.pos.z = actor->obj.pos.z + sp84.z; + + gActors[i].obj.pos.x = actor->obj.pos.x + containerOffsetPos.x; + gActors[i].obj.pos.y = actor->obj.pos.y + containerOffsetPos.y; + gActors[i].obj.pos.z = actor->obj.pos.z + containerOffsetPos.z; + ((s32*) &actor->iwork[7])[containerIdx] = (s32) (actor->obj.rot.x * 3.0f) + containerIdx; + gActors[i].obj.rot.y = actor->obj.rot.y; gActors[i].iwork[0] = D_i3_801BF78C[((s32*) &actor->iwork[7])[containerIdx]]; gActors[i].iwork[1] = actor->index; @@ -4072,11 +4079,11 @@ void Zoness_ZoTanker_Init(ZoTanker* actor) { if (actor->state != 0) { gActors[i].state = 3; - if (D_i3_801BF804[actor->iwork[3]] >= 361.0f) { + if (sZoSupplyCraneXRots[actor->iwork[3]] >= 361.0f) { gActors[i].obj.rot.x = actor->obj.rot.y; } else { temp_v1 = (actor->iwork[3] * 2) + j; - gActors[i].obj.rot.x = D_i3_801BF804[temp_v1]; + gActors[i].obj.rot.x = sZoSupplyCraneXRots[temp_v1]; } j++; } @@ -4103,7 +4110,7 @@ void Zoness_ZoTanker_Update(ZoTanker* this) { actor = &gActors[this->iwork[i]]; if ((actor->obj.status != OBJ_FREE) && (actor->iwork[1] == this->index) && (actor->obj.id == OBJ_ACTOR_ZO_CONTAINER)) { - Matrix_MultVec3f(gCalcMatrix, &D_i3_801BF744[i], &sp58); + Matrix_MultVec3f(gCalcMatrix, &sTankerContainerInitPos[i], &sp58); actor->obj.pos.x = this->obj.pos.x + sp58.x; actor->obj.pos.y = this->obj.pos.y + sp58.y; actor->obj.pos.z = this->obj.pos.z + sp58.z; @@ -4116,7 +4123,7 @@ void Zoness_ZoTanker_Update(ZoTanker* this) { actor = &gActors[this->iwork[i]]; if ((actor->obj.status != OBJ_FREE) && (actor->obj.id == OBJ_ACTOR_ZO_SUPPLYCRANE) && (actor->iwork[1] == this->index)) { - Matrix_MultVec3f(gCalcMatrix, &D_i3_801BF768[i], &sp58); + Matrix_MultVec3f(gCalcMatrix, &sSupplyCraneContainerInitPos[i], &sp58); actor->obj.pos.x = this->obj.pos.x + sp58.x; actor->obj.pos.y = this->obj.pos.y + sp58.y; actor->obj.pos.z = this->obj.pos.z + sp58.z; @@ -4143,9 +4150,10 @@ void Zoness_ZoContainer_Init(ZoContainer* this) { this->health = 30; } -s32 D_i3_801BF824[10] = { DROP_SILVER_RING, DROP_BOMB, DROP_LASERS, DROP_GOLD_RING_1, DROP_GOLD_RING_2, - DROP_GOLD_RING_3, DROP_GOLD_RING_4, DROP_NONE, DROP_1UP, 1000 }; -Vec3f D_i3_801BF84C[6] = { +ItemDrop sZoContainerItemDrops[10] = { DROP_SILVER_RING, DROP_BOMB, DROP_LASERS, DROP_GOLD_RING_1, + DROP_GOLD_RING_2, DROP_GOLD_RING_3, DROP_GOLD_RING_4, DROP_NONE, + DROP_1UP, TRAP_ENEMY_LASERS }; +Vec3f sZoContainerTrapLaserPos[6] = { { 5.0f, -10.0f, 0.0f }, { 10.0f, 0.0f, 0.0f }, { 5.0f, 10.0f, 0.0f }, { -5.0f, -10.0f, 0.0f }, { -10.0f, 0.0f, 0.0f }, { -5.0f, 10.0f, 0.0f }, }; @@ -4190,18 +4198,18 @@ void Zoness_ZoContainer_Update(ZoContainer* this) { } this->obj.pos.y += 100.0f; - if (D_i3_801BF824[this->iwork[0]] < 1000) { - this->itemDrop = D_i3_801BF824[this->iwork[0]]; + if (sZoContainerItemDrops[this->iwork[0]] < 1000) { + this->itemDrop = sZoContainerItemDrops[this->iwork[0]]; Actor_Despawn(this); } else { - if (D_i3_801BF824[this->iwork[0]] == 1000) { + if (sZoContainerItemDrops[this->iwork[0]] == 1000) { for (i = 0, j = 0; i < 10; i++, j++) { if (j > 5) { j = 0; } - spB4.x = D_i3_801BF84C[j].x + this->obj.pos.x; - spB4.y = D_i3_801BF84C[j].y + this->obj.pos.y; - spB4.z = D_i3_801BF84C[j].z + this->obj.pos.z; + spB4.x = sZoContainerTrapLaserPos[j].x + this->obj.pos.x; + spB4.y = sZoContainerTrapLaserPos[j].y + this->obj.pos.y; + spB4.z = sZoContainerTrapLaserPos[j].z + this->obj.pos.z; sp9C.x = RAND_FLOAT_CENTERED(10.0f); sp9C.y = RAND_FLOAT_CENTERED(10.0f); sp9C.z = 50.0f; @@ -4747,7 +4755,7 @@ void Zoness_LevelStart(Player* player) { if (gCsFrameCount >= 270) { AUDIO_PLAY_BGM(NA_BGM_STAGE_ZO); gLevelStartStatusScreenTimer = 80; - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; player->csState = 0; player->csTimer = 0; player->csEventTimer = 0; @@ -4935,7 +4943,7 @@ void Zoness_LevelComplete(Player* player) { if (gFillScreenAlpha == 255) { Audio_StopPlayerNoise(0); Audio_FadeOutAll(10); - player->state_1C8 = PLAYERSTATE_1C8_NEXT; + player->state = PLAYERSTATE_NEXT; player->csTimer = 0; gFadeoutType = 4; gLeveLClearStatus[LEVEL_ZONESS] = Play_CheckMedalStatus(250) + 1; diff --git a/src/overlays/ovl_i4/fox_bo.c b/src/overlays/ovl_i4/fox_bo.c index b52a21c1..e09d6f67 100644 --- a/src/overlays/ovl_i4/fox_bo.c +++ b/src/overlays/ovl_i4/fox_bo.c @@ -267,9 +267,8 @@ void Bolse_UpdateEventHandler(ActorEvent* this) { if (gBosses[2].state == 10) { SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 1); SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 1); - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) || - (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_U_TURN)) { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + if ((gPlayer[0].state == PLAYERSTATE_ACTIVE) || (gPlayer[0].state == PLAYERSTATE_U_TURN)) { + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; gPlayer[0].csTimer = 30; gPlayer[0].csState = 0; gPlayer[0].unk_000 = 0.0f; @@ -292,7 +291,7 @@ void Bolse_UpdateEventHandler(ActorEvent* this) { this->iwork[1] = gHitCount; this->state = 10; this->timer_0BC = 150; - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_STANDBY; + gPlayer[0].state = PLAYERSTATE_STANDBY; AUDIO_PLAY_BGM(NA_BGM_BOSS_BO); AllRange_ClearRadio(); gPlayer[0].cam.eye.x = 400.0f; @@ -325,7 +324,7 @@ void Bolse_UpdateEventHandler(ActorEvent* this) { } if (i == 3) { this->state = 2; - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; return; } } @@ -341,7 +340,7 @@ void Bolse_UpdateEventHandler(ActorEvent* this) { if ((gControllerPress->button & START_BUTTON) || ((gAllRangeSpawnEvent + 300) == gAllRangeEventTimer)) { this->state = 2; - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; Camera_Update360(player, true); player->unk_014 = 0.0f; D_hud_80161708 = 0; @@ -395,7 +394,7 @@ void Bolse_UpdateEventHandler(ActorEvent* this) { if (!this->timer_0BC) { gAllRangeEventTimer = 3000; this->state = 2; - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; Camera_Update360(player, true); player->unk_014 = 0.0f; Audio_KillSfxBySource(gBosses[1].sfxSource); @@ -648,7 +647,7 @@ bool Bolse_8018D278(BoLaserCannon* this) { void Bolse_BoLaserCannon_Update(BoLaserCannon* this) { Bolse_8018CC60(this); - if ((gPlayer[0].state_1C8 != PLAYERSTATE_1C8_STANDBY) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_COMPLETE)) { + if ((gPlayer[0].state != PLAYERSTATE_STANDBY) && (gPlayer[0].state != PLAYERSTATE_LEVEL_COMPLETE)) { Bolse_8018CCE8(this); Bolse_8018CE5C(this); if (Bolse_8018D008(this)) { @@ -1316,7 +1315,7 @@ void Bolse_LevelStart(Player* player) { } if (gCsFrameCount == 270) { - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; player->baseSpeed = gArwingSpeed; player->unk_014 = 0.0001f; diff --git a/src/overlays/ovl_i4/fox_fo.c b/src/overlays/ovl_i4/fox_fo.c index 66dae536..380d6421 100644 --- a/src/overlays/ovl_i4/fox_fo.c +++ b/src/overlays/ovl_i4/fox_fo.c @@ -113,7 +113,7 @@ void Fortuna_UpdateEvents(ActorEvent* this) { PRINTF("Enm->work[0]=%d\n", this->iwork[0]); PRINTF("tim %d\n", gAllRangeEventTimer); - if ((player->state_1C8 == PLAYERSTATE_1C8_DOWN) || (player->state_1C8 == PLAYERSTATE_1C8_NEXT)) { + if ((player->state == PLAYERSTATE_DOWN) || (player->state == PLAYERSTATE_NEXT)) { gAllRangeEventTimer = 20000; return; } @@ -179,7 +179,7 @@ void Fortuna_UpdateEvents(ActorEvent* this) { if (gAllRangeEventTimer == 9206) { gShowAllRangeCountdown = false; this->state = 5; - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_STANDBY; + gPlayer[0].state = PLAYERSTATE_STANDBY; this->iwork[0] = 0; this->fwork[0] = 0.0f; AllRange_ClearRadio(); @@ -197,7 +197,7 @@ void Fortuna_UpdateEvents(ActorEvent* this) { gShowAllRangeCountdown = 0; this->iwork[0] = 0; this->state = 6; - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; gPlayer[0].csState = 0; gPlayer[0].unk_000 = 0.0f; @@ -235,7 +235,7 @@ void Fortuna_UpdateEvents(ActorEvent* this) { gAllRangeEventTimer = 0; gStarWolfMsgTimer = 0; - if (player->state_1C8 == PLAYERSTATE_1C8_ACTIVE) { + if (player->state == PLAYERSTATE_ACTIVE) { this->state = 2; player->pos.x = 0.0f; player->pos.z = 8000.0f; @@ -273,7 +273,7 @@ void Fortuna_UpdateEvents(ActorEvent* this) { if (gCsFrameCount == 264) { team->state = 2; this->state = 2; - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; player->unk_014 = 0.0001f; AUDIO_PLAY_BGM(gBgmSeqId); gLevelStartStatusScreenTimer = 80; @@ -308,7 +308,7 @@ void Fortuna_UpdateEvents(ActorEvent* this) { if ((gControllerPress->button & START_BUTTON) || (gAllRangeEventTimer == (gAllRangeSpawnEvent + 440))) { this->state = 2; - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; Camera_Update360(player, true); player->unk_014 = 0.0f; D_hud_80161708 = 0; @@ -362,7 +362,7 @@ void Fortuna_UpdateEvents(ActorEvent* this) { if (this->iwork[0] == 250) { this->state = 2; - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; Camera_Update360(player, true); @@ -885,9 +885,9 @@ void Fortuna_LevelComplete(Player* player) { D_ctx_80177A48[1] = 0.0f; D_ctx_80177A48[2] = -400.0f; D_ctx_80177A48[3] = 0.0f; - falco->iwork[14] = 2; - slippy->iwork[14] = 3; - peppy->iwork[14] = 4; + falco->iwork[TEAM_FACE] = FACE_FALCO; + slippy->iwork[TEAM_FACE] = FACE_SLIPPY; + peppy->iwork[TEAM_FACE] = FACE_PEPPY; } if (gCsFrameCount == 200) { @@ -1114,7 +1114,7 @@ void Fortuna_LevelComplete(Player* player) { } if (gCsFrameCount == 1382) { - player->state_1C8 = PLAYERSTATE_1C8_NEXT; + player->state = PLAYERSTATE_NEXT; player->csTimer = 0; gFadeoutType = 4; Audio_FadeOutAll(10); @@ -1337,7 +1337,7 @@ void Fortuna_LevelComplete(Player* player) { gFillScreenAlphaTarget = 255; gFillScreenAlphaStep = 16; if (gFillScreenAlpha == 255) { - player->state_1C8 = PLAYERSTATE_1C8_NEXT; + player->state = PLAYERSTATE_NEXT; player->csTimer = 0; gFadeoutType = 4; Audio_FadeOutAll(10); diff --git a/src/overlays/ovl_i4/fox_ka.c b/src/overlays/ovl_i4/fox_ka.c index 1e714523..db3bf365 100644 --- a/src/overlays/ovl_i4/fox_ka.c +++ b/src/overlays/ovl_i4/fox_ka.c @@ -11,7 +11,7 @@ Vec3f D_i4_8019F0F0[] = { { 7000.0f, 500.0f, -50 }, { 7700.0f, 550.0f, -50.0f }, { 6000.0f, 300.0f, 1950.0f } }; Vec3f D_i4_8019F114[] = { { -30.0f, 0.0f, 0.0f }, { -30.0f, 0.0f, 0.0f }, { 0.0f, 5.0f, -40.0f } }; Vec3f D_i4_8019F138[] = { { 0.0f, -135.0f, -5.0f }, { 0.0f, -135.0f, 15.0f }, { -10.0f, 135.0f, 0.0f } }; -s32 sKaStartCsModels[] = { ACTOR_CS_CORNERIAN_FIGHTER, ACTOR_CS_KA_ENEMY, ACTOR_CS_CORNERIAN_FIGHTER }; +ActorCutsceneModels sKaStartCsModels[] = { ACTOR_CS_CORNERIAN_FIGHTER, ACTOR_CS_KA_ENEMY, ACTOR_CS_CORNERIAN_FIGHTER }; Vec3f D_i4_8019F168[] = { { 700.0f, 50.0f, -700.0f }, { -500.0f, 150.0f, -500 }, { 100.0f, 100.0f, -1200.0f } }; f32 D_i4_8019F18C[] = { 200.0f, 160.0f, 185.0f }; u8 D_i4_8019F198[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -439,7 +439,7 @@ void Katina_LevelStart(Player* player) { if (gCsFrameCount == 240) { Object_Kill(&gActors[4].obj, gActors[4].sfxSource); Object_Kill(&gActors[6].obj, gActors[6].sfxSource); - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; player->unk_014 = 0.0001f; AUDIO_PLAY_BGM(gBgmSeqId); @@ -659,7 +659,7 @@ void Katina_BossHandleDamage(KaSaucerer* this) { if (this->dmgType != DMG_NONE) { this->dmgType = DMG_NONE; - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_STANDBY) { + if (gPlayer[0].state == PLAYERSTATE_STANDBY) { return; } @@ -743,7 +743,7 @@ void Katina_BossHandleDamage(KaSaucerer* this) { } } - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) { + if (gPlayer[0].state == PLAYERSTATE_ACTIVE) { if ((gGameFrameCount % 16) == 0) { for (i = 0; i < 4; i++) { if ((this->swork[10 + i] <= 0) && (Rand_ZeroOne() < 0.2f)) { @@ -916,11 +916,11 @@ void Katina_KaSaucerer_Update(KaSaucerer* this) { * Set checkpoint. */ case SAUCERER_CS_APPROACH_BASE: - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_U_TURN)) { + if ((gPlayer[0].state == PLAYERSTATE_ACTIVE) || (gPlayer[0].state == PLAYERSTATE_U_TURN)) { if (this->obj.pos.z < 4500.0f) { this->state++; - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_STANDBY; + gPlayer[0].state = PLAYERSTATE_STANDBY; gPlayer[0].cam.eye.x = -900.0f; gPlayer[0].cam.eye.y = 100.0f; @@ -1044,8 +1044,8 @@ void Katina_KaSaucerer_Update(KaSaucerer* this) { this->state++; - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_STANDBY) { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_ACTIVE; + if (gPlayer[0].state == PLAYERSTATE_STANDBY) { + gPlayer[0].state = PLAYERSTATE_ACTIVE; Camera_Update360(&gPlayer[0], true); } @@ -1175,8 +1175,8 @@ void Katina_KaSaucerer_Update(KaSaucerer* this) { Math_SmoothStepToF(&this->fwork[BOSS_MOVEMENT_SPEED], 5.0f, 0.1f, 0.5f, 0.0f); - if ((this->timer_050 == 0) && ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) || - (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_U_TURN))) { + if ((this->timer_050 == 0) && + ((gPlayer[0].state == PLAYERSTATE_ACTIVE) || (gPlayer[0].state == PLAYERSTATE_U_TURN))) { gShowAllRangeCountdown = false; this->timer_050 = 1000; this->state = 15; @@ -1192,7 +1192,7 @@ void Katina_KaSaucerer_Update(KaSaucerer* this) { SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_STANDBY; + gPlayer[0].state = PLAYERSTATE_STANDBY; gPlayer[0].camRoll = 0.0f; @@ -1217,7 +1217,7 @@ void Katina_KaSaucerer_Update(KaSaucerer* this) { } if (this->timer_050 == 500) { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; gPlayer[0].csState = 100; gPlayer[0].draw = false; gCsFrameCount = 5000; @@ -1239,7 +1239,7 @@ void Katina_KaSaucerer_Update(KaSaucerer* this) { this->obj.rot.x = 180.0f; this->fwork[BOSS_FWORK_13] = 15.0f; - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_STANDBY; + gPlayer[0].state = PLAYERSTATE_STANDBY; gPlayer[0].cam.eye.x = this->obj.pos.x; gPlayer[0].cam.eye.y = 600.0f; gPlayer[0].cam.eye.z = this->obj.pos.z - 1500.0f; @@ -1371,7 +1371,7 @@ void Katina_KaSaucerer_Update(KaSaucerer* this) { gFillScreenBlue = 255; if (gFillScreenAlpha == 255) { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; gPlayer[0].csState = 2; gPlayer[0].draw = true; @@ -1403,9 +1403,9 @@ void Katina_KaSaucerer_Update(KaSaucerer* this) { Math_SmoothStepToF(&this->fwork[BOSS_MOVEMENT_SPEED], 0.0f, 0.1f, 3.0f, 0.0f); - if ((this->timer_050 == 0) && ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) || - (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_U_TURN))) { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + if ((this->timer_050 == 0) && + ((gPlayer[0].state == PLAYERSTATE_ACTIVE) || (gPlayer[0].state == PLAYERSTATE_U_TURN))) { + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; gPlayer[0].csState = 0; gMissionStatus = MISSION_ACCOMPLISHED; this->obj.pos.z = 0.0f; @@ -1986,7 +1986,7 @@ void Katina_LevelComplete(Player* player) { gFillScreenRed = gFillScreenGreen = gFillScreenBlue = 0; gFillScreenAlphaStep = 8; if (gFillScreenAlpha == 255) { - player->state_1C8 = PLAYERSTATE_1C8_NEXT; + player->state = PLAYERSTATE_NEXT; player->csTimer = 0; gFadeoutType = 4; gLeveLClearStatus[LEVEL_KATINA] = Play_CheckMedalStatus(150) + 1; @@ -2177,7 +2177,7 @@ void Katina_801981F8(Actor* this) { Vec3f dest; s32 pad; - if ((this->timer_0C0 == 0) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_STANDBY)) { + if ((this->timer_0C0 == 0) && (gPlayer[0].state != PLAYERSTATE_STANDBY)) { this->timer_0C0 = 2; src.x = 0.0f; src.y = 0.0f; @@ -2337,7 +2337,7 @@ void Katina_UpdateEvents(ActorAllRange* this) { if (((gAllRangeEventTimer % 256) == 0) && (Rand_ZeroOne() < 0.5f)) { AllRange_PlayMessage(gMsg_ID_18060, RCID_BILL); } - } else if ((gAllRangeEventTimer > 500) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) && + } else if ((gAllRangeEventTimer > 500) && (gPlayer[0].state == PLAYERSTATE_ACTIVE) && ((gAllRangeEventTimer % 512) == 0)) { switch (RAND_INT(3.99f)) { case 0: @@ -2499,7 +2499,7 @@ void Katina_EnemyUpdate(ActorAllRange* this) { this->fwork[KA_ACTOR_FWORK_1] = 40.0f; yRand = RAND_FLOAT(1000.0f); - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_STANDBY) { + if (gPlayer[0].state == PLAYERSTATE_STANDBY) { xRand = RAND_FLOAT_CENTERED(5000.0f); zRand = RAND_FLOAT_CENTERED(5000.0f); } else { diff --git a/src/overlays/ovl_i4/fox_sz.c b/src/overlays/ovl_i4/fox_sz.c index 20f86590..2add5e81 100644 --- a/src/overlays/ovl_i4/fox_sz.c +++ b/src/overlays/ovl_i4/fox_sz.c @@ -58,9 +58,9 @@ void SectorZ_MissileExplode(ActorAllRange* this, bool shotDown) { if (shotDown) { sMissileDestroyCount++; if ((sMissileDestroyCount >= 6) && - ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_U_TURN))) { + ((gPlayer[0].state == PLAYERSTATE_ACTIVE) || (gPlayer[0].state == PLAYERSTATE_U_TURN))) { gCsFrameCount = 0; - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; gPlayer[0].csState = 1000; gActors[SZ_GREAT_FOX].state = 6; gPlayer[0].csTimer = 30; @@ -174,8 +174,8 @@ void SectorZ_Missile_Update(ActorAllRange* this) { SectorZ_MissileExplode(this, false); gCameraShake = 25; gBosses[SZ_GREAT_FOX].dmgType = DMG_MISSILE; - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_U_TURN)) { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + if ((gPlayer[0].state == PLAYERSTATE_ACTIVE) || (gPlayer[0].state == PLAYERSTATE_U_TURN)) { + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; gPlayer[0].csState = 0; gActors[SZ_GREAT_FOX].state = -31072; return; @@ -186,16 +186,16 @@ void SectorZ_Missile_Update(ActorAllRange* this) { if (CVarGetInteger("gSzMissileBug", 0) == 1) { bugFixCond = 0; } else { - bugFixCond = (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_GFOX_REPAIR); + bugFixCond = (gPlayer[0].state == PLAYERSTATE_GFOX_REPAIR); } // Level complete trigger check if (((fabsf(this->fwork[MISSILE_TARGET_Z] - this->obj.pos.z) < 2000.0f) && (((gPlayer[0].cam.eye.z < 0.0f) || (D_edisplay_801615D0.y < 0.0f)) || bugFixCond)) && - (((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) || bugFixCond) || - (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_U_TURN))) { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + (((gPlayer[0].state == PLAYERSTATE_ACTIVE) || bugFixCond) || + (gPlayer[0].state == PLAYERSTATE_U_TURN))) { + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; gPlayer[0].csState = 100; gActors[SZ_GREAT_FOX].state = -31072; } @@ -282,7 +282,7 @@ void SectorZ_KattCutscene(ActorCutscene* this) { this->timer_0BC = 400; this->state = 3; - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_STANDBY; + gPlayer[0].state = PLAYERSTATE_STANDBY; Audio_PlayFanfare(NA_BGM_KATT, 20, 10, 10); AllRange_ClearRadio(); @@ -365,7 +365,7 @@ void SectorZ_EnemyUpdate(ActorAllRange* this) { Radio_PlayMessage(gMsg_ID_16030, RCID_FALCO); } - if (((this->timer_0C0 == 0) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_STANDBY)) && + if (((this->timer_0C0 == 0) && (gPlayer[0].state != PLAYERSTATE_STANDBY)) && ((gAllRangeEventTimer < 200) || ((gAllRangeEventTimer > 4000) && (gAllRangeEventTimer < 4200)))) { this->timer_0C0 = 5; @@ -433,7 +433,7 @@ void SectorZ_EnemyUpdate(ActorAllRange* this) { SectorZ_SpawnMissile(&gActors[SZ_MISSILE_RIGHT], 2); SectorZ_SpawnMissile(&gActors[SZ_MISSILE_LEFT], 1); SectorZ_SpawnMissile(&gActors[SZ_MISSILE_CENTER], 0); - D_hud_80161710 = 580; + gRadarMissileAlarmTimer = 580; break; case 3850: @@ -443,11 +443,11 @@ void SectorZ_EnemyUpdate(ActorAllRange* this) { case 4000: SectorZ_SpawnMissile(&gActors[SZ_MISSILE_LEFT], 1); SectorZ_SpawnMissile(&gActors[SZ_MISSILE_CENTER], 0); - D_hud_80161710 = 580; + gRadarMissileAlarmTimer = 580; break; case 2000: - D_hud_80161710 = 490; + gRadarMissileAlarmTimer = 490; SectorZ_SpawnMissile(&gActors[SZ_MISSILE_CENTER], 0); gActors[SZ_MISSILE_CENTER].fwork[1] = 10.0f; @@ -458,7 +458,7 @@ void SectorZ_EnemyUpdate(ActorAllRange* this) { SectorZ_SpawnMissileEscort(&gActors[SZ_ESCORT_3], 2); SectorZ_SpawnMissileEscort(&gActors[SZ_ESCORT_4], 3); - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_STANDBY; + gPlayer[0].state = PLAYERSTATE_STANDBY; this->state = 10; this->fwork[10] = 0.0f; @@ -486,13 +486,13 @@ void SectorZ_EnemyUpdate(ActorAllRange* this) { bool SectorZ_GFoxArwingRepair(Player* player) { // clang-format off - if (player->state_1C8 == PLAYERSTATE_1C8_ACTIVE) { + if (player->state == PLAYERSTATE_ACTIVE) { if ((player->yRot_114 > 30.0f) && (player->yRot_114 < 150.0f) && (fabsf(player->pos.x - 1270.0f) < 450.0f) && (fabsf(player->pos.y - 265.0f) < 100.0f) && (fabsf(player->trueZpos) < 172.0f)) { - player->state_1C8 = PLAYERSTATE_1C8_GFOX_REPAIR; + player->state = PLAYERSTATE_GFOX_REPAIR; player->csState = 0; gActors[SZ_GREAT_FOX].state = 20; gAllRangeEventTimer--; @@ -596,7 +596,7 @@ void SectorZ_UpdateEvents(ActorAllRange* this) { if (this->timer_0BC == 70) { this->state = 2; - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; Camera_Update360(player, true); player->unk_014 = 0.0f; } @@ -663,7 +663,7 @@ void SectorZ_UpdateEvents(ActorAllRange* this) { if (this->timer_0BC < 9680) { this->state = 2; - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; Camera_Update360(player, true); player->unk_014 = 0.0f; gActors[SZ_MISSILE_CENTER].fwork[1] = 25.0f; @@ -992,7 +992,7 @@ void SectorZ_LevelStart(Player* player) { if (gCsFrameCount == 820) { Audio_KillSfxById(NA_SE_DEMO_SIREN); - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; player->unk_01C = player->unk_018 = player->unk_014 = 0.f; AUDIO_PLAY_BGM(gBgmSeqId); gLevelStartStatusScreenTimer = 50; @@ -1420,7 +1420,7 @@ void SectorZ_LevelComplete(Player* player) { gFillScreenRed = gFillScreenGreen = gFillScreenBlue = 0; gFillScreenAlphaStep = 8; if (gFillScreenAlpha == 255) { - player->state_1C8 = PLAYERSTATE_1C8_NEXT; + player->state = PLAYERSTATE_NEXT; player->csTimer = 0; gFadeoutType = 4; gLeveLClearStatus[LEVEL_SECTOR_Z] = Play_CheckMedalStatus(100) + 1; diff --git a/src/overlays/ovl_i5/fox_ma.c b/src/overlays/ovl_i5/fox_ma.c index 300e0176..e8db7088 100644 --- a/src/overlays/ovl_i5/fox_ma.c +++ b/src/overlays/ovl_i5/fox_ma.c @@ -652,7 +652,7 @@ void Macbeth_8019A2F4(MaLocomotive* this) { } } - if (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_COMPLETE) { + if (gPlayer[0].state != PLAYERSTATE_LEVEL_COMPLETE) { if (var_fa1 < (gPlayer[0].trueZpos - this->obj.pos.z - (D_i5_801BA1E4 * 1416 - 1416))) { Math_SmoothStepToF(&sMaTrainSpeedTarget, -6.0f, 0.1f, 0.2f, 0.01f); } @@ -949,7 +949,7 @@ void Macbeth_MaLocomotive_Update(MaLocomotive* this) { case 0: D_i5_801BE320[25] = 1; if ((D_i5_801BE320[9] <= 0) && (D_i5_801BE320[10] <= 0) && (D_i5_801BE320[17] != 0) && - (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_COMPLETE)) { + (gPlayer[0].state != PLAYERSTATE_LEVEL_COMPLETE)) { D_i5_801BE320[30] = 0; this->timer_0BC = 150; this->timer_0BE = 200; @@ -1044,8 +1044,8 @@ void Macbeth_MaLocomotive_Update(MaLocomotive* this) { } if (this->timer_0BC == 100) { Object_Kill(&this->obj, this->sfxSource); - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + if (gPlayer[0].state == PLAYERSTATE_ACTIVE) { + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; gPlayer[0].csState = 0; gMissionStatus = MISSION_COMPLETE; } @@ -1091,7 +1091,7 @@ void Macbeth_MaLocomotive_Update(MaLocomotive* this) { this->state = 4; } - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) && (gCsFrameCount > 630)) { + if ((gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE) && (gCsFrameCount > 630)) { Object_Kill(&this->obj, this->sfxSource); } } @@ -2337,7 +2337,7 @@ void Macbeth_Train_Draw(Actor* this) { Vec3f frameTable[50]; s32 id; - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) { + if (gPlayer[0].state == PLAYERSTATE_ACTIVE) { if (((gPlayer[0].trueZpos - this->obj.pos.z) > 7000.0f) || ((gPlayer[0].trueZpos - this->obj.pos.z) < -1000.0f)) { return; @@ -2506,7 +2506,7 @@ void Macbeth_Train_Draw(Actor* this) { Animation_DrawSkeleton(1, D_MA_601042C, frameTable, Macbeth_MaLocomotive_OverrideLimbDraw, Macbeth_MaLocomotive_PostLimbDraw, this, &gIdentityMatrix); - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) { + if (gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE) { RCP_SetupDL(&gMasterDisp, SETUPDL_29); gSPClearGeometryMode(gMasterDisp++, G_TEXTURE_GEN); gSPDisplayList(gMasterDisp++, D_MA_6003370); @@ -2617,7 +2617,7 @@ void Macbeth_TrainTrack_Draw(Scenery* this) { switch (this->obj.id) { case OBJ_SCENERY_MA_TRAIN_TRACK_3: case OBJ_SCENERY_MA_TRAIN_TRACK_6: - if ((gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_COMPLETE) && + if ((gPlayer[0].state != PLAYERSTATE_LEVEL_COMPLETE) && ((gPlayer[0].trueZpos - this->obj.pos.z) < -2500.0f)) { Object_Kill(&this->obj, this->sfxSource); } @@ -2626,7 +2626,7 @@ void Macbeth_TrainTrack_Draw(Scenery* this) { case OBJ_SCENERY_MA_TRAIN_TRACK_4: case OBJ_SCENERY_MA_TRAIN_TRACK_7: - if ((gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_COMPLETE) && + if ((gPlayer[0].state != PLAYERSTATE_LEVEL_COMPLETE) && ((gPlayer[0].trueZpos - this->obj.pos.z) < -2500.0f)) { Object_Kill(&this->obj, this->sfxSource); } @@ -2734,7 +2734,7 @@ void Macbeth_MaTower_Draw(Scenery* this) { // Scenery 77 to 82, and 84 to 91 void Macbeth_IndicatorSign_Draw(Scenery* this) { - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) { + if (gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE) { Object_Kill(&this->obj, this->sfxSource); } @@ -3403,7 +3403,7 @@ void Macbeth_MaRailwaySignal_Update(MaRailwaySignal* this) { } gObjectLoadIndex = i; gTeamLowHealthMsgTimer = -1; - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; gPlayer[0].csState = 0; gMissionStatus = MISSION_ACCOMPLISHED; this->timer_0BC = 5; @@ -4331,7 +4331,7 @@ void Macbeth_Actor207_Update(Actor207* this) { Macbeth_801A6984(this); Macbeth_Actor207_FacePlayer(this); - if ((D_i5_801BE320[16] != 0) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE)) { + if ((D_i5_801BE320[16] != 0) && (gPlayer[0].state == PLAYERSTATE_ACTIVE)) { var_v1 = 0xFF; if (D_i5_801BE320[18] == 2) { var_v1 = 3; @@ -5191,7 +5191,8 @@ void Macbeth_Actor207_Update(Actor207* this) { this->state = 8; } } - if ((D_i5_801BE320[16] != 0) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_LEVEL_COMPLETE)) { + + if ((D_i5_801BE320[16] != 0) && (gPlayer[0].state != PLAYERSTATE_LEVEL_COMPLETE)) { if (gBossFrameCount == 0) { Radio_PlayMessage(gMsg_ID_2225, RCID_SLIPPY); } else if (gBossFrameCount > 155) { @@ -5245,7 +5246,7 @@ void Macbeth_Actor207_Update(Actor207* this) { D_i5_801BE368[22] = 16.0f; } - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_LEVEL_COMPLETE) && (this->state < 20)) { + if ((gPlayer[0].state == PLAYERSTATE_LEVEL_COMPLETE) && (this->state < 20)) { D_i5_801BE320[3] = 0; D_i5_801BE320[2] = 1; D_i5_801BE320[31] = 30; @@ -5438,7 +5439,7 @@ void Macbeth_Actor207_PostLimbDraw(s32 limbIndex, Vec3f* rot, void* thisx) { } void Macbeth_Actor207_Draw(Actor207* this) { - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) { + if (gPlayer[0].state == PLAYERSTATE_ACTIVE) { if (((gPlayer[0].trueZpos - this->obj.pos.z) > 7000.0f) || ((gPlayer[0].trueZpos - this->obj.pos.z) < -1000.0f)) { return; @@ -5508,6 +5509,7 @@ bool Macbeth_MaTrainCar1_OverrideLimbDraw(s32 limbIndex, Gfx** dList, Vec3f* pos return false; } +// unused void Macbeth_801AC6B4(ActorCutscene* this) { Actor_Initialize(this); this->obj.status = OBJ_INIT; @@ -5622,7 +5624,7 @@ void Macbeth_LevelStart(Player* player) { case 3: AUDIO_PLAY_BGM(NA_BGM_STAGE_MA); gLevelStartStatusScreenTimer = 50; - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; player->csState = player->csTimer = player->csEventTimer = player->hideShadow = 0; player->gravity = 3.0f; player->unk_014 = 0.0f; @@ -7233,7 +7235,7 @@ void Macbeth_LevelComplete2(Player* player) { gFillScreenAlphaTarget = 255; if (gFillScreenAlpha == 255) { - player->state_1C8 = PLAYERSTATE_1C8_NEXT; + player->state = PLAYERSTATE_NEXT; gFadeoutType = 4; Play_ClearObjectData(); Audio_FadeOutAll(10); @@ -7884,7 +7886,7 @@ void Macbeth_LevelComplete1(Player* player) { gFillScreenRed = gFillScreenGreen = gFillScreenBlue = 0; gFillScreenAlphaTarget = 255; if (gFillScreenAlpha == 255) { - player->state_1C8 = PLAYERSTATE_1C8_NEXT; + player->state = PLAYERSTATE_NEXT; gFadeoutType = 4; Play_ClearObjectData(); Audio_FadeOutAll(10); diff --git a/src/overlays/ovl_i5/fox_ti.c b/src/overlays/ovl_i5/fox_ti.c index a1033280..62351250 100644 --- a/src/overlays/ovl_i5/fox_ti.c +++ b/src/overlays/ovl_i5/fox_ti.c @@ -22,9 +22,7 @@ typedef struct { typedef struct { /* 0x00 */ PosRot unk_00; - /* 0x18 */ f32 unk_18; - /* 0x1C */ f32 unk_1C; - /* 0x20 */ f32 unk_20; + /* 0x18 */ Vec3f unk_18; /* 0x24 */ s16 unk_24; /* 0x26 */ u16 unk_26; } UnkStruct_i5_801BBF00; // size = 0x28 @@ -2250,7 +2248,7 @@ void Titania_TiGoras_Init(TiGoras* this) { for (var_v1 = D_i5_801BBF00, i = 0; i < ARRAY_COUNTU(D_i5_801BBF00); i++, var_v1++) { var_v1->unk_26 = 0; var_v1->unk_00.pos.x = var_v1->unk_00.pos.y = var_v1->unk_00.pos.z = var_v1->unk_00.rot.x = - var_v1->unk_00.rot.y = var_v1->unk_00.rot.z = var_v1->unk_18 = var_v1->unk_1C = var_v1->unk_20 = 0.0f; + var_v1->unk_00.rot.y = var_v1->unk_00.rot.z = var_v1->unk_18.x = var_v1->unk_18.y = var_v1->unk_18.z = 0.0f; } for (i = 0; i < ARRAY_COUNT(D_i5_801BD218); i++) { @@ -2818,13 +2816,13 @@ bool Titania_80190A08(s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3f* rot, void* Matrix_Translate(gCalcMatrix, pos->x, pos->y, pos->z, MTXF_APPLY); if (sp88 != 0) { - Matrix_RotateZ(gCalcMatrix, D_i5_801BBF00[i].unk_20 * M_DTOR, MTXF_APPLY); - Matrix_RotateY(gCalcMatrix, D_i5_801BBF00[i].unk_1C * M_DTOR, MTXF_APPLY); - Matrix_RotateX(gCalcMatrix, D_i5_801BBF00[i].unk_18 * M_DTOR, MTXF_APPLY); + Matrix_RotateZ(gCalcMatrix, D_i5_801BBF00[i].unk_18.z * M_DTOR, MTXF_APPLY); + Matrix_RotateY(gCalcMatrix, D_i5_801BBF00[i].unk_18.y * M_DTOR, MTXF_APPLY); + Matrix_RotateX(gCalcMatrix, D_i5_801BBF00[i].unk_18.x * M_DTOR, MTXF_APPLY); } else { - rot->z += D_i5_801BBF00[i].unk_20; - rot->y += D_i5_801BBF00[i].unk_1C; - rot->x += D_i5_801BBF00[i].unk_18; + rot->z += D_i5_801BBF00[i].unk_18.z; + rot->y += D_i5_801BBF00[i].unk_18.y; + rot->x += D_i5_801BBF00[i].unk_18.x; } if (sp88 != 0) { @@ -3782,6 +3780,8 @@ const char D_i5_801BAB5C[] = "Enm->chpt=<%d>\n"; #ifdef NON_MATCHING // https://decomp.me/scratch/KiTNa // Regalloc in the random ternary. Can't be a temp as it's too low on stack + +// Titania_TiGoras_Attack ? void Titania_80193DF0(TiGoras* this) { Vec3f spD4; Vec3f spC8; @@ -3900,7 +3900,7 @@ void Titania_80193DF0(TiGoras* this) { D_i5_801BBEF0[6]--; if (D_i5_801BBEF0[6] == 0) { for (i = 0; i < ARRAY_COUNTU(D_i5_801BBF00); i++) { - D_i5_801BBF00[i].unk_18 = D_i5_801BBF00[i].unk_1C = D_i5_801BBF00[i].unk_20 = 0.0f; + D_i5_801BBF00[i].unk_18.x = D_i5_801BBF00[i].unk_18.y = D_i5_801BBF00[i].unk_18.z = 0.0f; } } } @@ -3965,7 +3965,7 @@ void Titania_80193DF0(TiGoras* this) { if (this->animFrame) {} if (j == ARRAY_COUNT(D_i5_801B8160)) { - D_i5_801BBF00[i].unk_20 = RAND_FLOAT(5.0f) - 2.5f; + D_i5_801BBF00[i].unk_18.z = RAND_FLOAT(5.0f) - 2.5f; } } } @@ -5176,7 +5176,7 @@ void Titania_TiGoras_Update(Boss* boss) { boss->swork[31]++; } -f32 D_i5_801B8D5C[50] = { +f32 D_i5_801B8D5C[2][25] = { 0.0f, 0.03f, 0.06f, 0.12f, 0.18f, 0.25f, 0.425f, 0.6f, 0.775f, 0.95f, 1.125f, 1.3f, 1.475f, 1.65f, 1.825f, 2.0f, 1.8f, 1.6f, 1.4f, 1.2f, 1.0f, 0.8f, 0.6f, 0.4f, 0.2f, 0.0f, 0.8f, 1.6f, 2.4f, 3.2f, 4.0f, 3.4f, 3.2f, 3.0f, 2.8f, 2.4f, 2.2f, 2.0f, 1.8f, @@ -5355,7 +5355,7 @@ void Titania_TiGoras_Draw(TiGoras* boss) { Matrix_RotateX(gGfxMatrix, (boss->fwork[22] - 180.0f) * M_DTOR, MTXF_APPLY); Matrix_RotateZ(gGfxMatrix, (boss->fwork[20] + ((boss->animFrame - 15) * 15.6f)) * M_DTOR, MTXF_APPLY); - Matrix_Scale(gGfxMatrix, D_i5_801B8D5C[temp], D_i5_801B8D5C[temp], D_i5_801B8D5C[temp + 25], + Matrix_Scale(gGfxMatrix, D_i5_801B8D5C[0][temp], D_i5_801B8D5C[0][temp], D_i5_801B8D5C[1][temp], MTXF_APPLY); Matrix_SetGfxMtx(&gMasterDisp); RCP_SetupDL(&gMasterDisp, SETUPDL_49); @@ -5453,10 +5453,10 @@ void Titania_TiGoras_Draw(TiGoras* boss) { Vec3f D_i5_801B8E44 = { 3.0f, 0.0f, 0.0f }; -void Titania_801990DC(TiGoras* this) { +void Titania_TiGoras_Dying(TiGoras* this) { s32 i; Vec3f sp60; - Actor* actor; + ActorDebris* debris; if (this->work_044 == 0) { AUDIO_PLAY_SFX(NA_SE_EN_TIBOSS_DW_CRY, this->sfxSource, 4); @@ -5469,49 +5469,49 @@ void Titania_801990DC(TiGoras* this) { gShowBossHealth = false; - actor = &gActors[0]; - for (i = 0; i < ARRAY_COUNT(gActors); i++, actor++) { - if ((actor->obj.status == OBJ_ACTIVE) && (actor->obj.id == OBJ_ACTOR_DEBRIS) && (actor->state == 40)) { - actor->gravity = 0.2f; + debris = &gActors[0]; + for (i = 0; i < ARRAY_COUNT(gActors); i++, debris++) { + if ((debris->obj.status == OBJ_ACTIVE) && (debris->obj.id == OBJ_ACTOR_DEBRIS) && (debris->state == 40)) { + debris->gravity = 0.2f; } } for (i = 0; i < ARRAY_COUNTU(D_i5_801BBF00); i++) { if (!(D_i5_801BBF00[i].unk_26 & 4)) { - actor = Game_SpawnActor(OBJ_ACTOR_DEBRIS); - if (actor != NULL) { - actor->state = 40; + debris = Game_SpawnActor(OBJ_ACTOR_DEBRIS); + if (debris != NULL) { + debris->state = 40; - actor->work_046 = D_i5_801B7770[i][5]; - actor->work_048 = D_i5_801B7770[i][1]; + debris->work_046 = D_i5_801B7770[i][5]; + debris->work_048 = D_i5_801B7770[i][1]; Matrix_RotateY(gCalcMatrix, this->obj.rot.y * M_DTOR, MTXF_NEW); Matrix_MultVec3f(gCalcMatrix, &D_i5_801BBF00[i].unk_00.pos, &sp60); - actor->obj.pos.x = this->obj.pos.x + sp60.x; - actor->obj.pos.y = this->obj.pos.y + sp60.y; - actor->obj.pos.z = this->obj.pos.z + sp60.z; + debris->obj.pos.x = this->obj.pos.x + sp60.x; + debris->obj.pos.y = this->obj.pos.y + sp60.y; + debris->obj.pos.z = this->obj.pos.z + sp60.z; - actor->obj.rot.x = D_i5_801BBF00[i].unk_00.rot.x + this->obj.rot.x; - actor->obj.rot.y = D_i5_801BBF00[i].unk_00.rot.y + this->obj.rot.y; - actor->obj.rot.z = D_i5_801BBF00[i].unk_00.rot.z + this->obj.rot.z; + debris->obj.rot.x = D_i5_801BBF00[i].unk_00.rot.x + this->obj.rot.x; + debris->obj.rot.y = D_i5_801BBF00[i].unk_00.rot.y + this->obj.rot.y; + debris->obj.rot.z = D_i5_801BBF00[i].unk_00.rot.z + this->obj.rot.z; if (i == 51) { - actor->vel.x = RAND_FLOAT(10.0f) - 5.0f; - actor->vel.y = 30.0f; - actor->vel.z = -30.0f; - actor->gravity = 0.1f; + debris->vel.x = RAND_FLOAT(10.0f) - 5.0f; + debris->vel.y = 30.0f; + debris->vel.z = -30.0f; + debris->gravity = 0.1f; } else { - actor->fwork[0] = ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (RAND_FLOAT(5.0f) + 5.0f); - actor->fwork[1] = ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (RAND_FLOAT(5.0f) + 5.0f); + debris->fwork[0] = ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (RAND_FLOAT(5.0f) + 5.0f); + debris->fwork[1] = ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (RAND_FLOAT(5.0f) + 5.0f); Matrix_Push(&gCalcMatrix); Matrix_RotateY(gCalcMatrix, RAND_FLOAT(360.0f) * M_DTOR, MTXF_NEW); Matrix_MultVec3f(gCalcMatrix, &D_i5_801B8E44, &sp60); Matrix_Pop(&gCalcMatrix); - actor->vel.x = sp60.x; - actor->vel.y = SIGN_OF(D_i5_801BBF00[i].unk_00.pos.y - 250.0f) - RAND_FLOAT(0.5f) + 0.5f; - actor->vel.z = (this->vel.z * 0.5f) + sp60.z; - actor->gravity = 0.1f; + debris->vel.x = sp60.x; + debris->vel.y = SIGN_OF(D_i5_801BBF00[i].unk_00.pos.y - 250.0f) - RAND_FLOAT(0.5f) + 0.5f; + debris->vel.z = (this->vel.z * 0.5f) + sp60.z; + debris->gravity = 0.1f; } } D_i5_801BBF00[i].unk_26 = 4; @@ -5524,87 +5524,90 @@ void Titania_801990DC(TiGoras* this) { switch (this->timer_050) { case 100: - actor = Game_SpawnActor(OBJ_ACTOR_DEBRIS); - if (actor != NULL) { - actor->fwork[0] = ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (RAND_FLOAT(1.0f) + 1.0f); - actor->fwork[1] = ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (RAND_FLOAT(1.0f) + 1.0f); + debris = Game_SpawnActor(OBJ_ACTOR_DEBRIS); + if (debris != NULL) { + debris->fwork[0] = ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (RAND_FLOAT(1.0f) + 1.0f); + debris->fwork[1] = ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (RAND_FLOAT(1.0f) + 1.0f); - actor->state = 40; + debris->state = 40; - actor->work_046 = 25; - actor->work_048 = 0; - actor->work_04A = 4 | 2; + debris->work_046 = 25; + debris->work_048 = 0; + debris->work_04A = 4 | 2; - actor->fwork[3] = 0.0f; - actor->fwork[4] = -200.0f; + debris->fwork[3] = 0.0f; + debris->fwork[4] = -200.0f; - actor->obj.pos.x = gPlayer[0].pos.x; - actor->obj.pos.y = 500.0f; - actor->obj.pos.z = gPlayer[0].trueZpos + actor->fwork[4]; - actor->obj.rot.y = (RAND_FLOAT(5.0f) + 90.0f) - 2.5f; - actor->obj.rot.z = (RAND_FLOAT(5.0f) + 180.0f) - 2.5f; + debris->obj.pos.x = gPlayer[0].pos.x; + debris->obj.pos.y = 500.0f; + debris->obj.pos.z = gPlayer[0].trueZpos + debris->fwork[4]; - actor->vel.y = -10.0f; - actor->gravity = 0.8f; + debris->obj.rot.y = (RAND_FLOAT(5.0f) + 90.0f) - 2.5f; + debris->obj.rot.z = (RAND_FLOAT(5.0f) + 180.0f) - 2.5f; + + debris->vel.y = -10.0f; + debris->gravity = 0.8f; } break; case 120: - actor = Game_SpawnActor(OBJ_ACTOR_DEBRIS); - if (actor != NULL) { - actor->fwork[0] = ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (RAND_FLOAT(5.0f) + 5.0f); - actor->fwork[1] = ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (RAND_FLOAT(5.0f) + 5.0f); + debris = Game_SpawnActor(OBJ_ACTOR_DEBRIS); + if (debris != NULL) { + debris->fwork[0] = ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (RAND_FLOAT(5.0f) + 5.0f); + debris->fwork[1] = ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (RAND_FLOAT(5.0f) + 5.0f); - actor->state = 40; + debris->state = 40; - actor->work_046 = 2; - actor->work_048 = 1; - actor->work_04A = 4 | 2; + debris->work_046 = 2; + debris->work_048 = 1; + debris->work_04A = 4 | 2; - actor->iwork[1] = (s32) 1; - actor->fwork[3] = -150.0f; - actor->fwork[4] = -200.0f; - actor->fwork[5] = 200.0f; + debris->iwork[1] = (s32) 1; + debris->fwork[3] = -150.0f; + debris->fwork[4] = -200.0f; + debris->fwork[5] = 200.0f; - actor->obj.pos.x = gPlayer[0].pos.x + actor->fwork[3]; - actor->obj.pos.y = 500.0f; - actor->obj.pos.z = gPlayer[0].trueZpos + actor->fwork[4]; - actor->obj.rot.z = 90.0f; - actor->vel.y = -10.0f; - actor->gravity = 0.8f; + debris->obj.pos.x = gPlayer[0].pos.x + debris->fwork[3]; + debris->obj.pos.y = 500.0f; + debris->obj.pos.z = gPlayer[0].trueZpos + debris->fwork[4]; + + debris->obj.rot.z = 90.0f; + debris->vel.y = -10.0f; + debris->gravity = 0.8f; } break; case 140: - actor = Game_SpawnActor(OBJ_ACTOR_DEBRIS); - if (actor != NULL) { - actor->fwork[0] = ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (RAND_FLOAT(1.0f) + 1.0f); - actor->fwork[1] = ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (RAND_FLOAT(1.0f) + 1.0f); + debris = Game_SpawnActor(OBJ_ACTOR_DEBRIS); + if (debris != NULL) { + debris->fwork[0] = ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (RAND_FLOAT(1.0f) + 1.0f); + debris->fwork[1] = ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (RAND_FLOAT(1.0f) + 1.0f); - actor->state = 40; + debris->state = 40; - actor->work_046 = 2; - actor->work_048 = 1; - actor->work_04A = 4 | 2; + debris->work_046 = 2; + debris->work_048 = 1; + debris->work_04A = 4 | 2; - actor->iwork[1] = 2; - actor->fwork[3] = 100.0f; - actor->fwork[4] = -100.0f; - actor->fwork[5] = 200.0f; + debris->iwork[1] = 2; + debris->fwork[3] = 100.0f; + debris->fwork[4] = -100.0f; + debris->fwork[5] = 200.0f; - actor->obj.pos.x = gPlayer[0].pos.x + actor->fwork[3]; - actor->obj.pos.y = 500.0f; - actor->obj.pos.z = gPlayer[0].trueZpos + actor->fwork[4]; - actor->obj.rot.z = 90.0f; - actor->vel.y = -10.0f; - actor->gravity = 0.8f; + debris->obj.pos.x = gPlayer[0].pos.x + debris->fwork[3]; + debris->obj.pos.y = 500.0f; + debris->obj.pos.z = gPlayer[0].trueZpos + debris->fwork[4]; + + debris->obj.rot.z = 90.0f; + debris->vel.y = -10.0f; + debris->gravity = 0.8f; } break; } - if ((this->timer_050 == 0) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE)) { + if ((this->timer_050 == 0) && (gPlayer[0].state == PLAYERSTATE_ACTIVE)) { Object_Kill(&this->obj, this->sfxSource); - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; gPlayer[0].csState = 0; } } diff --git a/src/overlays/ovl_i5/fox_ti_cs.c b/src/overlays/ovl_i5/fox_ti_cs.c index 871d6425..99e2287e 100644 --- a/src/overlays/ovl_i5/fox_ti_cs.c +++ b/src/overlays/ovl_i5/fox_ti_cs.c @@ -221,7 +221,7 @@ void Titania_LevelStart(Player* player) { if (gCsFrameCount == 580) { gLevelStartStatusScreenTimer = 50; - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; player->csState = player->csTimer = player->csEventTimer = player->hideShadow = 0; player->gravity = 3.0f; player->unk_014 = 0.0f; @@ -524,7 +524,7 @@ void Titania_LevelComplete(Player* player) { gFillScreenAlphaTarget = 255; if (gFillScreenAlpha == 255) { - player->state_1C8 = PLAYERSTATE_1C8_NEXT; + player->state = PLAYERSTATE_NEXT; gFadeoutType = 4; Play_ClearObjectData(); Audio_FadeOutAll(10); diff --git a/src/overlays/ovl_i6/fox_andross.c b/src/overlays/ovl_i6/fox_andross.c index 8bac4e70..5cd2bbea 100644 --- a/src/overlays/ovl_i6/fox_andross.c +++ b/src/overlays/ovl_i6/fox_andross.c @@ -329,7 +329,7 @@ void Andross_80188468(void) { actor->obj.pos.y = 300.0f; actor->obj.pos.z = -11959.0f; actor->iwork[11] = 1; - actor->iwork[14] = 1; + actor->iwork[TEAM_FACE] = FACE_FOX; actor->obj.id = OBJ_ACTOR_TEAM_ARWING; Object_SetInfo(&actor->info, actor->obj.id); AUDIO_PLAY_SFX(NA_SE_ARWING_ENGINE_FG, actor->sfxSource, 4); @@ -450,7 +450,7 @@ void Andross_80188A4C(AndBrain* this) { gScreenFlashTimer = 8; AUDIO_PLAY_SFX(NA_SE_EN_DOWN_IMPACT, this->sfxSource, 4); Boss_AwardBonus(this); - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_STANDBY; + gPlayer[0].state = PLAYERSTATE_STANDBY; this->state = 20; this->swork[1] = 1000; this->swork[2] = 1000; @@ -658,7 +658,7 @@ void Andross_AndJamesTrigger_Update(AndJamesTrigger* this) { s32 i; Player* player = &gPlayer[0]; - if ((gDrawBackdrop != 7) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) && + if ((gDrawBackdrop != 7) && (gPlayer[0].state == PLAYERSTATE_ACTIVE) && (fabsf(this->obj.pos.x - gPlayer[0].pos.x) < 9000.0f) && (fabsf(this->obj.pos.z - gPlayer[0].trueZpos) < 9000.0f)) { gDrawBackdrop = 7; @@ -667,14 +667,14 @@ void Andross_AndJamesTrigger_Update(AndJamesTrigger* this) { SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 20); } - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) && (fabsf(this->obj.pos.x - gPlayer[0].pos.x) < 500.0f) && + if ((gPlayer[0].state == PLAYERSTATE_ACTIVE) && (fabsf(this->obj.pos.x - gPlayer[0].pos.x) < 500.0f) && (fabsf(this->obj.pos.z - gPlayer[0].trueZpos) < 500.0f)) { Audio_KillSfxById(NA_SE_OB_ROUTE_EXPLOSION1); Audio_SetEnvSfxReverb(0); gCurrentLevel = LEVEL_VENOM_2; gLevelPhase = 1; gVenomHardClear = 1; - player->state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + player->state = PLAYERSTATE_LEVEL_COMPLETE; player->csState = 3; player->zPath = gPathProgress = 0.0f; gDrawBackdrop = gDrawGround = true; @@ -734,7 +734,7 @@ void Andross_AndExplosion_Update(AndExplosion* this) { if ((fabsf(this->obj.pos.x - gPlayer[0].pos.x) < 500.0f) && (fabsf(this->obj.pos.z - gPlayer[0].trueZpos) < 500.0f)) { - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE || gPlayer[0].state_1C8 == PLAYERSTATE_1C8_U_TURN)) { + if ((gPlayer[0].state == PLAYERSTATE_ACTIVE || gPlayer[0].state == PLAYERSTATE_U_TURN)) { gPlayer[0].shields = 0; gRightWingHealth[0] = gLeftWingHealth[0] = 0; Player_ApplyDamage(&gPlayer[0], 1, 60); @@ -843,7 +843,7 @@ void Andross_AndBrain_Update(AndBrain* this) { this->swork[5] = 100; if (this->timer_050 == 0) { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_START_360; + gPlayer[0].state = PLAYERSTATE_START_360; gPlayer[0].csState = 0; this->state = 1; gPlayer[0].hideShadow = true; @@ -851,7 +851,7 @@ void Andross_AndBrain_Update(AndBrain* this) { break; case 1: - if ((gPlayer[0].state_1C8 != PLAYERSTATE_1C8_START_360) && (this->timer_050 == 0)) { + if ((gPlayer[0].state != PLAYERSTATE_START_360) && (this->timer_050 == 0)) { this->fwork[2] = 1.6f; this->timer_050 = RAND_INT(1.0f) * 50.0f + 50; this->fwork[3] = RAND_FLOAT_CENTERED(10000.0f); @@ -885,7 +885,7 @@ void Andross_AndBrain_Update(AndBrain* this) { Math_SmoothStepToF(&D_ctx_801779A8[gMainController], 40.0f, 1.0f, 3.0f, 0.0f); - if (((gGameFrameCount % 32) == 0) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE)) { + if (((gGameFrameCount % 32) == 0) && (gPlayer[0].state == PLAYERSTATE_ACTIVE)) { Player_ApplyDamage(&gPlayer[0], 3, 10); } } @@ -1082,7 +1082,7 @@ void Andross_AndBrain_Update(AndBrain* this) { gPlayer[0].rot.z = 0.0f; gPlayer[0].zRotBank = 150.0f; gPlayer[0].camRoll = -90.0f; - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; gPlayer[0].csState = 100; gPlayer[0].csTimer = 240; gPlayer[0].draw = true; @@ -1121,7 +1121,7 @@ void Andross_AndBrain_Update(AndBrain* this) { } this->obj.pos.y = 10000.0f; - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) && ((gGameFrameCount % 4) == 0)) { + if ((gPlayer[0].state == PLAYERSTATE_ACTIVE) && ((gGameFrameCount % 4) == 0)) { Matrix_RotateY(gCalcMatrix, (gPlayer[0].yRot_114 + gPlayer[0].rot.y) * M_DTOR, 0U); vec.x = RAND_FLOAT_CENTERED(800.0f); vec.y = 600.0f; @@ -1129,7 +1129,7 @@ void Andross_AndBrain_Update(AndBrain* this) { Matrix_MultVec3fNoTranslate(gCalcMatrix, &vec, &sp64); Andross_Effect357_Spawn(gPlayer[0].pos.x + sp64.x, sp64.y, gPlayer[0].trueZpos + sp64.z, 1.2f); } - if (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_STANDBY) { + if (gPlayer[0].state != PLAYERSTATE_STANDBY) { Matrix_RotateY(gCalcMatrix, -gPlayer[0].camYaw, MTXF_NEW); vec.x = 0.0f; @@ -1434,7 +1434,7 @@ void Andross_8018C390(Player* player) { } } if (player->csTimer == 0) { - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; player->unk_014 = 0.0f; player->unk_018 = 0.0f; } @@ -1679,7 +1679,7 @@ void Andross_Effect396_Draw(Effect396* this) { } void Andross_8018D0D8(AndAndross* this) { - if ((gPlayer[0].mercyTimer == 0) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) && + if ((gPlayer[0].mercyTimer == 0) && (gPlayer[0].state == PLAYERSTATE_ACTIVE) && (fabsf(this->vwork[10].x - gPlayer[0].pos.x) < 700.0f) && (fabsf(this->vwork[10].y - gPlayer[0].pos.y) < 700.0f)) { Player_ApplyDamage(&gPlayer[0], 0, 40); @@ -1734,7 +1734,7 @@ void Andross_8018D2B0(AndAndross* this) { this->state = 31; this->timer_050 = 200; - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; gPlayer[0].csState = 0; } else if (this->health < 50) { AUDIO_PLAY_SFX(NA_SE_EN_KNOCK_DOWN, this->sfxSource, 4); @@ -2520,11 +2520,11 @@ void Andross_AndAndross_Update(AndAndross* this) { } if ((this->animFrame > 35) && (this->animFrame < 150) && ((this->animFrame % 32) == 0)) { AUDIO_PLAY_SFX(NA_SE_EN_ANDROSS_BITE1, this->sfxSource, 4); - if (player->state_1C8 == PLAYERSTATE_1C8_ANDROSS_MOUTH) { + if (player->state == PLAYERSTATE_ANDROSS_MOUTH) { gControllerRumbleTimers[0] = 10; } } - if ((this->animFrame == 20) && (player->state_1C8 == PLAYERSTATE_1C8_ANDROSS_MOUTH)) { + if ((this->animFrame == 20) && (player->state == PLAYERSTATE_ANDROSS_MOUTH)) { player->draw = false; for (i = 0; i < ARRAY_COUNT(gEffects); i++) { if (gEffects[i].obj.id == OBJ_EFFECT_396) { @@ -2592,7 +2592,7 @@ void Andross_AndAndross_Update(AndAndross* this) { AUDIO_PLAY_SFX(NA_SE_EN_ANDROSS_VOMIT, this->sfxSource, 4); } - if ((this->animFrame == 13) && (player->state_1C8 == PLAYERSTATE_1C8_ANDROSS_MOUTH)) { + if ((this->animFrame == 13) && (player->state == PLAYERSTATE_ANDROSS_MOUTH)) { player->draw = true; player->csState = 1; player->csTimer = 60; @@ -2687,8 +2687,8 @@ void Andross_AndAndross_Update(AndAndross* this) { this->swork[8] = 1; this->fwork[9] = 0.2f; this->animFrame = 0; - if (player->state_1C8 == PLAYERSTATE_1C8_ACTIVE) { - player->state_1C8 = PLAYERSTATE_1C8_ANDROSS_MOUTH; + if (player->state == PLAYERSTATE_ACTIVE) { + player->state = PLAYERSTATE_ANDROSS_MOUTH; player->csState = 0; } break; @@ -3648,7 +3648,6 @@ void Andross_AndLaserEmitter_Draw(AndLaserEmitter* this) { } void Andross_AndDoor_Update(AndDoor* this) { - switch (this->state) { case 0: if (fabsf(this->obj.pos.z - gPlayer[0].trueZpos) < 1800.0f) { @@ -3788,12 +3787,12 @@ void Andross_801939A0(s32 actorIdx) { actor->fwork[1] = 6.5f; if (actorIdx == 10) { - actor->iwork[14] = 1; + actor->iwork[TEAM_FACE] = FACE_FOX; } if (actorIdx == 1) { actor->state = 1; actor->work_046 = 255; - actor->animFrame = ACTOR_CS_1000; + actor->animFrame = ACTOR_CS_JAMES_ARWING; } Object_SetInfo(&actor->info, actor->obj.id); @@ -4307,6 +4306,7 @@ void Andross_80193C4C(Player* player) { gShowLevelClearStatusScreen = false; break; } + // Shooting Star. James? Is that you? if (gCsFrameCount > 1300) { rnd = RAND_INT(100.0f); gStarFillColors[1155] = FILL_COLOR(gStarColors[rnd % 16U]); @@ -4368,7 +4368,7 @@ void Andross_80193C4C(Player* player) { player->vel.z = sp68.z; player->vel.y = sp68.y; if (player->csTimer == 0) { - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; player->unk_014 = 0.2f; player->unk_018 = 0.0f; player->unk_01C = 0.05f; diff --git a/src/overlays/ovl_i6/fox_sy.c b/src/overlays/ovl_i6/fox_sy.c index 9eb22ef4..dd7b13fa 100644 --- a/src/overlays/ovl_i6/fox_sy.c +++ b/src/overlays/ovl_i6/fox_sy.c @@ -83,7 +83,7 @@ void SectorY_SyShogun_Init(SyShogun* this) { this->fwork[43] = 3.5f; this->fwork[45] = 40.0f; - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_START_360) { + if (gPlayer[0].state == PLAYERSTATE_START_360) { this->obj.pos.z = -28900.0f; gScenery360[SHOGUN_SHIP].obj.pos.z = -30000.0f; } @@ -111,8 +111,8 @@ void SectorY_SyShogun_Init(SyShogun* this) { } if (gLevelMode == LEVELMODE_ON_RAILS) { - if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_START_360; + if (gPlayer[0].state == PLAYERSTATE_ACTIVE) { + gPlayer[0].state = PLAYERSTATE_START_360; gPlayer[0].csState = 0; SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); @@ -283,7 +283,7 @@ void SectorY_801983E4(SyShogun* this) { } else { SectorY_80199D64(this); } - } else if (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_U_TURN) { + } else if (gPlayer[0].state != PLAYERSTATE_U_TURN) { Math_SmoothStepToAngle(&this->rot_078.x, 181.0f, 0.1f, 6.0f, 0.1f); this->swork[21] = 3; this->fwork[11] = SIN_DEG(this->rot_078.y) * (this->fwork[45] + 10.0f); @@ -438,9 +438,9 @@ void SectorY_80198F5C(SyShogun* this) { if (this->index == 0) { this->timer_058 = 20000; this->vel.x = this->vel.y = this->vel.z = 0.0f; - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_U_TURN)) { + if ((gPlayer[0].state == PLAYERSTATE_ACTIVE) || (gPlayer[0].state == PLAYERSTATE_U_TURN)) { gCsFrameCount = 0; - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + gPlayer[0].state = PLAYERSTATE_LEVEL_COMPLETE; gPlayer[0].csTimer = 0; gPlayer[0].csState = gPlayer[0].csTimer; gPlayer[0].rot.y += gPlayer[0].yRot_114; @@ -475,9 +475,9 @@ void SectorY_80198F5C(SyShogun* this) { this->vel.y = 0.0f; this->vel.x = 0.0f; - if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_ACTIVE) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_U_TURN)) { + if ((gPlayer[0].state == PLAYERSTATE_ACTIVE) || (gPlayer[0].state == PLAYERSTATE_U_TURN)) { this->timer_058 = 100; - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_STANDBY; + gPlayer[0].state = PLAYERSTATE_STANDBY; gCsFrameCount = 0; xDisplacement = gPlayer[0].cam.eye.x - this->obj.pos.x; zDisplacement = gPlayer[0].cam.eye.z - this->obj.pos.z; @@ -631,7 +631,7 @@ void SectorY_80199438(SyShogun* this) { gScenery360[SHOGUN_SHIP].info.dList = aSySaruzinDL; gScenery360[SHOGUN_SHIP].info.drawType = 0; } else { - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_ACTIVE; + gPlayer[0].state = PLAYERSTATE_ACTIVE; Camera_UpdateArwing360(&gPlayer[0], true); gPlayer[0].unk_014 = 0.0f; if (gTeamShields[TEAM_ID_PEPPY] > 0) { @@ -1096,7 +1096,7 @@ void SectorY_8019AEEC(SyShogun* this) { gScenery360[SHOGUN_SHIP].obj.pos.z = -20000.0f; this->fwork[43] = 0.0f; this->vel.y = 0.0f; - gPlayer[0].state_1C8 = PLAYERSTATE_1C8_ACTIVE; + gPlayer[0].state = PLAYERSTATE_ACTIVE; Camera_UpdateArwing360(&gPlayer[0], true); gPlayer[0].unk_014 = 0.0f; this->swork[34]++; @@ -1409,7 +1409,7 @@ void SectorY_SyShogun_Update(SyShogun* this) { Vec3f dest; s32 pad; - if (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_START_360) { + if (gPlayer[0].state != PLAYERSTATE_START_360) { if (this->swork[34] == 1) { if (this->health > 0) { gScenery360[SHOGUN_SHIP].obj.pos.z += 20.0f; @@ -2271,7 +2271,7 @@ void SectorY_LevelComplete(Player* player) { gFillScreenAlphaStep = 8; if (gFillScreenAlpha == 255) { Audio_FadeOutAll(10); - player->state_1C8 = PLAYERSTATE_1C8_NEXT; + player->state = PLAYERSTATE_NEXT; player->csTimer = 0; gFadeoutType = 4; gLeveLClearStatus[LEVEL_SECTOR_Y] = Play_CheckMedalStatus(150) + 1; @@ -2539,7 +2539,7 @@ void SectorY_801A0510(ActorCutscene* this, s32 arg1) { case 1: case 2: case 8: - this->animFrame = ACTOR_CS_38; + this->animFrame = ACTOR_CS_SY_ROBOT; this->obj.rot.y = 90.0f; Object_SetInfo(&this->info, this->obj.id); break; @@ -3415,7 +3415,7 @@ void SectorY_801A0AC0(Player* player) { gLevelStartStatusScreenTimer = 100; - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; player->csState = 0; player->csTimer = 0; player->csEventTimer = 0; diff --git a/src/overlays/ovl_i6/fox_ve2.c b/src/overlays/ovl_i6/fox_ve2.c index aa55ed03..bb602d38 100644 --- a/src/overlays/ovl_i6/fox_ve2.c +++ b/src/overlays/ovl_i6/fox_ve2.c @@ -53,7 +53,7 @@ void Venom2_UpdateEvents(ActorAllRange* this) { gStarWolfTeamAlive[i] = 1; } - if (player->state_1C8 == PLAYERSTATE_1C8_ACTIVE) { + if (player->state == PLAYERSTATE_ACTIVE) { this->state = 2; player->pos.x = 0.0f; player->pos.z = 8000.0f; @@ -93,7 +93,7 @@ void Venom2_UpdateEvents(ActorAllRange* this) { if (this->timer_0BC == 0) { team->state = 2; this->state = 2; - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; player->unk_014 = 0.0001f; gLevelStartStatusScreenTimer = 80; } @@ -110,14 +110,15 @@ void Venom2_UpdateEvents(ActorAllRange* this) { (gActors[7].obj.status == OBJ_FREE) && (this->timer_0BE == 0)) { this->timer_0BE = 80; } - if ((this->timer_0BE == 1) && (player->state_1C8 != PLAYERSTATE_1C8_LEVEL_COMPLETE)) { + + if ((this->timer_0BE == 1) && (player->state != PLAYERSTATE_LEVEL_COMPLETE)) { for (i = 1; i < ARRAY_COUNT(gTeamShields); i++) { gPrevPlanetTeamShields[i] = gSavedTeamShields[i]; gPrevPlanetSavedTeamShields[i] = gSavedTeamShields[i]; gSavedTeamShields[i] = gTeamShields[i]; } - player->state_1C8 = PLAYERSTATE_1C8_LEVEL_COMPLETE; + player->state = PLAYERSTATE_LEVEL_COMPLETE; player->csState = 0; gLeveLClearStatus[gCurrentLevel] = 2; D_ctx_80177C94 = gGoldRingCount[0]; @@ -144,7 +145,7 @@ void Venom2_UpdateEvents(ActorAllRange* this) { if ((gControllerPress->button & START_BUTTON) || (gAllRangeEventTimer == (gAllRangeSpawnEvent + 300))) { this->state = 2; - player->state_1C8 = PLAYERSTATE_1C8_ACTIVE; + player->state = PLAYERSTATE_ACTIVE; Camera_Update360(player, true); player->unk_014 = 0.0f; D_hud_80161708 = 0; diff --git a/src/overlays/ovl_menu/fox_map.c b/src/overlays/ovl_menu/fox_map.c index 8fd80b3f..9694ca8d 100644 --- a/src/overlays/ovl_menu/fox_map.c +++ b/src/overlays/ovl_menu/fox_map.c @@ -2008,7 +2008,7 @@ s32 Map_801A05B4(void) { temp_a0 = gSaveFile.save.data.rankingRoute[i]; for (j = 0; j < temp_a0; j++) { var_a3 = gSaveFile.save.data.stats[i][j].hitCount; - if (gSaveFile.save.data.stats[i][j].unk_C != 0) { + if (gSaveFile.save.data.stats[i][j].hitCountOver256 != 0) { var_a3 += 256; } sp30[i] += var_a3; diff --git a/src/overlays/ovl_menu/fox_option.c b/src/overlays/ovl_menu/fox_option.c index 72e095da..be927a56 100644 --- a/src/overlays/ovl_menu/fox_option.c +++ b/src/overlays/ovl_menu/fox_option.c @@ -1426,33 +1426,33 @@ void Option_Sound_SetSoundMode(void) { } void Option_Sound_SetVolumeLevels(void) { - s32 var_v1; + s32 volume; D_menu_801B924C = D_menu_801AE99C[D_menu_801B9288 - 1]; if (Option_Input_Sound_X(&(D_menu_801AEB48[D_menu_801B9288 - 1].xPos), 146.0f, 245.0f, &D_menu_801B9268)) { - var_v1 = D_menu_801AEB48[D_menu_801B9288 - 1].xPos - 146.0f; + volume = D_menu_801AEB48[D_menu_801B9288 - 1].xPos - 146.0f; - gVolumeSettings[D_menu_801B9288 - 1] = var_v1; + gVolumeSettings[D_menu_801B9288 - 1] = volume; - if (var_v1 > 99) { - var_v1 = 99; + if (volume > 99) { + volume = 99; } switch (D_menu_801B9288 - 1) { case 0: - gSaveFile.save.data.musicVolume = var_v1; + gSaveFile.save.data.musicVolume = volume; break; case 1: - gSaveFile.save.data.voiceVolume = var_v1; + gSaveFile.save.data.voiceVolume = volume; break; case 2: - gSaveFile.save.data.sfxVolume = var_v1; + gSaveFile.save.data.sfxVolume = volume; break; } - Audio_SetVolume(D_menu_801B924C, var_v1); + Audio_SetVolume(D_menu_801B924C, volume); } } @@ -2414,7 +2414,7 @@ void Option_RankingHitCount_Draw(s32 rankIdx, s32 routeIdx, f32 xPos, f32 yPos) if ((yPos > 22.0f) && (yPos < 162.0f)) { RCP_SetupDL(&gMasterDisp, SETUPDL_83); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255); - hitCount = (gSaveFile.save.data.stats[rankIdx][routeIdx].unk_C & 1) << 8; + hitCount = (gSaveFile.save.data.stats[rankIdx][routeIdx].hitCountOver256 & 1) << 8; hitCount |= gSaveFile.save.data.stats[rankIdx][routeIdx].hitCount; Graphics_DisplaySmallNumber(xPos + 15.0f - (HUD_CountDigits(hitCount) - 1) * 8, yPos + 24.0f + 1.0f, hitCount); } @@ -4318,13 +4318,13 @@ void Option_Ranking_SaveData(void) { } for (j = 0; j < ROUTE_MAX; j++) { - planetStats[10][j].unk_C = 0; + planetStats[10][j].hitCountOver256 = 0; missionHitCount = gMissionHitCount[j]; if (missionHitCount > 255) { missionHitCount -= 256; - planetStats[10][j].unk_C = 1; + planetStats[10][j].hitCountOver256 = 1; } planetStats[10][j].hitCount = missionHitCount; @@ -4357,7 +4357,7 @@ void Option_Ranking_SaveData(void) { for (j = 0; j < ROUTE_MAX; j++) { planetStats[i][j].hitCount = gSaveFile.save.data.stats[i][j].hitCount; planetStats[i][j].planetId = gSaveFile.save.data.stats[i][j].planetId; - planetStats[i][j].unk_C = gSaveFile.save.data.stats[i][j].unk_C; + planetStats[i][j].hitCountOver256 = gSaveFile.save.data.stats[i][j].hitCountOver256; planetStats[i][j].peppyAlive = gSaveFile.save.data.stats[i][j].peppyAlive; planetStats[i][j].falcoAlive = gSaveFile.save.data.stats[i][j].falcoAlive; planetStats[i][j].slippyAlive = gSaveFile.save.data.stats[i][j].slippyAlive; @@ -4380,7 +4380,7 @@ void Option_Ranking_SaveData(void) { for (j = 0; j < ROUTE_MAX; j++) { gSaveFile.save.data.stats[i][j].hitCount = planetStats[currentRankIdx][j].hitCount; gSaveFile.save.data.stats[i][j].planetId = planetStats[currentRankIdx][j].planetId; - gSaveFile.save.data.stats[i][j].unk_C = planetStats[currentRankIdx][j].unk_C; + gSaveFile.save.data.stats[i][j].hitCountOver256 = planetStats[currentRankIdx][j].hitCountOver256; gSaveFile.save.data.stats[i][j].peppyAlive = planetStats[currentRankIdx][j].peppyAlive; gSaveFile.save.data.stats[i][j].falcoAlive = planetStats[currentRankIdx][j].falcoAlive; gSaveFile.save.data.stats[i][j].slippyAlive = planetStats[currentRankIdx][j].slippyAlive; diff --git a/src/overlays/ovl_menu/fox_title.c b/src/overlays/ovl_menu/fox_title.c index 5dc79d88..b6f48733 100644 --- a/src/overlays/ovl_menu/fox_title.c +++ b/src/overlays/ovl_menu/fox_title.c @@ -490,7 +490,7 @@ s32 Title_GetRankTotalHits(void) { for (j = 0; j < rankingRoute; j++) { hitCount = gSaveFile.save.data.stats[i][j].hitCount; - hitCount |= (gSaveFile.save.data.stats[i][j].unk_C & 1) << 8; + hitCount |= (gSaveFile.save.data.stats[i][j].hitCountOver256 & 1) << 8; gTotalHitsRanking[i] += hitCount; diff --git a/srcjp/audio/audio_tables.c b/srcjp/audio/audio_tables.c new file mode 100644 index 00000000..67aa78c0 --- /dev/null +++ b/srcjp/audio/audio_tables.c @@ -0,0 +1,337 @@ +#include "sys.h" +#include "sf64audio_provisional.h" + +// AudioTable gSampleBankTableInit = { +AudioTable D_800C0760 = { + { 4, 0, 0 }, + { + { 0x000000, 0x0DF120, MEDIUM_CART, CACHEPOLICY_4 }, + { 0x0DF120, 0x0D1D80, MEDIUM_CART, CACHEPOLICY_4 }, + { 0x1B0EA0, 0x48C480, MEDIUM_CART, CACHEPOLICY_4 }, + { 0x63D320, 0x0C3900, MEDIUM_CART, CACHEPOLICY_4 }, + }, +}; + +// AudioTable gSeqTableInit = { +AudioTable D_800C07B0 = { + { SEQ_ID_MAX, 0, 0 }, + { + { 0x00000, 0x3AF0, MEDIUM_CART, CACHEPOLICY_0 }, { 0x03AF0, 0x5990, MEDIUM_CART, CACHEPOLICY_0 }, + { 0x09480, 0x2D80, MEDIUM_CART, CACHEPOLICY_3 }, { 0x0C200, 0x1410, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x0D610, 0x1600, MEDIUM_CART, CACHEPOLICY_3 }, { 0x0EC10, 0xF20, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x0FB30, 0x13A0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x10ED0, 0x1100, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x11FD0, 0x19E0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x139B0, 0x13E0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x14D90, 0x12F0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_SECTOR_Y, 0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x16080, 0xB70, MEDIUM_CART, CACHEPOLICY_3 }, { 0x16BF0, 0x2460, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x19050, 0xD40, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_FORTUNA, 0, MEDIUM_CART, CACHEPOLICY_3 }, + { SEQ_ID_TITANIA, 0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x19D90, 0x7F0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x1A580, 0x1440, MEDIUM_CART, CACHEPOLICY_3 }, { 0x1B9C0, 0x1B20, MEDIUM_CART, CACHEPOLICY_3 }, + { SEQ_ID_BOSS_ME, 0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_BOSS_CO_1, 0, MEDIUM_CART, CACHEPOLICY_3 }, + { SEQ_ID_BOSS_CO_1, 0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_BOSS_ME, 0, MEDIUM_CART, CACHEPOLICY_3 }, + { SEQ_ID_BOSS_ME, 0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x1D4E0, 0x1B30, MEDIUM_CART, CACHEPOLICY_3 }, + { SEQ_ID_BOSS_CO_1, 0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_BOSS_ME, 0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x1F010, 0x10B0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_BOSS_BO, 0, MEDIUM_CART, CACHEPOLICY_3 }, + { SEQ_ID_BOSS_ME, 0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_BOSS_BO, 0, MEDIUM_CART, CACHEPOLICY_3 }, + { SEQ_ID_BOSS_ME, 0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x200C0, 0x1410, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x214D0, 0xF30, MEDIUM_CART, CACHEPOLICY_3 }, { 0x22400, 0x2B30, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x24F30, 0x7F0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x25720, 0x13B0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x26AD0, 0xC70, MEDIUM_CART, CACHEPOLICY_3 }, { 0x27740, 0x180, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x278C0, 0x5C0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_TITLE, 0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x27E80, 0x4E40, MEDIUM_CART, CACHEPOLICY_3 }, { 0x2CCC0, 0x14E0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x2E1A0, 0x400, MEDIUM_CART, CACHEPOLICY_3 }, { 0x2E5A0, 0x800, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x2EDA0, 0x1AB0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x30850, 0x1AA0, MEDIUM_CART, CACHEPOLICY_3 }, + { SEQ_ID_BOSS_ME, 0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x322F0, 0x1370, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x33660, 0xB80, MEDIUM_CART, CACHEPOLICY_3 }, { 0x341E0, 0x5C0, MEDIUM_CART, CACHEPOLICY_3 }, + { SEQ_ID_CO_INTRO, 0, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_CO_INTRO, 0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x347A0, 0x550, MEDIUM_CART, CACHEPOLICY_3 }, { 0x34CF0, 0x360, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x35050, 0x620, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_VS_MENU, 0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x35670, 0xA70, MEDIUM_CART, CACHEPOLICY_3 }, { SEQ_ID_STAR_WOLF, 0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x360E0, 0xAB0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x36B90, 0x13D0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x37F60, 0x250, MEDIUM_CART, CACHEPOLICY_3 }, { 0x381B0, 0x6F0, MEDIUM_CART, CACHEPOLICY_3 }, + { 0x388A0, 0xFB0, MEDIUM_CART, CACHEPOLICY_3 }, { 0x39850, 0x1780, MEDIUM_CART, CACHEPOLICY_3 }, + }, +}; +#define SOUNDFONT_ENTRY(offset, size, medium, cachePolicy, bank1, bank2, numInst, numDrums) \ + { \ + offset, size, medium, cachePolicy, (((bank1) &0xFF) << 8) | ((bank2) &0xFF), \ + (((numInst) &0xFF) << 8) | ((numDrums) &0xFF) \ + } + +AudioTable gSoundFontTableInit = { + { 33, 0, 0 }, + { + SOUNDFONT_ENTRY(0x0, 0x2f00, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_SFX, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x2f00, 0x820, MEDIUM_CART, CACHEPOLICY_1, SAMPLES_MAP, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x3720, 0x6e0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x3e00, 0x15e0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x53e0, 0xc20, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x6000, 0xfe0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x6fe0, 0x1360, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x8340, 0x1120, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x9460, 0xea0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0xa300, 0xce0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0xafe0, 0x1ba0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0xcb80, 0xac0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0xd640, 0xac0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0xe100, 0xee0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0xefe0, 0xc00, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0xfbe0, 0x10a0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x10c80, 0xf80, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x11c00, 0x10c0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x12cc0, 0x1380, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x14040, 0x2b20, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x16b60, 0x9a0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), + SOUNDFONT_ENTRY(0x17500, 0x1220, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 16, 64), + SOUNDFONT_ENTRY(0x18720, 0x180, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 3, 0), + SOUNDFONT_ENTRY(0x188a0, 0x11c0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 16, 64), + SOUNDFONT_ENTRY(0x19a60, 0x940, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), + SOUNDFONT_ENTRY(0x1a3a0, 0x9e0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), + SOUNDFONT_ENTRY(0x1ad80, 0x920, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), + SOUNDFONT_ENTRY(0x1b6a0, 0x9e0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), + SOUNDFONT_ENTRY(0x1c080, 0x9e0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), + SOUNDFONT_ENTRY(0x1ca60, 0xa10, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), + SOUNDFONT_ENTRY(0x1d470, 0x9e0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), + SOUNDFONT_ENTRY(0x1de50, 0xa00, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), + SOUNDFONT_ENTRY(0x1e850, 0x8d0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64), + } +}; + +#define AS_BYTES(x) (((x) >> 8) & 0xFF), ((x) &0xFF) + +u8 gSeqFontTableInit[288] = { + AS_BYTES(132), + AS_BYTES(134), + AS_BYTES(155), + AS_BYTES(157), + AS_BYTES(159), + AS_BYTES(161), + AS_BYTES(163), + AS_BYTES(165), + AS_BYTES(167), + AS_BYTES(169), + AS_BYTES(171), + AS_BYTES(173), + AS_BYTES(175), + AS_BYTES(177), + AS_BYTES(179), + AS_BYTES(181), + AS_BYTES(183), + AS_BYTES(185), + AS_BYTES(187), + AS_BYTES(189), + AS_BYTES(191), + AS_BYTES(193), + AS_BYTES(195), + AS_BYTES(197), + AS_BYTES(199), + AS_BYTES(201), + AS_BYTES(203), + AS_BYTES(205), + AS_BYTES(207), + AS_BYTES(209), + AS_BYTES(211), + AS_BYTES(213), + AS_BYTES(215), + AS_BYTES(217), + AS_BYTES(219), + AS_BYTES(221), + AS_BYTES(223), + AS_BYTES(225), + AS_BYTES(227), + AS_BYTES(229), + AS_BYTES(231), + AS_BYTES(233), + AS_BYTES(235), + AS_BYTES(237), + AS_BYTES(239), + AS_BYTES(241), + AS_BYTES(243), + AS_BYTES(245), + AS_BYTES(247), + AS_BYTES(249), + AS_BYTES(251), + AS_BYTES(253), + AS_BYTES(255), + 1, + 1, + 1, + 3, + 1, + 5, + 1, + 7, + 1, + 9, + 1, + 11, + 1, + 13, + 1, + 15, + 1, + 17, + 1, + 19, + 1, + 21, + 1, + 23, + 1, + 25, + 1, + 0, + 20, + 20, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 1, + 2, + 1, + 24, + 1, + 29, + 1, + 25, + 1, + 26, + 1, + 28, + 1, + 25, + 1, + 25, + 1, + 29, + 1, + 24, + 1, + 29, + 1, + 28, + 1, + 25, + 1, + 30, + 1, + 24, + 1, + 25, + 1, + 28, + 1, + 28, + 1, + 31, + 1, + 31, + 1, + 28, + 1, + 28, + 1, + 31, + 1, + 31, + 1, + 31, + 1, + 28, + 1, + 31, + 1, + 31, + 1, + 31, + 1, + 31, + 1, + 31, + 1, + 31, + 1, + 32, + 1, + 21, + 1, + 21, + 1, + 22, + 1, + 21, + 1, + 21, + 1, + 21, + 1, + 21, + 1, + 21, + 1, + 23, + 1, + 25, + 1, + 21, + 1, + 21, + 1, + 29, + 1, + 25, + 1, + 31, + 1, + 21, + 1, + 21, + 1, + 21, + 1, + 21, + 1, + 21, + 1, + 21, + 1, + 21, + 1, + 21, + 1, + 21, + 1, + 27, + 1, + 25, + 1, + 21, + 1, + 25, + 1, + 25, + 1, + 25, + 1, + 21, + 1, + 31, + 0, + 0, + 0, + 0, + 0, +}; diff --git a/tools/Torch b/tools/Torch index 6a40a943..abb74ef9 160000 --- a/tools/Torch +++ b/tools/Torch @@ -1 +1 @@ -Subproject commit 6a40a9435f4db5c5a77c91979841b6e4c6e6065a +Subproject commit abb74ef940afe35ddf7bea5ea2e03c45484a95a3 diff --git a/yamls/eu/rev0/main.yaml b/yamls/eu/rev0/main.yaml index a43b6511..e6bb69b9 100644 --- a/yamls/eu/rev0/main.yaml +++ b/yamls/eu/rev0/main.yaml @@ -228,7 +228,7 @@ - [0xCB690, data, engine/fox_tank] - [0xCB6F0, data, engine/fox_demo] - [0xCB9B0, data, engine/fox_display] - - [0xCBB40, .data, engine/fox_load] + - [0xCBB40, data, engine/fox_load] - [0xCD860, data, engine/fox_edata] - [0xD1360, data, engine/fox_edisplay] - [0xD1790, data, engine/fox_enmy] diff --git a/yamls/jp/rev0/header.yaml b/yamls/jp/rev0/header.yaml index aaa7d62b..bf5bdcdf 100644 --- a/yamls/jp/rev0/header.yaml +++ b/yamls/jp/rev0/header.yaml @@ -17,6 +17,7 @@ options: - linker_scripts/jp/rev0/symbol_addrs.txt - linker_scripts/jp/rev0/symbol_addrs_fix.txt - linker_scripts/jp/rev0/symbol_addrs_assets.txt + - linker_scripts/jp/rev0/symbol_addrs_overlays.txt asm_path: asm/jp/rev0 src_path: srcjp diff --git a/yamls/jp/rev0/main.yaml b/yamls/jp/rev0/main.yaml index fcda490c..36c42805 100644 --- a/yamls/jp/rev0/main.yaml +++ b/yamls/jp/rev0/main.yaml @@ -154,7 +154,7 @@ # DATA - Microcode - [0xC1030, data, aspmain] - - [0xC1360, data, audio/audio_tables] + - [0xC1360, .data, audio/audio_tables] - [0xC1B20, data, f3dex] # DATA - Nintendo Libraries diff --git a/yamls/jp/rev0/overlays.yaml b/yamls/jp/rev0/overlays.yaml index 925cc2db..51c2d023 100644 --- a/yamls/jp/rev0/overlays.yaml +++ b/yamls/jp/rev0/overlays.yaml @@ -1,4 +1,4 @@ - - name: ovl_i1 + - name: ovl_i1 # size = 0x141A0 exclusive_ram_id: overlay type: code dir: overlays/ovl_i1 @@ -25,7 +25,7 @@ - { type: bss, vram: 0x80192950, name: fox_co } - { type: bss, vram: 0x80192A70, name: fox_ve1 } - - name: ovl_i2 + - name: ovl_i2 # size = 0xE800 exclusive_ram_id: overlay type: code dir: overlays/ovl_i2 @@ -36,8 +36,8 @@ symbol_name_format: i2_$VRAM subsegments: - [0xDBD820, c, fox_i2] - - [0xDBD830, c, fox_me] - - [0xDC52D0, c, fox_sx] + - [0xDBD830, c, fox_me] # size = 0x7AA0 + - [0xDC52D0, c, fox_sx] # size = 0x6400 - [0xDCB6D0, data, fox_i2] - [0xDCB6E0, data, fox_me] - [0xDCB8F0, data, fox_sx] @@ -46,7 +46,7 @@ - { type: bss, vram: 0x8018CFA0, name: fox_i2 } - { type: bss, vram: 0x8018CFB0, name: fox_sx } - - name: ovl_i3 + - name: ovl_i3 # size = 0x3AD50 exclusive_ram_id: overlay type: code dir: overlays/ovl_i3 @@ -77,7 +77,7 @@ - { type: bss, vram: 0x801B9A70, name: fox_aq } - - name: ovl_i4 + - name: ovl_i4 # size = 0x18B00 exclusive_ram_id: overlay type: code dir: overlays/ovl_i4 @@ -87,11 +87,11 @@ bss_size: 0x1B0 symbol_name_format: i4_$VRAM subsegments: - - [0xE06D70, c, fox_i4] - - [0xE06E40, c, fox_fo] - - [0xE0B580, c, fox_bo] - - [0xE11FD0, c, fox_ka] - - [0xE18DD0, c, fox_sz] + - [0xE06D70, c, fox_i4] # size = 0xD0 + - [0xE06E40, c, fox_fo] # size = 0x4740 + - [0xE0B580, c, fox_bo] # size = 0x6A50 + - [0xE11FD0, c, fox_ka] # size = 0x6E00 + - [0xE18DD0, c, fox_sz] # size = 0x54D0 - [0xE1E2A0, data, fox_i4] - [0xE1E2B0, data, fox_fo] - [0xE1E350, data, fox_bo] diff --git a/yamls/us/rev1/overlays.yaml b/yamls/us/rev1/overlays.yaml index 4347396d..5c5db9df 100644 --- a/yamls/us/rev1/overlays.yaml +++ b/yamls/us/rev1/overlays.yaml @@ -1,4 +1,4 @@ - - name: ovl_i1 + - name: ovl_i1 # size = 0x141A0 exclusive_ram_id: overlay type: code dir: overlays/ovl_i1 @@ -25,7 +25,7 @@ - { type: .bss, vram: 0x8019B6D0, name: fox_co } - { type: .bss, vram: 0x8019B7F0, name: fox_ve1 } - - name: ovl_i2 + - name: ovl_i2 # size = 0xE850 exclusive_ram_id: overlay type: code dir: overlays/ovl_i2 @@ -36,8 +36,8 @@ symbol_name_format: i2_$VRAM subsegments: - [0xE08400, c, fox_i2] - - [0xE08410, c, fox_me] - - [0xE0FF10, c, fox_sx] + - [0xE08410, c, fox_me] # size = 0x7B00 + - [0xE0FF10, c, fox_sx] # size = 0x63F0 - [0xE16300, .data, fox_i2] - [0xE16310, .data, fox_me] - [0xE16520, .data, fox_sx] @@ -46,7 +46,7 @@ - { type: .bss, vram: 0x80195D70, name: fox_i2 } - { type: .bss, vram: 0x80195D80, name: fox_sx } - - name: ovl_i3 + - name: ovl_i3 # size = 0x3AD20 exclusive_ram_id: overlay type: code dir: overlays/ovl_i3 @@ -76,7 +76,7 @@ - { type: .bss, vram: 0x801C2740, name: fox_so } - { type: .bss, vram: 0x801C27C0, name: fox_aq } - - name: ovl_i4 + - name: ovl_i4 # size = 0x18EA0 exclusive_ram_id: overlay type: code dir: overlays/ovl_i4 @@ -86,11 +86,11 @@ bss_size: 0x1B0 symbol_name_format: i4_$VRAM subsegments: - - [0xE51970, c, fox_i4] - - [0xE51A40, c, fox_fo] - - [0xE561B0, c, fox_bo] - - [0xE5CC30, c, fox_ka] - - [0xE63D50, c, fox_sz] + - [0xE51970, c, fox_i4] # size = 0xD0 + - [0xE51A40, c, fox_fo] # size = 0x4770 + - [0xE561B0, c, fox_bo] # size = 0x6A80 + - [0xE5CC30, c, fox_ka] # size = 0x7120 + - [0xE63D50, c, fox_sz] # size = 0x54D0 - [0xE69220, .data, fox_i4] - [0xE69230, .data, fox_fo] - [0xE692D0, .data, fox_bo]