Add original frlg safari zone menu and fix initial step counter (#9340)

This commit is contained in:
FosterProgramming 2026-02-25 15:22:08 +01:00 committed by GitHub
parent 91a1278934
commit dc3dd0273c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 25 additions and 8 deletions

View File

@ -2,6 +2,7 @@
#define GUARD_SAFARI_ZONE_H
extern u8 gNumSafariBalls;
extern u16 gSafariZoneStepCounter;
bool32 GetSafariZoneFlag(void);
void SetSafariZoneFlag(void);

View File

@ -186,6 +186,7 @@ extern const u8 gText_Floor6[];
extern const u8 gText_Floor7[];
extern const u8 gText_Peak[];
extern const u8 gText_SafariBallStock[];
extern const u8 gText_MenuSafariStats[];
extern const u8 gText_BattlePyramidFloor[];
extern const u8 gText_MenuOptionPokedex[];

View File

@ -29,7 +29,7 @@ extern const u8 SafariZone_EventScript_OutOfBallsMidBattle[];
extern const u8 SafariZone_EventScript_OutOfBalls[];
EWRAM_DATA u8 gNumSafariBalls = 0;
EWRAM_DATA static u16 sSafariZoneStepCounter = 0;
EWRAM_DATA u16 gSafariZoneStepCounter = 0;
EWRAM_DATA static u8 sSafariZoneCaughtMons = 0;
EWRAM_DATA static u8 sSafariZonePkblkUses = 0;
EWRAM_DATA static struct PokeblockFeeder sPokeblockFeeders[NUM_POKEBLOCK_FEEDERS] = {0};
@ -58,7 +58,10 @@ void EnterSafariMode(void)
SetSafariZoneFlag();
ClearAllPokeblockFeeders();
gNumSafariBalls = 30;
sSafariZoneStepCounter = 500;
if (IS_FRLG)
gSafariZoneStepCounter = 600;
else
gSafariZoneStepCounter = 500;
sSafariZoneCaughtMons = 0;
sSafariZonePkblkUses = 0;
}
@ -69,7 +72,7 @@ void ExitSafariMode(void)
ResetSafariZoneFlag();
ClearAllPokeblockFeeders();
gNumSafariBalls = 0;
sSafariZoneStepCounter = 0;
gSafariZoneStepCounter = 0;
}
bool8 SafariZoneTakeStep(void)
@ -80,8 +83,8 @@ bool8 SafariZoneTakeStep(void)
}
DecrementFeederStepCounters();
sSafariZoneStepCounter--;
if (sSafariZoneStepCounter == 0)
gSafariZoneStepCounter--;
if (gSafariZoneStepCounter == 0)
{
ScriptContext_SetupScript(SafariZone_EventScript_TimesUp);
return TRUE;

View File

@ -440,9 +440,20 @@ static void ShowSafariBallsWindow(void)
sSafariBallsWindowId = AddWindow(&sWindowTemplate_SafariBalls);
PutWindowTilemap(sSafariBallsWindowId);
DrawStdWindowFrame(sSafariBallsWindowId, FALSE);
if (IS_FRLG)
{
ConvertIntToDecimalStringN(gStringVar1, gSafariZoneStepCounter, STR_CONV_MODE_RIGHT_ALIGN, 3);
ConvertIntToDecimalStringN(gStringVar2, 600, STR_CONV_MODE_RIGHT_ALIGN, 3);
ConvertIntToDecimalStringN(gStringVar3, gNumSafariBalls, STR_CONV_MODE_RIGHT_ALIGN, 2);
StringExpandPlaceholders(gStringVar4, gText_MenuSafariStats);
AddTextPrinterParameterized(sSafariBallsWindowId, FONT_NORMAL, gStringVar4, 4, 3, 0xFF, NULL);
}
else
{
ConvertIntToDecimalStringN(gStringVar1, gNumSafariBalls, STR_CONV_MODE_RIGHT_ALIGN, 2);
StringExpandPlaceholders(gStringVar4, gText_SafariBallStock);
AddTextPrinterParameterized(sSafariBallsWindowId, FONT_NORMAL, gStringVar4, 0, 1, TEXT_SKIP_DRAW, NULL);
}
CopyWindowToVram(sSafariBallsWindowId, COPYWIN_GFX);
}

View File

@ -984,6 +984,7 @@ const u8 gText_MenuRetire[] = _("RETIRE");
const u8 gText_MenuRest[] = _("REST");
const u8 gText_MenuDexNav[] = _("DEXNAV");
const u8 gText_SafariBallStock[] = _("SAFARI BALLS\nStock: {STR_VAR_1}");
const u8 gText_MenuSafariStats[] = _("{STR_VAR_1}/{STR_VAR_2}\nBALLS {STR_VAR_3}");
const u8 gText_BattlePyramidFloor[] = _("Battle Pyramid\n{STR_VAR_1}");
const u8 gText_Floor1[] = _("Floor 1");
const u8 gText_Floor2[] = _("Floor 2");