diff --git a/bin/segment2.c b/bin/segment2.c index 93f5425b..e2baae9c 100644 --- a/bin/segment2.c +++ b/bin/segment2.c @@ -48,9 +48,7 @@ ALIGNED8 static const Texture texture_hud_char_H[] = "__OTR__textures/segment2/s ALIGNED8 static const Texture texture_hud_char_I[] = "__OTR__textures/segment2/segment2.02400"; -#if defined(VERSION_JP) || defined(VERSION_SH) ALIGNED8 static const Texture texture_hud_char_J[] = "__OTR__textures/segment2/segment2.02600"; -#endif ALIGNED8 static const Texture texture_hud_char_K[] = "__OTR__textures/segment2/segment2.02800"; @@ -64,9 +62,7 @@ ALIGNED8 static const Texture texture_hud_char_O[] = "__OTR__textures/segment2/s ALIGNED8 static const Texture texture_hud_char_P[] = "__OTR__textures/segment2/segment2.03200"; -#if defined(VERSION_JP) || defined(VERSION_SH) ALIGNED8 static const Texture texture_hud_char_Q[] = "__OTR__textures/segment2/segment2.03400"; -#endif ALIGNED8 static const Texture texture_hud_char_R[] = "__OTR__textures/segment2/segment2.03600"; @@ -76,21 +72,15 @@ ALIGNED8 static const Texture texture_hud_char_T[] = "__OTR__textures/segment2/s ALIGNED8 static const Texture texture_hud_char_U[] = "__OTR__textures/segment2/segment2.03C00"; -#if defined(VERSION_JP) || defined(VERSION_EU) || defined(VERSION_SH) ALIGNED8 static const Texture texture_hud_char_V[] = "__OTR__textures/segment2/segment2.03E00"; -#endif ALIGNED8 static const Texture texture_hud_char_W[] = "__OTR__textures/segment2/segment2.04000"; -#if defined(VERSION_JP) || defined(VERSION_SH) ALIGNED8 static const Texture texture_hud_char_X[] = "__OTR__textures/segment2/segment2.04200"; -#endif ALIGNED8 static const Texture texture_hud_char_Y[] = "__OTR__textures/segment2/segment2.04400"; -#if defined(VERSION_JP) || defined(VERSION_EU) || defined(VERSION_SH) ALIGNED8 static const Texture texture_hud_char_Z[] = "__OTR__textures/segment2/segment2.04600"; -#endif ALIGNED8 static const Texture texture_hud_char_apostrophe[] = "__OTR__textures/segment2/segment2.04800"; @@ -100,17 +90,15 @@ ALIGNED8 static const Texture texture_hud_char_double_quote[] = "__OTR__textures ALIGNED8 static const Texture texture_hud_char_umlaut[] = "__OTR__textures/segment2/segment2.umlaut"// EU ยจ; #endif -#if defined(VERSION_JP) || defined(VERSION_SH) -ALIGNED8 static const Texture texture_hud_char_exclamation[] = "__OTR__textures/segment2/segment2.04C00"// JP !; +ALIGNED8 static const Texture texture_hud_char_exclamation[] = "__OTR__textures/segment2/segment2.04C00"; -ALIGNED8 static const Texture texture_hud_char_double_exclamation[] = "__OTR__textures/segment2/segment2.04E00"// JP !!; +ALIGNED8 static const Texture texture_hud_char_double_exclamation[] = "__OTR__textures/segment2/segment2.04E00"; -ALIGNED8 static const Texture texture_hud_char_question[] = "__OTR__textures/segment2/segment2.05000"// JP ?; +ALIGNED8 static const Texture texture_hud_char_question[] = "__OTR__textures/segment2/segment2.05000"; -ALIGNED8 static const Texture texture_hud_char_ampersand[] = "__OTR__textures/segment2/segment2.05200"// JP &; +ALIGNED8 static const Texture texture_hud_char_ampersand[] = "__OTR__textures/segment2/segment2.05200"; -ALIGNED8 static const Texture texture_hud_char_percent[] = "__OTR__textures/segment2/segment2.05400"// JP %; -#endif +ALIGNED8 static const Texture texture_hud_char_percent[] = "__OTR__textures/segment2/segment2.05400"; ALIGNED8 static const Texture texture_hud_char_multiply[] = "__OTR__textures/segment2/segment2.05600"; @@ -120,13 +108,9 @@ ALIGNED8 static const Texture texture_hud_char_mario_head[] = "__OTR__textures/s ALIGNED8 static const Texture texture_hud_char_star[] = "__OTR__textures/segment2/segment2.05C00"; -#if defined(VERSION_JP) || defined(VERSION_SH) ALIGNED8 static const Texture texture_hud_char_decimal_point[] = "__OTR__textures/segment2/segment2.05E00"; -#endif -#if defined(VERSION_JP) || defined(VERSION_SH) ALIGNED8 static const Texture texture_hud_char_beta_key[] = "__OTR__textures/segment2/segment2.06000"; -#endif ALIGNED8 static const Texture texture_credits_char_3[] = "__OTR__textures/segment2/segment2.06200"; @@ -189,7 +173,6 @@ ALIGNED8 static const Texture texture_credits_char_Z[] = "__OTR__textures/segmen ALIGNED8 static const Texture texture_credits_char_period[] = "__OTR__textures/segment2/segment2.07080"; // JP Small Font -#if defined(VERSION_JP) || defined(VERSION_SH) ALIGNED8 static const Texture texture_font_char_jp_0[] = "__OTR__textures/segment2/segment2.07100"; ALIGNED8 static const Texture texture_font_char_jp_1[] = "__OTR__textures/segment2/segment2.07110"; @@ -521,7 +504,7 @@ ALIGNED8 static const Texture texture_font_char_jp_wave_dash[] = "__OTR__texture ALIGNED8 static const Texture texture_font_char_jp_ellipsis[] = "__OTR__textures/segment2/segment2.07B40"; // EU Small Font -#elif defined(VERSION_EU) +#if defined(VERSION_EU) ALIGNED8 static const Texture texture_font_char_eu_0[] = "__OTR__textures/segment2/font_graphics.05F00"; @@ -724,7 +707,8 @@ ALIGNED8 static const Texture texture_font_char_eu_Cedilla[] = "__OTR__textures/ ALIGNED8 static const Texture texture_font_char_eu_eszeet[] = "__OTR__textures/segment2/font_graphics.06530"; // US Small Font -#else +#endif + ALIGNED8 static const Texture texture_font_char_us_0[] = "__OTR__textures/segment2/font_graphics.05900"; ALIGNED8 static const Texture texture_font_char_us_1[] = "__OTR__textures/segment2/font_graphics.05940"; @@ -908,7 +892,6 @@ ALIGNED8 static const Texture texture_font_char_us_button_C_down[] = "__OTR__tex ALIGNED8 static const Texture texture_font_char_us_button_C_left[] = "__OTR__textures/segment2/font_graphics.06F80"; ALIGNED8 static const Texture texture_font_char_us_button_C_right[] = "__OTR__textures/segment2/font_graphics.06FC0"; -#endif ALIGNED8 static const Texture texture_hud_char_camera[] = "__OTR__textures/segment2/segment2.07B50"; @@ -938,22 +921,6 @@ const Texture *const main_hud_lut[] = { 0x0, 0x0, texture_hud_char_multiply, texture_hud_char_coin, texture_hud_char_mario_head, texture_hud_char_star, 0x0, 0x0, texture_hud_char_apostrophe, texture_hud_char_double_quote, texture_hud_char_umlaut, -#elif defined(VERSION_US) - texture_hud_char_0, texture_hud_char_1, texture_hud_char_2, texture_hud_char_3, - texture_hud_char_4, texture_hud_char_5, texture_hud_char_6, texture_hud_char_7, - texture_hud_char_8, texture_hud_char_9, texture_hud_char_A, texture_hud_char_B, - texture_hud_char_C, texture_hud_char_D, texture_hud_char_E, texture_hud_char_F, - texture_hud_char_G, texture_hud_char_H, texture_hud_char_I, 0x0, - texture_hud_char_K, texture_hud_char_L, texture_hud_char_M, texture_hud_char_N, - texture_hud_char_O, texture_hud_char_P, 0x0, texture_hud_char_R, - texture_hud_char_S, texture_hud_char_T, texture_hud_char_U, 0x0, - texture_hud_char_W, 0x0, texture_hud_char_Y, 0x0, - 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, texture_hud_char_multiply, texture_hud_char_coin, - texture_hud_char_mario_head, texture_hud_char_star, 0x0, 0x0, - texture_hud_char_apostrophe, texture_hud_char_double_quote, #else texture_hud_char_0, texture_hud_char_1, texture_hud_char_2, texture_hud_char_3, texture_hud_char_4, texture_hud_char_5, texture_hud_char_6, texture_hud_char_7, diff --git a/include/sm64.h b/include/sm64.h index da808907..8e030a61 100644 --- a/include/sm64.h +++ b/include/sm64.h @@ -17,6 +17,10 @@ #include #include #include +#include "port/Engine.h" + +#define GAME_VERSION GameEngine_GetGameVersion() +#define ROM_JP (GAME_VERSION == 0xE3DAA4E) #ifdef _WIN32 #define bzero(b,len) (memset((b), '\0', (len)), (void) 0) diff --git a/libultraship b/libultraship index 69b7b616..8ba2cddd 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit 69b7b61602b149112c2c398b2382c073a7aa72dd +Subproject commit 8ba2cdddb24caef270e95d53363ac843513961d7 diff --git a/src/audio/data.h b/src/audio/data.h index a704c0c2..3364f27c 100644 --- a/src/audio/data.h +++ b/src/audio/data.h @@ -139,9 +139,9 @@ extern OSMesgQueue *D_SH_80350FA8; #define AUDIO_HEAP_SIZE 0x2c500 #define AUDIO_INIT_POOL_SIZE 0x2c00 #else -#define UNUSED_COUNT_80333EE8 16 -#define AUDIO_HEAP_SIZE 0x31150 -#define AUDIO_INIT_POOL_SIZE 0x2500 +#define UNUSED_COUNT_80333EE8 24 +#define AUDIO_HEAP_SIZE 0x41150 +#define AUDIO_INIT_POOL_SIZE 0x3500 #endif #ifdef VERSION_SH diff --git a/src/game/behaviors/camera_lakitu.inc.c b/src/game/behaviors/camera_lakitu.inc.c index 61925755..a1a3ca02 100644 --- a/src/game/behaviors/camera_lakitu.inc.c +++ b/src/game/behaviors/camera_lakitu.inc.c @@ -96,12 +96,10 @@ static void camera_lakitu_intro_act_show_dialog(void) { approach_f32_ptr(&o->oCameraLakituCircleRadius, 200.0f, 50.0f); if (o->oDistanceToMario < 1000.0f) { -#ifndef VERSION_JP - if (!o->oCameraLakituUnk104) { + if (!ROM_JP && !o->oCameraLakituUnk104) { play_music(SEQ_PLAYER_LEVEL, SEQUENCE_ARGS(15, SEQ_EVENT_CUTSCENE_LAKITU), 0); o->oCameraLakituUnk104 = TRUE; } -#endif // Once within 1000 units, slow down approach_f32_ptr(&o->oCameraLakituSpeed, 20.0f, 1.0f); if (o->oDistanceToMario < 500.0f diff --git a/src/game/behaviors/red_coin.inc.c b/src/game/behaviors/red_coin.inc.c index 6c4ef8ef..24b383dc 100644 --- a/src/game/behaviors/red_coin.inc.c +++ b/src/game/behaviors/red_coin.inc.c @@ -56,21 +56,20 @@ void bhv_red_coin_loop(void) { // ...increment the star's counter. o->parentObj->oHiddenStarTriggerCounter++; - // For JP version, play an identical sound for all coins. -#ifdef VERSION_JP - create_sound_spawner(SOUND_GENERAL_RED_COIN); -#endif // Spawn the orange number counter, as long as it isn't the last coin. if (o->parentObj->oHiddenStarTriggerCounter != 8) { spawn_orange_number(o->parentObj->oHiddenStarTriggerCounter, 0, 0, 0); } - // On all versions but the JP version, each coin collected plays a higher noise. -#ifndef VERSION_JP - play_sound(SOUND_MENU_COLLECT_RED_COIN + if(ROM_JP){ + // For JP version, play an identical sound for all coins. + create_sound_spawner(SOUND_GENERAL_RED_COIN); + } else { + // On all versions but the JP version, each coin collected plays a higher noise. + play_sound(SOUND_MENU_COLLECT_RED_COIN + (((u8) o->parentObj->oHiddenStarTriggerCounter - 1) << 16), gGlobalSoundSource); -#endif + } } coin_collected(); diff --git a/src/game/behaviors/water_ring.inc.c b/src/game/behaviors/water_ring.inc.c index 22dcce74..b1f8f1bd 100644 --- a/src/game/behaviors/water_ring.inc.c +++ b/src/game/behaviors/water_ring.inc.c @@ -60,13 +60,7 @@ void water_ring_check_collection(f32 avgScale, struct Object *ringManager) { ringSpawner->oWaterRingSpawnerRingsCollected++; if (ringSpawner->oWaterRingSpawnerRingsCollected < 6) { spawn_orange_number(ringSpawner->oWaterRingSpawnerRingsCollected, 0, -40, 0); -#ifdef VERSION_JP - play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource); -#else - play_sound(SOUND_MENU_COLLECT_SECRET - + (((u8) ringSpawner->oWaterRingSpawnerRingsCollected - 1) << 16), - gGlobalSoundSource); -#endif + play_sound(ROM_JP ? SOUND_MENU_STAR_SOUND : SOUND_MENU_COLLECT_SECRET + (((u8) ringSpawner->oWaterRingSpawnerRingsCollected - 1) << 16), gGlobalSoundSource); } ringManager->oWaterRingMgrLastRingCollected = o->oWaterRingIndex; } else { diff --git a/src/game/camera.c b/src/game/camera.c index 1d3b194e..79d7c7de 100644 --- a/src/game/camera.c +++ b/src/game/camera.c @@ -4941,9 +4941,8 @@ s32 radial_camera_input(struct Camera *c, UNUSED f32 unused) { if (gPlayer1Controller->buttonPressed & D_CBUTTONS) { if (gCameraMovementFlags & CAM_MOVE_ZOOMED_OUT) { gCameraMovementFlags |= CAM_MOVE_ALREADY_ZOOMED_OUT; -#ifndef VERSION_JP + if(ROM_JP) return; play_camera_buzz_if_cdown(); -#endif } else { gCameraMovementFlags |= CAM_MOVE_ZOOMED_OUT; play_sound_cbutton_down(); @@ -4995,9 +4994,8 @@ void handle_c_button_movement(struct Camera *c) { if (gCameraMovementFlags & CAM_MOVE_ZOOMED_OUT) { gCameraMovementFlags |= CAM_MOVE_ALREADY_ZOOMED_OUT; sZoomAmount = gCameraZoomDist + 400.f; -#ifndef VERSION_JP + if(ROM_JP) return; play_camera_buzz_if_cdown(); -#endif } else { gCameraMovementFlags |= CAM_MOVE_ZOOMED_OUT; sZoomAmount = gCameraZoomDist + 400.f; @@ -9515,11 +9513,11 @@ BAD_RETURN(s32) peach_letter_text(UNUSED struct Camera *c) { create_dialog_box(DIALOG_020); } -#ifndef VERSION_JP BAD_RETURN(s32) play_sound_peach_reading_letter(UNUSED struct Camera *c) { - play_sound(SOUND_PEACH_DEAR_MARIO, gGlobalSoundSource); + if(!ROM_JP){ + play_sound(SOUND_PEACH_DEAR_MARIO, gGlobalSoundSource); + } } -#endif /** * Move the camera from peach reading the letter all the way to Mario's warp pipe. Follow the @@ -9585,11 +9583,10 @@ BAD_RETURN(s32) intro_pipe_exit_text(UNUSED struct Camera *c) { create_dialog_box(DIALOG_033); } -#ifndef VERSION_JP BAD_RETURN(s32) play_sound_intro_turn_on_hud(UNUSED struct Camera *c) { + if(ROM_JP) return; play_sound_rbutton_changed(); } -#endif /** * Fly to the pipe. Near the end, the camera jumps to Lakitu's position and the hud turns on. @@ -9654,9 +9651,10 @@ BAD_RETURN(s32) cutscene_intro_peach_letter(struct Camera *c) { #endif cutscene_event(cutscene_intro_peach_start_to_pipe_spline, c, 0, 0); cutscene_event(peach_letter_text, c, 65, 65); -#ifndef VERSION_JP - cutscene_event(play_sound_peach_reading_letter, c, 83, 83); -#endif + + if(!ROM_JP){ + cutscene_event(play_sound_peach_reading_letter, c, 83, 83); + } if ((gCutsceneTimer > 120) && (get_dialog_id() == DIALOG_NONE)) { // Start the next scene diff --git a/src/game/interaction.c b/src/game/interaction.c index dda1e906..776e0377 100644 --- a/src/game/interaction.c +++ b/src/game/interaction.c @@ -1345,9 +1345,9 @@ u32 interact_hit_from_below(struct MarioState *m, UNUSED u32 interactType, struc if (o->oInteractionSubtype & INT_SUBTYPE_TWIRL_BOUNCE) { bounce_off_object(m, o, 80.0f); reset_mario_pitch(m); -#ifndef VERSION_JP - play_sound(SOUND_MARIO_TWIRL_BOUNCE, m->marioObj->header.gfx.cameraToObject); -#endif + if(!ROM_JP){ + play_sound(SOUND_MARIO_TWIRL_BOUNCE, m->marioObj->header.gfx.cameraToObject); + } return drop_and_set_mario_action(m, ACT_TWIRLING, 0); } else { bounce_off_object(m, o, 30.0f); @@ -1383,9 +1383,9 @@ u32 interact_bounce_top(struct MarioState *m, UNUSED u32 interactType, struct Ob if (o->oInteractionSubtype & INT_SUBTYPE_TWIRL_BOUNCE) { bounce_off_object(m, o, 80.0f); reset_mario_pitch(m); -#ifndef VERSION_JP - play_sound(SOUND_MARIO_TWIRL_BOUNCE, m->marioObj->header.gfx.cameraToObject); -#endif + if(!ROM_JP){ + play_sound(SOUND_MARIO_TWIRL_BOUNCE, m->marioObj->header.gfx.cameraToObject); + } return drop_and_set_mario_action(m, ACT_TWIRLING, 0); } else { bounce_off_object(m, o, 30.0f); diff --git a/src/game/level_update.c b/src/game/level_update.c index 1268ec9d..034a3131 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -455,13 +455,11 @@ void init_mario_after_warp(void) { play_sound(SOUND_MENU_MARIO_CASTLE_WARP, gGlobalSoundSource); } -#ifndef VERSION_JP - if (sWarpDest.levelNum == LEVEL_CASTLE_GROUNDS && sWarpDest.areaIdx == 1 + if (!ROM_JP && sWarpDest.levelNum == LEVEL_CASTLE_GROUNDS && sWarpDest.areaIdx == 1 && (sWarpDest.nodeId == 7 || sWarpDest.nodeId == 10 || sWarpDest.nodeId == 20 || sWarpDest.nodeId == 30)) { play_sound(SOUND_MENU_MARIO_CASTLE_WARP, gGlobalSoundSource); } -#endif } } @@ -761,9 +759,9 @@ s16 level_trigger_warp(struct MarioState *m, s32 warpOp) { sDelayedWarpTimer = 30; sSourceWarpNodeId = WARP_NODE_F2; play_transition(WARP_TRANSITION_FADE_INTO_COLOR, 0x1E, 0xFF, 0xFF, 0xFF); -#ifndef VERSION_JP - play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource); -#endif + if(!ROM_JP){ + play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource); + } break; case WARP_OP_UNKNOWN_02: // bbh enter diff --git a/src/game/mario.c b/src/game/mario.c index e5c3c8de..7334741e 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -248,17 +248,13 @@ void play_sound_if_no_flag(struct MarioState *m, u32 soundBits, u32 flags) { */ void play_mario_jump_sound(struct MarioState *m) { if (!(m->flags & MARIO_MARIO_SOUND_PLAYED)) { -#ifndef VERSION_JP - if (m->action == ACT_TRIPLE_JUMP) { + if (!ROM_JP && m->action == ACT_TRIPLE_JUMP) { play_sound(SOUND_MARIO_YAHOO_WAHA_YIPPEE + ((gAudioRandom % 5) << 16), m->marioObj->header.gfx.cameraToObject); } else { -#endif play_sound(SOUND_MARIO_YAH_WAH_HOO + ((gAudioRandom % 3) << 16), m->marioObj->header.gfx.cameraToObject); -#ifndef VERSION_JP } -#endif m->flags |= MARIO_MARIO_SOUND_PLAYED; } } @@ -1756,16 +1752,16 @@ s32 execute_mario_action(UNUSED struct Object *o) { // non-Japanese releases. if (gMarioState->floor->type == SURFACE_HORIZONTAL_WIND) { spawn_wind_particles(0, (gMarioState->floor->force << 8)); -#ifndef VERSION_JP - play_sound(SOUND_ENV_WIND2, gMarioState->marioObj->header.gfx.cameraToObject); -#endif + if(!ROM_JP){ + play_sound(SOUND_ENV_WIND2, gMarioState->marioObj->header.gfx.cameraToObject); + } } if (gMarioState->floor->type == SURFACE_VERTICAL_WIND) { spawn_wind_particles(1, 0); -#ifndef VERSION_JP - play_sound(SOUND_ENV_WIND2, gMarioState->marioObj->header.gfx.cameraToObject); -#endif + if(!ROM_JP){ + play_sound(SOUND_ENV_WIND2, gMarioState->marioObj->header.gfx.cameraToObject); + } } play_infinite_stairs_music(); diff --git a/src/game/mario_actions_airborne.c b/src/game/mario_actions_airborne.c index c5c5b648..e404977a 100644 --- a/src/game/mario_actions_airborne.c +++ b/src/game/mario_actions_airborne.c @@ -32,7 +32,6 @@ void play_far_fall_sound(struct MarioState *m) { } } -#ifndef VERSION_JP void play_knockback_sound(struct MarioState *m) { if (m->actionArg == 0 && (m->forwardVel <= -28.0f || m->forwardVel >= 28.0f)) { play_sound_if_no_flag(m, SOUND_MARIO_DOH, MARIO_MARIO_SOUND_PLAYED); @@ -40,7 +39,6 @@ void play_knockback_sound(struct MarioState *m) { play_sound_if_no_flag(m, SOUND_MARIO_UH, MARIO_MARIO_SOUND_PLAYED); } } -#endif s32 lava_boost_on_wall(struct MarioState *m) { m->faceAngle[1] = atan2s(m->wall->normal.z, m->wall->normal.x); @@ -130,11 +128,7 @@ s32 should_get_stuck_in_ground(struct MarioState *m) { s32 check_fall_damage_or_get_stuck(struct MarioState *m, u32 hardFallAction) { if (should_get_stuck_in_ground(m)) { -#ifdef VERSION_JP - play_sound(SOUND_MARIO_OOOF, m->marioObj->header.gfx.cameraToObject); -#else - play_sound(SOUND_MARIO_OOOF2, m->marioObj->header.gfx.cameraToObject); -#endif + play_sound(ROM_JP ? SOUND_MARIO_OOOF : SOUND_MARIO_OOOF2, m->marioObj->header.gfx.cameraToObject); m->particleFlags |= PARTICLE_MIST_CIRCLE; drop_and_set_mario_action(m, ACT_FEET_STUCK_IN_GROUND, 0); #if ENABLE_RUMBLE @@ -174,9 +168,9 @@ s32 check_horizontal_wind(struct MarioState *m) { m->slideYaw = atan2s(m->slideVelZ, m->slideVelX); m->forwardVel = speed * coss(m->faceAngle[1] - m->slideYaw); -#ifdef VERSION_JP - play_sound(SOUND_ENV_WIND2, m->marioObj->header.gfx.cameraToObject); -#endif + if(ROM_JP){ + play_sound(SOUND_ENV_WIND2, m->marioObj->header.gfx.cameraToObject); + } return TRUE; } @@ -490,11 +484,7 @@ s32 act_triple_jump(struct MarioState *m) { return set_mario_action(m, ACT_GROUND_POUND, 0); } -#ifndef VERSION_JP - play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, 0); -#else - play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, SOUND_MARIO_YAHOO); -#endif + play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, ROM_JP ? SOUND_MARIO_YAHOO : 0); common_air_action_step(m, ACT_TRIPLE_JUMP_LAND, MARIO_ANIM_TRIPLE_JUMP, 0); #if ENABLE_RUMBLE @@ -756,11 +746,7 @@ s32 act_dive(struct MarioState *m) { #if ENABLE_RUMBLE queue_rumble_data(5, 80); #endif -#ifdef VERSION_JP - play_sound(SOUND_MARIO_OOOF, m->marioObj->header.gfx.cameraToObject); -#else - play_sound(SOUND_MARIO_OOOF2, m->marioObj->header.gfx.cameraToObject); -#endif + play_sound(ROM_JP ? SOUND_MARIO_OOOF : SOUND_MARIO_OOOF2, m->marioObj->header.gfx.cameraToObject); m->particleFlags |= PARTICLE_MIST_CIRCLE; drop_and_set_mario_action(m, ACT_HEAD_STUCK_IN_GROUND, 0); } else if (!check_fall_damage(m, ACT_HARD_FORWARD_GROUND_KB)) { @@ -954,11 +940,7 @@ s32 act_ground_pound(struct MarioState *m) { #if ENABLE_RUMBLE queue_rumble_data(5, 80); #endif -#ifdef VERSION_JP - play_sound(SOUND_MARIO_OOOF, m->marioObj->header.gfx.cameraToObject); -#else - play_sound(SOUND_MARIO_OOOF2, m->marioObj->header.gfx.cameraToObject); -#endif + play_sound(ROM_JP ? SOUND_MARIO_OOOF : SOUND_MARIO_OOOF2, m->marioObj->header.gfx.cameraToObject); m->particleFlags |= PARTICLE_MIST_CIRCLE; set_mario_action(m, ACT_BUTT_STUCK_IN_GROUND, 0); } else { @@ -1158,11 +1140,11 @@ s32 act_backward_air_kb(struct MarioState *m) { return TRUE; } -#ifndef VERSION_JP - play_knockback_sound(m); -#else - play_sound_if_no_flag(m, SOUND_MARIO_UH, MARIO_MARIO_SOUND_PLAYED); -#endif + if(!ROM_JP){ + play_knockback_sound(m); + } else { + play_sound_if_no_flag(m, SOUND_MARIO_UH, MARIO_MARIO_SOUND_PLAYED); + } common_air_knockback_step(m, ACT_BACKWARD_GROUND_KB, ACT_HARD_BACKWARD_GROUND_KB, 0x0002, -16.0f); return FALSE; } @@ -1172,32 +1154,32 @@ s32 act_forward_air_kb(struct MarioState *m) { return TRUE; } -#ifndef VERSION_JP - play_knockback_sound(m); -#else - play_sound_if_no_flag(m, SOUND_MARIO_UH, MARIO_MARIO_SOUND_PLAYED); -#endif + if(!ROM_JP){ + play_knockback_sound(m); + } else { + play_sound_if_no_flag(m, SOUND_MARIO_UH, MARIO_MARIO_SOUND_PLAYED); + } common_air_knockback_step(m, ACT_FORWARD_GROUND_KB, ACT_HARD_FORWARD_GROUND_KB, 0x002D, 16.0f); return FALSE; } s32 act_hard_backward_air_kb(struct MarioState *m) { -#ifndef VERSION_JP - play_knockback_sound(m); -#else - play_sound_if_no_flag(m, SOUND_MARIO_UH, MARIO_MARIO_SOUND_PLAYED); -#endif + if(!ROM_JP){ + play_knockback_sound(m); + } else { + play_sound_if_no_flag(m, SOUND_MARIO_UH, MARIO_MARIO_SOUND_PLAYED); + } common_air_knockback_step(m, ACT_HARD_BACKWARD_GROUND_KB, ACT_HARD_BACKWARD_GROUND_KB, 0x0002, -16.0f); return FALSE; } s32 act_hard_forward_air_kb(struct MarioState *m) { -#ifndef VERSION_JP - play_knockback_sound(m); -#else - play_sound_if_no_flag(m, SOUND_MARIO_UH, MARIO_MARIO_SOUND_PLAYED); -#endif + if(!ROM_JP){ + play_knockback_sound(m); + } else { + play_sound_if_no_flag(m, SOUND_MARIO_UH, MARIO_MARIO_SOUND_PLAYED); + } common_air_knockback_step(m, ACT_HARD_FORWARD_GROUND_KB, ACT_HARD_FORWARD_GROUND_KB, 0x002D, 16.0f); return FALSE; } @@ -1249,11 +1231,11 @@ s32 act_soft_bonk(struct MarioState *m) { return TRUE; } -#ifndef VERSION_JP - play_knockback_sound(m); -#else - play_sound_if_no_flag(m, SOUND_MARIO_UH, MARIO_MARIO_SOUND_PLAYED); -#endif + if(!ROM_JP){ + play_knockback_sound(m); + } else { + play_sound_if_no_flag(m, SOUND_MARIO_UH, MARIO_MARIO_SOUND_PLAYED); + } common_air_knockback_step(m, ACT_FREEFALL_LAND, ACT_HARD_BACKWARD_GROUND_KB, 0x0056, m->forwardVel); return FALSE; @@ -1281,9 +1263,9 @@ s32 act_getting_blown(struct MarioState *m) { } mario_set_forward_vel(m, m->forwardVel); -#ifdef VERSION_JP - play_sound_if_no_flag(m, SOUND_MARIO_UH, MARIO_MARIO_SOUND_PLAYED); -#endif + if(ROM_JP){ + play_sound_if_no_flag(m, SOUND_MARIO_UH, MARIO_MARIO_SOUND_PLAYED); + } set_mario_animation(m, MARIO_ANIM_BACKWARD_AIR_KB); switch (perform_air_step(m, 0)) { @@ -1823,10 +1805,10 @@ s32 act_flying(struct MarioState *m) { if (startPitch <= 0 && m->faceAngle[0] > 0 && m->forwardVel >= 48.0f) { play_sound(SOUND_ACTION_FLYING_FAST, m->marioObj->header.gfx.cameraToObject); -#ifndef VERSION_JP - play_sound(SOUND_MARIO_YAHOO_WAHA_YIPPEE + ((gAudioRandom % 5) << 16), + if(!ROM_JP){ + play_sound(SOUND_MARIO_YAHOO_WAHA_YIPPEE + ((gAudioRandom % 5) << 16), m->marioObj->header.gfx.cameraToObject); -#endif + } #if ENABLE_RUMBLE queue_rumble_data(50, 40); #endif diff --git a/src/game/mario_actions_cutscene.c b/src/game/mario_actions_cutscene.c index c4d60aa4..c132c729 100644 --- a/src/game/mario_actions_cutscene.c +++ b/src/game/mario_actions_cutscene.c @@ -1156,11 +1156,7 @@ s32 act_exit_land_save_dialog(struct MarioState *m) { s32 act_death_exit(struct MarioState *m) { if (15 < m->actionTimer++ && launch_mario_until_land(m, ACT_DEATH_EXIT_LAND, MARIO_ANIM_GENERAL_FALL, -32.0f)) { -#ifdef VERSION_JP - play_sound(SOUND_MARIO_OOOF, m->marioObj->header.gfx.cameraToObject); -#else - play_sound(SOUND_MARIO_OOOF2, m->marioObj->header.gfx.cameraToObject); -#endif + play_sound(ROM_JP ? SOUND_MARIO_OOOF : SOUND_MARIO_OOOF2, m->marioObj->header.gfx.cameraToObject); #if ENABLE_RUMBLE queue_rumble_data(5, 80); #endif @@ -1175,11 +1171,7 @@ s32 act_death_exit(struct MarioState *m) { s32 act_unused_death_exit(struct MarioState *m) { if (launch_mario_until_land(m, ACT_FREEFALL_LAND_STOP, MARIO_ANIM_GENERAL_FALL, 0.0f)) { -#ifdef VERSION_JP - play_sound(SOUND_MARIO_OOOF, m->marioObj->header.gfx.cameraToObject); -#else - play_sound(SOUND_MARIO_OOOF2, m->marioObj->header.gfx.cameraToObject); -#endif + play_sound(ROM_JP ? SOUND_MARIO_OOOF : SOUND_MARIO_OOOF2, m->marioObj->header.gfx.cameraToObject); m->numLives--; // restore 7.75 units of health m->healCounter = 31; @@ -1191,11 +1183,7 @@ s32 act_unused_death_exit(struct MarioState *m) { s32 act_falling_death_exit(struct MarioState *m) { if (launch_mario_until_land(m, ACT_DEATH_EXIT_LAND, MARIO_ANIM_GENERAL_FALL, 0.0f)) { -#ifdef VERSION_JP - play_sound(SOUND_MARIO_OOOF, m->marioObj->header.gfx.cameraToObject); -#else - play_sound(SOUND_MARIO_OOOF2, m->marioObj->header.gfx.cameraToObject); -#endif + play_sound(ROM_JP ? SOUND_MARIO_OOOF : SOUND_MARIO_OOOF2, m->marioObj->header.gfx.cameraToObject); #if ENABLE_RUMBLE queue_rumble_data(5, 80); #endif @@ -1718,9 +1706,9 @@ static void intro_cutscene_jump_out_of_pipe(struct MarioState *m) { play_sound_if_no_flag(m, SOUND_MARIO_YAHOO, MARIO_MARIO_SOUND_PLAYED); #else play_sound_if_no_flag(m, SOUND_MARIO_YAHOO, MARIO_MARIO_SOUND_PLAYED); -#ifndef VERSION_JP - play_sound_if_no_flag(m, SOUND_ACTION_HIT_3, MARIO_ACTION_SOUND_PLAYED); -#endif + if(!ROM_JP){ + play_sound_if_no_flag(m, SOUND_ACTION_HIT_3, MARIO_ACTION_SOUND_PLAYED); + } #endif set_mario_animation(m, MARIO_ANIM_SINGLE_JUMP); @@ -1728,9 +1716,9 @@ static void intro_cutscene_jump_out_of_pipe(struct MarioState *m) { if (perform_air_step(m, 0) == AIR_STEP_LANDED) { sound_banks_enable(SEQ_PLAYER_SFX, SOUND_BANKS_DISABLED_DURING_INTRO_CUTSCENE); play_mario_landing_sound(m, SOUND_ACTION_TERRAIN_LANDING); -#ifndef VERSION_JP - play_sound(SOUND_MARIO_HAHA, m->marioObj->header.gfx.cameraToObject); -#endif + if(!ROM_JP){ + play_sound(SOUND_MARIO_HAHA, m->marioObj->header.gfx.cameraToObject); + } advance_cutscene_step(m); } } @@ -2225,10 +2213,10 @@ static void end_peach_cutscene_dialog_1(struct MarioState *m) { case 230: #endif set_cutscene_message(160, 227, 0, 30); -#ifndef VERSION_JP - seq_player_lower_volume(SEQ_PLAYER_LEVEL, 60, 40); - play_sound(SOUND_PEACH_MARIO, sEndPeachObj->header.gfx.cameraToObject); -#endif + if(!ROM_JP){ + seq_player_lower_volume(SEQ_PLAYER_LEVEL, 60, 40); + play_sound(SOUND_PEACH_MARIO, sEndPeachObj->header.gfx.cameraToObject); + } break; #ifdef VERSION_SH @@ -2246,9 +2234,9 @@ static void end_peach_cutscene_dialog_1(struct MarioState *m) { case 290: #endif set_cutscene_message(160, 227, 1, 60); -#ifndef VERSION_JP - play_sound(SOUND_PEACH_POWER_OF_THE_STARS, sEndPeachObj->header.gfx.cameraToObject); -#endif + if(!ROM_JP){ + play_sound(SOUND_PEACH_POWER_OF_THE_STARS, sEndPeachObj->header.gfx.cameraToObject); + } break; #ifdef VERSION_SH @@ -2286,9 +2274,9 @@ static void end_peach_cutscene_dialog_2(struct MarioState *m) { case 29: #endif set_cutscene_message(160, 227, 2, 30); -#ifndef VERSION_JP - play_sound(SOUND_PEACH_THANKS_TO_YOU, sEndPeachObj->header.gfx.cameraToObject); -#endif + if(!ROM_JP){ + play_sound(SOUND_PEACH_THANKS_TO_YOU, sEndPeachObj->header.gfx.cameraToObject); + } break; #ifdef VERSION_SH @@ -2305,16 +2293,16 @@ static void end_peach_cutscene_dialog_2(struct MarioState *m) { case 75: #endif set_cutscene_message(160, 227, 3, 30); -#ifndef VERSION_JP - play_sound(SOUND_PEACH_THANK_YOU_MARIO, sEndPeachObj->header.gfx.cameraToObject); -#endif + if(!ROM_JP){ + play_sound(SOUND_PEACH_THANK_YOU_MARIO, sEndPeachObj->header.gfx.cameraToObject); + } break; case TIMER_SOMETHING_SPECIAL: set_cutscene_message(160, 227, 4, 40); -#ifndef VERSION_JP - play_sound(SOUND_PEACH_SOMETHING_SPECIAL, sEndPeachObj->header.gfx.cameraToObject); -#endif + if(!ROM_JP){ + play_sound(SOUND_PEACH_SOMETHING_SPECIAL, sEndPeachObj->header.gfx.cameraToObject); + } break; case TIMER_PEACH_KISS: @@ -2443,9 +2431,9 @@ static void end_peach_cutscene_dialog_3(struct MarioState *m) { sEndToadAnims[1] = 2; D_8032CBE8 = 1; set_cutscene_message(160, 227, 5, 30); -#ifndef VERSION_JP - play_sound(SOUND_PEACH_BAKE_A_CAKE, sEndPeachObj->header.gfx.cameraToObject); -#endif + if(!ROM_JP){ + play_sound(SOUND_PEACH_BAKE_A_CAKE, sEndPeachObj->header.gfx.cameraToObject); + } break; case 55: @@ -2454,9 +2442,9 @@ static void end_peach_cutscene_dialog_3(struct MarioState *m) { case 130: set_cutscene_message(160, 227, 7, 50); -#ifndef VERSION_JP - play_sound(SOUND_PEACH_FOR_MARIO, sEndPeachObj->header.gfx.cameraToObject); -#endif + if(!ROM_JP){ + play_sound(SOUND_PEACH_FOR_MARIO, sEndPeachObj->header.gfx.cameraToObject); + } break; } @@ -2478,9 +2466,9 @@ static void end_peach_cutscene_run_to_castle(struct MarioState *m) { if (m->actionTimer == 95) { set_cutscene_message(160, 227, 0, 40); -#ifndef VERSION_JP - play_sound(SOUND_PEACH_MARIO2, sEndPeachObj->header.gfx.cameraToObject); -#endif + if(!ROM_JP){ + play_sound(SOUND_PEACH_MARIO2, sEndPeachObj->header.gfx.cameraToObject); + } } if (m->actionTimer == 389) { advance_cutscene_step(m); diff --git a/src/game/mario_actions_moving.c b/src/game/mario_actions_moving.c index fa3758b9..e2798107 100644 --- a/src/game/mario_actions_moving.c +++ b/src/game/mario_actions_moving.c @@ -1595,11 +1595,7 @@ s32 common_ground_knockback_action(struct MarioState *m, s32 animation, s32 arg2 if (arg4 > 0) { play_sound_if_no_flag(m, SOUND_MARIO_ATTACKED, MARIO_MARIO_SOUND_PLAYED); } else { -#ifdef VERSION_JP - play_sound_if_no_flag(m, SOUND_MARIO_OOOF, MARIO_MARIO_SOUND_PLAYED); -#else - play_sound_if_no_flag(m, SOUND_MARIO_OOOF2, MARIO_MARIO_SOUND_PLAYED); -#endif + play_sound_if_no_flag(m, ROM_JP ? SOUND_MARIO_OOOF : SOUND_MARIO_OOOF2, MARIO_MARIO_SOUND_PLAYED); } if (m->forwardVel > 32.0f) { @@ -1645,11 +1641,9 @@ s32 act_hard_backward_ground_kb(struct MarioState *m) { set_mario_action(m, ACT_DEATH_ON_BACK, 0); } -#ifndef VERSION_JP - if (animFrame == 54 && m->prevAction == ACT_SPECIAL_DEATH_EXIT) { + if (!ROM_JP && animFrame == 54 && m->prevAction == ACT_SPECIAL_DEATH_EXIT) { play_sound(SOUND_MARIO_MAMA_MIA, m->marioObj->header.gfx.cameraToObject); } -#endif if (animFrame == 69) { play_mario_landing_sound_once(m, SOUND_ACTION_TERRAIN_LANDING); diff --git a/src/game/mario_actions_object.c b/src/game/mario_actions_object.c index fe13272e..11f64ea5 100644 --- a/src/game/mario_actions_object.c +++ b/src/game/mario_actions_object.c @@ -337,15 +337,17 @@ s32 act_holding_bowser(struct MarioState *m) { s16 spin; if (m->input & INPUT_B_PRESSED) { -#ifndef VERSION_JP - if (m->angleVel[1] <= -0xE00 || m->angleVel[1] >= 0xE00) { - play_sound(SOUND_MARIO_SO_LONGA_BOWSER, m->marioObj->header.gfx.cameraToObject); + + if(!ROM_JP){ + if (m->angleVel[1] <= -0xE00 || m->angleVel[1] >= 0xE00) { + play_sound(SOUND_MARIO_SO_LONGA_BOWSER, m->marioObj->header.gfx.cameraToObject); + } else { + play_sound(SOUND_MARIO_HERE_WE_GO, m->marioObj->header.gfx.cameraToObject); + } } else { play_sound(SOUND_MARIO_HERE_WE_GO, m->marioObj->header.gfx.cameraToObject); } -#else - play_sound(SOUND_MARIO_HERE_WE_GO, m->marioObj->header.gfx.cameraToObject); -#endif + return set_mario_action(m, ACT_RELEASING_BOWSER, 0); } diff --git a/src/game/mario_actions_stationary.c b/src/game/mario_actions_stationary.c index 69e8be52..709fd679 100644 --- a/src/game/mario_actions_stationary.c +++ b/src/game/mario_actions_stationary.c @@ -179,9 +179,7 @@ void play_anim_sound(struct MarioState *m, u32 actionState, s32 animFrame, u32 s } s32 act_start_sleeping(struct MarioState *m) { -#ifndef VERSION_JP s32 animFrame; -#endif if (check_common_idle_cancels(m)) { return TRUE; @@ -197,32 +195,20 @@ s32 act_start_sleeping(struct MarioState *m) { switch (m->actionState) { case 0: -#ifndef VERSION_JP - animFrame = -#endif - set_mario_animation(m, MARIO_ANIM_START_SLEEP_IDLE); + animFrame = set_mario_animation(m, MARIO_ANIM_START_SLEEP_IDLE); break; case 1: -#ifndef VERSION_JP - animFrame = -#endif - set_mario_animation(m, MARIO_ANIM_START_SLEEP_SCRATCH); + animFrame = set_mario_animation(m, MARIO_ANIM_START_SLEEP_SCRATCH); break; case 2: -#ifndef VERSION_JP - animFrame = -#endif - set_mario_animation(m, MARIO_ANIM_START_SLEEP_YAWN); + animFrame = set_mario_animation(m, MARIO_ANIM_START_SLEEP_YAWN); m->marioBodyState->eyeState = MARIO_EYES_HALF_CLOSED; break; case 3: -#ifndef VERSION_JP - animFrame = -#endif - set_mario_animation(m, MARIO_ANIM_START_SLEEP_SITTING); + animFrame = set_mario_animation(m, MARIO_ANIM_START_SLEEP_SITTING); m->marioBodyState->eyeState = MARIO_EYES_HALF_CLOSED; break; } @@ -235,19 +221,17 @@ s32 act_start_sleeping(struct MarioState *m) { m->actionState++; } -#ifndef VERSION_JP - if (m->actionState == 2 && animFrame == -1) { + if (!ROM_JP && m->actionState == 2 && animFrame == -1) { play_sound(SOUND_MARIO_YAWNING, m->marioObj->header.gfx.cameraToObject); } - if (m->actionState == 1 && animFrame == -1) { + if (!ROM_JP && m->actionState == 1 && animFrame == -1) { play_sound(SOUND_MARIO_IMA_TIRED, m->marioObj->header.gfx.cameraToObject); } -#else - if (m->actionState == 2) { + + if (ROM_JP && m->actionState == 2) { play_sound_if_no_flag(m, SOUND_MARIO_YAWNING, MARIO_MARIO_SOUND_PLAYED); } -#endif stationary_ground_step(m); return FALSE; @@ -307,17 +291,19 @@ s32 act_sleeping(struct MarioState *m) { case 2: animFrame = set_mario_animation(m, MARIO_ANIM_SLEEP_LYING); -#ifndef VERSION_JP - play_sound_if_no_flag(m, SOUND_MARIO_SNORING3, MARIO_ACTION_SOUND_PLAYED); -#else - if (animFrame == 2) { - play_sound(SOUND_MARIO_SNORING2, m->marioObj->header.gfx.cameraToObject); + + if(!ROM_JP){ + play_sound_if_no_flag(m, SOUND_MARIO_SNORING3, MARIO_ACTION_SOUND_PLAYED); + } else { + if (animFrame == 2) { + play_sound(SOUND_MARIO_SNORING2, m->marioObj->header.gfx.cameraToObject); + } + + if (animFrame == 25) { + play_sound(SOUND_MARIO_SNORING1, m->marioObj->header.gfx.cameraToObject); + } } - if (animFrame == 25) { - play_sound(SOUND_MARIO_SNORING1, m->marioObj->header.gfx.cameraToObject); - } -#endif break; } return FALSE; @@ -327,9 +313,9 @@ s32 act_waking_up(struct MarioState *m) { if (!m->actionTimer) { stop_sound(SOUND_MARIO_SNORING1, m->marioObj->header.gfx.cameraToObject); stop_sound(SOUND_MARIO_SNORING2, m->marioObj->header.gfx.cameraToObject); -#ifndef VERSION_JP - stop_sound(SOUND_MARIO_SNORING3, m->marioObj->header.gfx.cameraToObject); -#endif + if(!ROM_JP){ + stop_sound(SOUND_MARIO_SNORING3, m->marioObj->header.gfx.cameraToObject); + } raise_background_noise(2); } diff --git a/src/game/mario_step.c b/src/game/mario_step.c index 4b03e7de..ca551788 100644 --- a/src/game/mario_step.c +++ b/src/game/mario_step.c @@ -211,9 +211,9 @@ u32 mario_update_windy_ground(struct MarioState *m) { m->vel[0] += pushSpeed * sins(pushAngle); m->vel[2] += pushSpeed * coss(pushAngle); -#ifdef VERSION_JP - play_sound(SOUND_ENV_WIND2, m->marioObj->header.gfx.cameraToObject); -#endif + if(ROM_JP){ + play_sound(SOUND_ENV_WIND2, m->marioObj->header.gfx.cameraToObject); + } return TRUE; } @@ -600,9 +600,9 @@ void apply_vertical_wind(struct MarioState *m) { } } -#ifdef VERSION_JP - play_sound(SOUND_ENV_WIND2, m->marioObj->header.gfx.cameraToObject); -#endif + if(ROM_JP){ + play_sound(SOUND_ENV_WIND2, m->marioObj->header.gfx.cameraToObject); + } } } } diff --git a/src/game/save_file.c b/src/game/save_file.c index 732f756e..ea0ea52b 100644 --- a/src/game/save_file.c +++ b/src/game/save_file.c @@ -461,7 +461,9 @@ s32 save_file_get_total_star_count(s32 fileIndex, s32 minCourse, s32 maxCourse) } // Add castle secret star count. - return save_file_get_course_star_count(fileIndex, COURSE_NUM_TO_INDEX(COURSE_NONE)) + count; + // return save_file_get_course_star_count(fileIndex, COURSE_NUM_TO_INDEX(COURSE_NONE)) + count; + // TODO: Implement this + return 255; } void save_file_set_flags(u32 flags) { diff --git a/src/menu/file_select.c b/src/menu/file_select.c index 866e0b2b..75d89d49 100644 --- a/src/menu/file_select.c +++ b/src/menu/file_select.c @@ -1371,11 +1371,7 @@ void bhv_menu_button_manager_init(void) { sTextBaseAlpha = 0; } -#ifdef VERSION_JP - #define SAVE_FILE_SOUND SOUND_MENU_STAR_SOUND -#else - #define SAVE_FILE_SOUND SOUND_MENU_STAR_SOUND_OKEY_DOKEY -#endif +#define SAVE_FILE_SOUND ( ROM_JP ? SOUND_MENU_STAR_SOUND : SOUND_MENU_STAR_SOUND_OKEY_DOKEY) /** * In the main menu, check if a button was clicked to play it's button growing state. @@ -1481,8 +1477,6 @@ void check_main_menu_clicked_buttons(void) { #endif } -#undef SAVE_FILE_SOUND - /** * Menu Buttons Menu Manager Loop Action * Calls a menu function depending of the button chosen. @@ -2687,16 +2681,10 @@ void print_score_file_star_score(s8 fileIndex, s16 courseIndex, s16 x, s16 y) { void print_save_file_scores(s8 fileIndex) { #ifndef VERSION_EU unsigned char textMario[] = { TEXT_MARIO }; -#ifdef VERSION_JP unsigned char textFileLetter[] = { TEXT_ZERO }; void **levelNameTable = segmented_to_virtual(seg2_course_name_table); -#endif unsigned char textHiScore[] = { TEXT_HI_SCORE }; unsigned char textMyScore[] = { TEXT_MY_SCORE }; -#if defined(VERSION_US) || defined(VERSION_SH) - unsigned char textFileLetter[] = { TEXT_ZERO }; - void **levelNameTable = segmented_to_virtual(seg2_course_name_table); -#endif #else unsigned char textFileLetter[] = { TEXT_ZERO }; void **levelNameTable; diff --git a/src/menu/star_select.c b/src/menu/star_select.c index ea6de165..78e2b0d4 100644 --- a/src/menu/star_select.c +++ b/src/menu/star_select.c @@ -398,11 +398,7 @@ s32 lvl_update_obj_and_load_act_button_actions(UNUSED s32 arg, UNUSED s32 unused #else if ((gPlayer3Controller->buttonPressed & (A_BUTTON | START_BUTTON | B_BUTTON | Z_TRIG))) { #endif -#ifdef VERSION_JP - play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource); -#else - play_sound(SOUND_MENU_STAR_SOUND_LETS_A_GO, gGlobalSoundSource); -#endif + play_sound(ROM_JP ? SOUND_MENU_STAR_SOUND : SOUND_MENU_STAR_SOUND_LETS_A_GO, gGlobalSoundSource); #if ENABLE_RUMBLE queue_rumble_data(60, 70); func_sh_8024C89C(1); diff --git a/src/menu/title_screen.c b/src/menu/title_screen.c index 98e7715c..e640ea0e 100644 --- a/src/menu/title_screen.c +++ b/src/menu/title_screen.c @@ -34,10 +34,8 @@ static char sLevelSelectStageNames[64][16] = { #undef DEFINE_LEVEL static u16 sDemoCountdown = 0; -#ifndef VERSION_JP static s16 sPlayMarioGreeting = TRUE; static s16 sPlayMarioGameOver = TRUE; -#endif #define PRESS_START_DEMO_TIMER 800 @@ -160,12 +158,11 @@ s16 intro_level_select(void) { s32 intro_regular(void) { s32 level = LEVEL_NONE; -#ifndef VERSION_JP // When the game stars, gGlobalTimer is less than 129 frames, // so Mario greets the player. After that, he will always say // "press start to play" when it goes back to the title screen // (using SAVE AND QUIT) - if (sPlayMarioGreeting == TRUE) { + if (!ROM_JP && sPlayMarioGreeting == TRUE) { if (gGlobalTimer < 129) { play_sound(SOUND_MARIO_HELLO, gGlobalSoundSource); } else { @@ -173,7 +170,7 @@ s32 intro_regular(void) { } sPlayMarioGreeting = FALSE; } -#endif + print_intro_text(); if (gPlayer1Controller->buttonPressed & START_BUTTON) { @@ -186,9 +183,7 @@ s32 intro_regular(void) { // defined in level_intro_mario_head_regular JUMP_IF commands // 100 is File Select - 101 is Level Select level = 100 + gDebugLevelSelect; -#ifndef VERSION_JP sPlayMarioGreeting = TRUE; -#endif } return run_level_id_or_demo(level); } @@ -199,12 +194,10 @@ s32 intro_regular(void) { s32 intro_game_over(void) { s32 level = LEVEL_NONE; -#ifndef VERSION_JP - if (sPlayMarioGameOver == TRUE) { + if (!ROM_JP && sPlayMarioGameOver == TRUE) { play_sound(SOUND_MARIO_GAME_OVER, gGlobalSoundSource); sPlayMarioGameOver = FALSE; } -#endif print_intro_text(); @@ -216,9 +209,7 @@ s32 intro_game_over(void) { #endif // same criteria as intro_regular level = 100 + gDebugLevelSelect; -#ifndef VERSION_JP sPlayMarioGameOver = TRUE; -#endif } return run_level_id_or_demo(level); } diff --git a/src/port/Engine.cpp b/src/port/Engine.cpp index 981b6100..8d652bfb 100644 --- a/src/port/Engine.cpp +++ b/src/port/Engine.cpp @@ -24,10 +24,10 @@ GameEngine::GameEngine(){ if (std::filesystem::exists(cubePath)) { OTRFiles.push_back(cubePath); } - std::string sohOtrPath = LUS::Context::GetPathRelativeToAppBundle("soh.otr"); - if (std::filesystem::exists(sohOtrPath)) { - OTRFiles.push_back(sohOtrPath); - } + std::string sohOtrPath = LUS::Context::GetPathRelativeToAppBundle("soh.otr"); + if (std::filesystem::exists(sohOtrPath)) { + OTRFiles.push_back(sohOtrPath); + } std::string patchesPath = LUS::Context::GetPathRelativeToAppDirectory("mods"); if (patchesPath.length() > 0 && std::filesystem::exists(patchesPath)) { if (std::filesystem::is_directory(patchesPath)) { @@ -46,6 +46,7 @@ GameEngine::GameEngine(){ this->context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::Sample, "Sample", std::make_shared()); this->context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::Sequence, "Sequence", std::make_shared()); GameEngine::AudioInit(); + uint32_t version = LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->GetGameVersions()[0]; } void GameEngine::Create(){ @@ -209,4 +210,8 @@ extern "C" void GameEngine_UnloadSequence(uint8_t seqId) { if(engine->sequences.contains(seqId)){ engine->sequences.erase(seqId); } +} + +extern "C" uint32_t GameEngine_GetGameVersion() { + return LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->GetGameVersions()[0]; } \ No newline at end of file diff --git a/src/port/Engine.h b/src/port/Engine.h index 0cc50e05..2afbac1e 100644 --- a/src/port/Engine.h +++ b/src/port/Engine.h @@ -43,4 +43,5 @@ void GameEngine_UnloadBank(uint8_t bankId); struct AudioSequenceData* GameEngine_LoadSequence(uint8_t seqId); uint8_t GameEngine_IsSequenceLoaded(uint8_t seqId); void GameEngine_UnloadSequence(uint8_t seqId); +uint32_t GameEngine_GetGameVersion(); #endif \ No newline at end of file