diff --git a/configure.py b/configure.py index 3b4f87535..e43964d88 100644 --- a/configure.py +++ b/configure.py @@ -464,7 +464,7 @@ def MatchingFor(*versions): Object(NonMatching, "SB/Core/x/xString.cpp"), Object(Matching, "SB/Core/x/xSurface.cpp"), Object(Matching, "SB/Core/x/xTimer.cpp"), - Object(NonMatching, "SB/Core/x/xTRC.cpp"), + Object(NonMatching, "SB/Core/x/xTRC.cpp", extra_cflags=["-sym on"]), Object(Matching, "SB/Core/x/xutil.cpp"), Object(Matching, "SB/Core/x/xVec3.cpp"), Object(NonMatching, "SB/Game/zActionLine.cpp"), diff --git a/src/SB/Core/x/xTRC.cpp b/src/SB/Core/x/xTRC.cpp index a53fa711e..87bbdffa0 100644 --- a/src/SB/Core/x/xTRC.cpp +++ b/src/SB/Core/x/xTRC.cpp @@ -3,6 +3,9 @@ #include "zGame.h" #include "zGlobals.h" +#include "xMath2.h" +#include "xFont.h" +#include "zVar.h" #include #include @@ -10,7 +13,22 @@ _tagTRCPadInfo gTrcPad[4]; _tagTRCState gTrcDisk[2]; -const char* message_text; +static const char* __deadstripped_xTRC() +{ + return "The Controller in Controller Socket 1 has been removed. Reconnect the Controller to continue with the game.\0" + "The Controller in Controller Socket 1 is an unknown type. Connect a standard Controller to continue with the game.\0" + "Please wait... Checking for the 'SpongeBob SquarePants: Battle for Bikini Bottom' Game Disc.\0" + "The Disc Cover is open. If you want to continue the game, please close the Disc Cover.\0" + "Please insert the 'SpongeBob SquarePants: Battle for Bikini Bottom' Game Disc.\0" + "This is not the 'SpongeBob SquarePants: Battle for Bikini Bottom' Game Disc. Please insert the 'SpongeBob SquarePants: Battle for Bikini Bottom' Game Disc.\0" + "The Game Disc could not be read. Please read the Nintendo GameCube\x99 Instruction Booklet for more information.\0" + "An error has occurred. Turn the power off and refer to the Nintendo GameCube\x99 Instruction Booklet for further instructions."; +} + +static const char* message_text; + +static const basic_rect screen_bounds = { 0.0f, 0.0f, 1.0f, 1.0f }; +static S32 yellow = 0xFFE600FF; void xTRCInit() { @@ -22,7 +40,23 @@ void xTRCInit() memset(gTrcDisk, 0, 8); } -void render_message(const char*); +static void render_message(const char* s) +{ + static xtextbox tb = xtextbox::create(xfont::create(1, NSCREENX(19.0f), NSCREENY(22.0f), 0.0f, + *(iColor_tag*)&yellow, screen_bounds), + screen_bounds, 0x2, 0.0f, 0.0f, 0.0f, 0.0f); + + tb.set_text(s); + tb.bounds = screen_bounds; + tb.bounds.contract(0.1f); + + tb.bounds.h = tb.yextent(true); + tb.bounds.y = -(0.5f * tb.bounds.h + 0.5f); + + render_fill_rect(tb.font.clip, xColorFromRGBA(0, 0, 0, 0xC8)); + + tb.render(true); +} void xTRCRender() { @@ -43,9 +77,12 @@ void xTRCReset() if (isStall) { zGameModeSwitch(eGameMode_Game); + xSndResume(); } +} - xSndResume(); +void xTRCPad(S32, _tagTRCState) +{ } // SDA relocation shenanigans @@ -62,6 +99,45 @@ void xTRCDisk(_tagTRCState state) } } -void xTRCPad(S32, _tagTRCState) +void render_mem_card_no_space(S32 needed, S32 available, S32 neededFiles, bool enabled) +{ + if (available < 0 && neededFiles != -1 && needed != -1) + { + available = 0; + } + + bad_card_needed = needed; + bad_card_available = available; + + char* error_text = "{i:text_mem_card_no_space}"; + if (neededFiles == 0 && needed > available) + { + error_text = "{i:text_mem_card_no_space_overwrite}"; + } + else if ((neededFiles > 0 && needed > available) || neededFiles == -1 || needed > available) + { + error_text = "{i:text_mem_card_no_space_no_save}"; + } + + RenderText(error_text, enabled); +} + +void RenderText(const char* text, bool enabled) { + static xtextbox tb = + xtextbox::create(xfont::create(1, NSCREENX(19.0f), NSCREENY(22.0f), 0.0f, + xColorFromRGBA(0xFF, 0xE6, 0x00, 0xFF), screen_bounds), + screen_bounds, 0x2, 0.0f, 0.0f, 0.0f, 0.0f); + + tb.set_text(enabled ? text : ""); + tb.bounds = screen_bounds; + tb.bounds.contract(0.1f); + tb.bounds.h = tb.yextent(true); + tb.bounds.y = -(0.5f * tb.bounds.h - 0.5f); + tb.render(true); + + if (!enabled) + { + render_fill_rect(tb.font.clip, xColorFromRGBA(0, 0, 0, 0xC8)); + } } diff --git a/src/SB/Core/x/xTRC.h b/src/SB/Core/x/xTRC.h index cb2557144..5b6e49f19 100644 --- a/src/SB/Core/x/xTRC.h +++ b/src/SB/Core/x/xTRC.h @@ -36,5 +36,6 @@ void xTRCRender(); void xTRCReset(); void xTRCDisk(_tagTRCState state); void render_mem_card_no_space(S32 needed, S32 available, S32 neededFiles, bool enabled); +void RenderText(const char* text, bool enabled); #endif diff --git a/src/SB/Game/zVar.h b/src/SB/Game/zVar.h index 7d75f30a4..d38289f58 100644 --- a/src/SB/Game/zVar.h +++ b/src/SB/Game/zVar.h @@ -47,6 +47,7 @@ struct var_type }; extern S32 bad_card_needed; +extern S32 bad_card_available; void var_init(); void zVarNewGame();