Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
84 changes: 80 additions & 4 deletions src/SB/Core/x/xTRC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,32 @@

#include "zGame.h"
#include "zGlobals.h"
#include "xMath2.h"
#include "xFont.h"
#include "zVar.h"

#include <string.h>
#include <types.h>

_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<F32> screen_bounds = { 0.0f, 0.0f, 1.0f, 1.0f };
static S32 yellow = 0xFFE600FF;

void xTRCInit()
{
Expand All @@ -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()
{
Expand All @@ -43,9 +77,12 @@ void xTRCReset()
if (isStall)
{
zGameModeSwitch(eGameMode_Game);
xSndResume();
}
}

xSndResume();
void xTRCPad(S32, _tagTRCState)
{
}

// SDA relocation shenanigans
Expand All @@ -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));
}
}
1 change: 1 addition & 0 deletions src/SB/Core/x/xTRC.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions src/SB/Game/zVar.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ struct var_type
};

extern S32 bad_card_needed;
extern S32 bad_card_available;

void var_init();
void zVarNewGame();
Expand Down