Ported mods as enhancements and impl reset button

This commit is contained in:
KiritoDv 2024-04-06 18:33:30 -06:00
parent ccd2d17a7b
commit 2518e45bd2
8 changed files with 36 additions and 50 deletions

View File

@ -17,8 +17,6 @@
/* ************************* */ /* ************************* */
#if MODS_LEVEL_SELECT == 1
void Map_LevelSelect(void); void Map_LevelSelect(void);
#endif
#endif #endif

View File

@ -50,7 +50,8 @@ extern s32 D_game_80161A28;
extern u8 D_game_80161A2C; extern u8 D_game_80161A2C;
extern u16 D_game_80161A2E; extern u16 D_game_80161A2E;
extern u16 gNextLevel; extern u16 gNextLevel;
extern u16 gNextGameState; extern GameState gNextGameState;
extern GameState gGameState;
extern u16 D_game_80161A34; extern u16 D_game_80161A34;
extern u16 gBgColor; extern u16 gBgColor;
extern u8 gBlurAlpha; extern u8 gBlurAlpha;

View File

@ -10,7 +10,7 @@ s32 D_game_80161A28;
u8 D_game_80161A2C; u8 D_game_80161A2C;
u16 D_game_80161A2E; u16 D_game_80161A2E;
u16 gNextLevel; u16 gNextLevel;
u16 gNextGameState; GameState gNextGameState;
u16 D_game_80161A34; u16 D_game_80161A34;
u16 gBgColor; u16 gBgColor;
u8 gBlurAlpha; u8 gBlurAlpha;

View File

@ -44,11 +44,9 @@ s32 Message_GetCharCount(u16* msgPtr) {
s32 count = 0; s32 count = 0;
u16* msgChar = LOAD_ASSET(msgPtr); u16* msgChar = LOAD_ASSET(msgPtr);
#if MODS_LEVEL_SELECT == 1 if (CVarGetInteger("gLevelSelector", 0) && gCurrentPlanet == 6) {
if (gCurrentPlanet == 6) {
return 0; return 0;
} }
#endif
while (*msgChar != NULL) { while (*msgChar != NULL) {
count++; count++;

View File

@ -37,7 +37,7 @@ void decimalToHex(int num, char* hexString, size_t hexStringLength) {
} }
} }
void Option_ExpertSoundUpdate(void) { void Option_JukeboxSoundUpdate(void) {
char hexString[9]; // Buffer to store the hexadecimal string char hexString[9]; // Buffer to store the hexadecimal string
if ((gControllerPress[gMainController].button & R_TRIG) && (sfxBank < 4)) { if ((gControllerPress[gMainController].button & R_TRIG) && (sfxBank < 4)) {

View File

@ -1872,9 +1872,9 @@ void Map_8019FF48(void) {
D_menu_801CDA08); D_menu_801CDA08);
} }
gGameFrameCount++; gGameFrameCount++;
#if MODS_LEVEL_SELECT == true if(CVarGetInteger("gLevelSelector", 0)){
Map_LevelSelect(); Map_LevelSelect();
#endif }
} }
void Map_801A01A8(void) { void Map_801A01A8(void) {
@ -4092,11 +4092,9 @@ bool Map_801A62FC(PlanetId planet) {
break; break;
} }
#if MODS_LEVEL_SELECT == 1 if (CVarGetInteger("gLevelSelector", 0) && gCurrentPlanet == 6) {
if (gCurrentPlanet == 6) {
return false; return false;
} }
#endif
if (gSaveFile.save.data.planet[planetSaveSlot].played & 1) { if (gSaveFile.save.data.planet[planetSaveSlot].played & 1) {
ret = false; ret = false;
@ -5390,17 +5388,9 @@ void Map_801A9A8C(void) {
RCP_SetupDL(&gMasterDisp, 0x53); RCP_SetupDL(&gMasterDisp, 0x53);
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255);
#if MODS_LEVEL_SELECT == 1 if (CVarGetInteger("gLevelSelector", 0) && gCurrentPlanet == 6) {
if (gCurrentPlanet == 6) {
return; return;
} }
#endif
#if MODS_LEVEL_SELECT == 1
if (gCurrentPlanet == 6) {
return;
}
#endif
TextureRect_8bIA(&gMasterDisp, D_5000500, 112, 19, D_menu_801B6AC0[0], D_menu_801B6AC8[0], 1.0f, 1.0f); TextureRect_8bIA(&gMasterDisp, D_5000500, 112, 19, D_menu_801B6AC0[0], D_menu_801B6AC8[0], 1.0f, 1.0f);
TextureRect_8bIA(&gMasterDisp, sp54, 16, 15, D_menu_801B6AC0[1], D_menu_801B6AC8[1], 1.0f, 1.0f); TextureRect_8bIA(&gMasterDisp, sp54, 16, 15, D_menu_801B6AC0[1], D_menu_801B6AC8[1], 1.0f, 1.0f);
@ -5935,11 +5925,9 @@ void Map_801AB300(void) {
if ((D_menu_801CF018 > 0) && (D_menu_801CF018 != 100)) { if ((D_menu_801CF018 > 0) && (D_menu_801CF018 != 100)) {
Map_801AB978(D_ctx_801782A4); Map_801AB978(D_ctx_801782A4);
Map_801AB978(D_menu_801AF420[!D_menu_801CD940]); Map_801AB978(D_menu_801AF420[!D_menu_801CD940]);
#if MODS_LEVEL_SELECT == 1 if (CVarGetInteger("gLevelSelector", 0) && gCurrentPlanet == 6) {
if (gCurrentPlanet == 6) {
return; return;
} }
#endif
func_radio_800BB388(); func_radio_800BB388();
} }
} }
@ -6731,6 +6719,4 @@ void Map_801AD7EC(s32 xPos, s32 yPos, s32 number) {
} }
} }
#if MODS_LEVEL_SELECT == 1
#include "../../mods/levelselect.c" #include "../../mods/levelselect.c"
#endif

View File

@ -384,13 +384,11 @@ void Option_Setup(void) {
continue; continue;
} }
if (!(gSaveFile.save.data.planet[i].normalMedal & 1)) { if (!(gSaveFile.save.data.planet[i].normalMedal & 1)) {
#if MODS_LEVEL_SELECT == 1 if(CVarGetInteger("gLevelSelector", 0) || CVarGetInteger("gSfxJukebox", 0)) {
enableExpertModes = true; enableExpertModes = true;
#elif MODS_SFX_JUKEBOX == 1 } else {
enableExpertModes = true;
#else
enableExpertModes = false; enableExpertModes = false;
#endif }
break; break;
} }
} }
@ -1643,14 +1641,18 @@ void Option_ExpertSoundInit(void) {
// clang-format on // clang-format on
} }
// Expert Sound Options
#if MODS_SFX_JUKEBOX == 1
#include "../../mods/sfxjukebox.c" #include "../../mods/sfxjukebox.c"
#else
// Expert Sound Options
void Option_ExpertSoundUpdate(void) { void Option_ExpertSoundUpdate(void) {
s32 pad; s32 pad;
f32 sp28 = D_menu_801B931C; f32 sp28 = D_menu_801B931C;
if(CVarGetInteger("gSfxJukebox", 0) == 1) {
Option_JukeboxSoundUpdate();
return;
}
if (Option_8019C66C(&sp28, 0.0f, 49.0f, &D_menu_801B9290) != 0) { if (Option_8019C66C(&sp28, 0.0f, 49.0f, &D_menu_801B9290) != 0) {
AUDIO_PLAY_SFX(0x49000002, gDefaultSfxSource, 4); AUDIO_PLAY_SFX(0x49000002, gDefaultSfxSource, 4);
D_menu_801B931C = sp28; D_menu_801B931C = sp28;
@ -1685,7 +1687,6 @@ void Option_ExpertSoundUpdate(void) {
} }
} }
} }
#endif
void Option_ExpertSoundDraw(void) { void Option_ExpertSoundDraw(void) {
u8* temp_v0_4; u8* temp_v0_4;

View File

@ -12,6 +12,10 @@
#include <Fast3D/gfx_pc.h> #include <Fast3D/gfx_pc.h>
#include "port/Engine.h" #include "port/Engine.h"
extern "C" {
#include "sys.h"
}
namespace GameUI { namespace GameUI {
std::shared_ptr<GameMenuBar> mGameMenuBar; std::shared_ptr<GameMenuBar> mGameMenuBar;
std::shared_ptr<LUS::GuiWindow> mConsoleWindow; std::shared_ptr<LUS::GuiWindow> mConsoleWindow;
@ -391,7 +395,7 @@ void DrawGameMenu() {
"Ctrl+R" "Ctrl+R"
#endif #endif
)) { )) {
std::reinterpret_pointer_cast<LUS::ConsoleWindow>(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->Dispatch("reset"); gNextGameState = GSTATE_BOOT;
} }
#if !defined(__SWITCH__) && !defined(__WIIU__) #if !defined(__SWITCH__) && !defined(__WIIU__)
@ -455,19 +459,17 @@ void DrawDebugMenu() {
}); });
UIWidgets::CVarCheckbox("Debug mode", "gEnableDebugMode", { UIWidgets::CVarCheckbox("Debug mode", "gEnableDebugMode", {
.tooltip = "Various debug features, including a level selector from the main menu" .tooltip = "TBD"
}); });
UIWidgets::CVarCheckbox("Better Level Select", "gDeveloper.BetterLevelSelect", { UIWidgets::CVarCheckbox("Level Selector", "gLevelSelector", {
.tooltip = "Tweaks to the level select screen, like naming and allowing C-buttons to be used" .tooltip = "Allows you to select any level from the main menu"
}); });
UIWidgets::CVarCheckbox("Draw DebugInfo", "gDeveloper.DrawDebugInfo"); UIWidgets::CVarCheckbox("SFX Jukebox", "gSfxJukebox", {
if (CVarGetInteger("gDeveloper.DrawDebugInfo", 0)) { .tooltip = "Allows you to play sound effects from the game"
UIWidgets::CVarCombobox("DebugInfo mode", "gDeveloper.DebugInfoPage", debugInfoPages, {
.defaultIndex = 0,
}); });
}
UIWidgets::Spacer(0); UIWidgets::Spacer(0);
UIWidgets::WindowButton("Stats", "gStatsEnabled", GameUI::mStatsWindow, { UIWidgets::WindowButton("Stats", "gStatsEnabled", GameUI::mStatsWindow, {