Refactor/sea gallop (#119)

* add battle frontier option

* update latin_small
This commit is contained in:
cawtds 2026-02-24 15:37:57 +01:00 committed by GitHub
parent 29f72e977c
commit 4d38b8ed6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 137 additions and 97 deletions

View File

@ -15,16 +15,12 @@ BattleFrontier_OutsideWest_EventScript_FerryAttendant::
goto_if_eq VAR_RESULT, FALSE, BattleFrontier_OutsideWest_EventScript_NoSSTicket
message BattleFrontier_OutsideWest_Text_WhereWouldYouLikeToGo
waitmessage
goto BattleFrontier_OutsideWest_EventScript_ChooseFerryDestination
end
BattleFrontier_OutsideWest_EventScript_ChooseFerryDestination::
multichoicedefault 18, 6, MULTI_SSTIDAL_BATTLE_FRONTIER, 2, FALSE
setvar VAR_0x8004, SEAGALLOP_NAVEL_ROCK
multichoice 20, 8, MULTICHOICE_SEAGALLOP_VERMILION, FALSE
switch VAR_RESULT
case 0, BattleFrontier_OutsideWest_EventScript_FerryToSlateport
case 1, BattleFrontier_OutsideWest_EventScript_FerryToLilycove
case 2, BattleFrontier_OutsideWest_EventScript_CancelFerrySelect
case MULTI_B_PRESSED, BattleFrontier_OutsideWest_EventScript_CancelFerrySelect
case 0, EventScript_SailToVermilionCity
case 1, EventScript_CancelSail
case MULTI_B_PRESSED, EventScript_CancelSail
end
BattleFrontier_OutsideWest_EventScript_NoSSTicket::
@ -32,47 +28,6 @@ BattleFrontier_OutsideWest_EventScript_NoSSTicket::
release
end
BattleFrontier_OutsideWest_EventScript_FerryToSlateport::
msgbox BattleFrontier_OutsideWest_Text_SlateportItIs, MSGBOX_YESNO
goto_if_eq VAR_RESULT, NO, BattleFrontier_OutsideWest_EventScript_ChooseNewFerryDestination
msgbox BattleFrontier_OutsideWest_Text_PleaseBoardFerry, MSGBOX_DEFAULT
call BattleFrontier_OutsideWest_EventScript_BoardFerry
warp MAP_VERMILION_CITY, 8, 11
waitstate
release
end
BattleFrontier_OutsideWest_EventScript_FerryToLilycove::
msgbox BattleFrontier_OutsideWest_Text_LilycoveItIs, MSGBOX_YESNO
goto_if_eq VAR_RESULT, NO, BattleFrontier_OutsideWest_EventScript_ChooseNewFerryDestination
msgbox BattleFrontier_OutsideWest_Text_PleaseBoardFerry, MSGBOX_DEFAULT
call BattleFrontier_OutsideWest_EventScript_BoardFerry
warp MAP_VERMILION_CITY, 8, 11
waitstate
release
end
BattleFrontier_OutsideWest_EventScript_ChooseNewFerryDestination::
message BattleFrontier_OutsideWest_Text_ThenWhereWouldYouLikeToGo
waitmessage
goto BattleFrontier_OutsideWest_EventScript_ChooseFerryDestination
end
BattleFrontier_OutsideWest_EventScript_BoardFerry::
closemessage
applymovement VAR_LAST_TALKED, Common_Movement_WalkInPlaceFasterDown
waitmovement 0
delay 30
hideobjectat LOCALID_FRONTIER_FERRY_ATTENDANT, MAP_BATTLE_FRONTIER_OUTSIDE_WEST
setvar VAR_0x8004, LOCALID_FRONTIER_SS_TIDAL
call Common_EventScript_FerryDepartIsland
return
BattleFrontier_OutsideWest_EventScript_CancelFerrySelect::
msgbox BattleFrontier_OutsideWest_Text_SailWithUsAnotherTime, MSGBOX_DEFAULT
release
end
BattleFrontier_OutsideWest_EventScript_BattleDomeSign::
msgbox BattleFrontier_OutsideWest_Text_BattleDomeSign, MSGBOX_SIGN
end

View File

@ -11,5 +11,5 @@ BirthIsland_Harbor_EventScript_Sailor::
switch VAR_RESULT
case 0, EventScript_SailToVermilionCity
case 1, EventScript_CancelSail
case 127, EventScript_CancelSail
case MULTI_B_PRESSED, EventScript_CancelSail
end

View File

@ -11,5 +11,5 @@ NavelRock_Harbor_EventScript_Sailor::
switch VAR_RESULT
case 0, EventScript_SailToVermilionCity
case 1, EventScript_CancelSail
case 127, EventScript_CancelSail
case MULTI_B_PRESSED, EventScript_CancelSail
end

View File

@ -70,12 +70,58 @@ VermilionCity_EventScript_CheckHasAuroraTicket::
VermilionCity_EventScript_CheckSeagallopPresent::
setvar VAR_0x8004, SEAGALLOP_VERMILION_CITY
goto_if_set FLAG_BATTLE_FRONTIER_UNLOCKED, VermilionCity_EventScript_ChooseFrontierUnlocked
goto_if_ge VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 5, VermilionCity_EventScript_ChooseSeagallopDestRainbowPass
goto_if_ge VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 1, VermilionCity_EventScript_ChooseSeagallopDestTriPass
msgbox VermilionCity_Text_TheShipSetSail
release
end
VermilionCity_EventScript_ChooseFrontierUnlocked::
goto_if_questlog EventScript_ReleaseEnd
special QuestLog_CutRecording
message VermilionCity_Text_BoardSeagallopFerry
waitmessage
dynmultipush Seagallop_SeviiIslands, 0
dynmultipush Seagallop_BattleFrontier, 1
call VermilionCity_EventScript_CheckHasMysticTicket
call_if_eq VAR_RESULT, TRUE, VermilionCity_AddMysticTicket
call VermilionCity_EventScript_CheckHasAuroraTicket
call_if_eq VAR_RESULT, TRUE, VermilionCity_AddAuroraTicket
dynmultipush Seagallop_Cancel, 4
dynmultistack 0, 0, FALSE, 5, FALSE, 0, NULL
switch VAR_RESULT
case 0, EventScript_SeviiDestinationsPage1
case 1, EventScript_SailToBattleFrontier
case 2, EventScript_SailToNavelRock
case 3, EventScript_SailToBirthIsland
case 4, EventScript_CancelSail
case MULTI_B_PRESSED, EventScript_CancelSail
end
VermilionCity_AddMysticTicket::
dynmultipush Seagallop_NavelRock, 2
return
VermilionCity_AddAuroraTicket::
dynmultipush Seagallop_BirthIsland, 3
return
Seagallop_SeviiIslands::
.string "SEVII ISLANDS$"
Seagallop_NavelRock::
.string "NAVEL ROCK$"
Seagallop_BirthIsland::
.string "BIRTH ISLAND$"
Seagallop_BattleFrontier::
.string "BATTLE FRONTIER$"
Seagallop_Cancel::
.string "CANCEL$"
VermilionCity_EventScript_ChooseSeagallopDestRainbowPass::
goto_if_questlog EventScript_ReleaseEnd
special QuestLog_CutRecording
@ -100,7 +146,7 @@ VermilionCity_EventScript_HasMysticTicket::
case 0, EventScript_SeviiDestinationsPage1
case 1, EventScript_SailToNavelRock
case 2, EventScript_CancelSail
case 127, EventScript_CancelSail
case MULTI_B_PRESSED, EventScript_CancelSail
end
VermilionCity_EventScript_ShowMysticTicket::
@ -117,7 +163,7 @@ VermilionCity_EventScript_HasAuroraTicket::
case 0, EventScript_SeviiDestinationsPage1
case 1, EventScript_SailToBirthIsland
case 2, EventScript_CancelSail
case 127, EventScript_CancelSail
case MULTI_B_PRESSED, EventScript_CancelSail
end
VermilionCity_EventScript_ShowAuroraTicket::
@ -136,7 +182,7 @@ VermilionCity_EventScript_HasMysticAndAuroraTickets::
case 1, EventScript_SailToNavelRock
case 2, EventScript_SailToBirthIsland
case 3, EventScript_CancelSail
case 127, EventScript_CancelSail
case MULTI_B_PRESSED, EventScript_CancelSail
end
EventScript_SailToNavelRock::
@ -153,6 +199,13 @@ EventScript_SailToBirthIsland::
goto EventScript_SetSail
end
EventScript_SailToBattleFrontier::
msgbox VermilionCity_Text_Seagallop12Departing
setvar VAR_0x8004, SEAGALLOP_VERMILION_CITY
setvar VAR_0x8006, SEAGALLOP_BATTLE_FRONTIER
goto EventScript_SetSail
end
VermilionCity_EventScript_ChooseSeagallopDestTriPass::
message VermilionCity_Text_BoardSeagallopTriPass
waitmessage
@ -163,7 +216,7 @@ VermilionCity_EventScript_ChooseSeagallopDestTriPass::
case 1, EventScript_SailToTwoIsland2
case 2, EventScript_SailToThreeIsland2
case 3, EventScript_CancelSail
case 127, EventScript_CancelSail
case MULTI_B_PRESSED, EventScript_CancelSail
end
@ Unreachable
@ -208,6 +261,7 @@ VermilionCity_EventScript_DontHaveSSTicket::
VermilionCity_EventScript_CheckSeagallopPresentTrigger::
setvar VAR_0x8004, SEAGALLOP_VERMILION_CITY
goto_if_set FLAG_BATTLE_FRONTIER_UNLOCKED, VermilionCity_EventScript_ChooseFrontierUnlocked
goto_if_ge VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 5, VermilionCity_EventScript_ChooseSeagallopDestRainbowPass
goto_if_ge VAR_MAP_SCENE_ONE_ISLAND_POKEMON_CENTER_1F, 1, VermilionCity_EventScript_ChooseSeagallopDestTriPass
msgbox VermilionCity_Text_TheShipSetSail

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -206,7 +206,7 @@
#define FLAG_HIDE_BATTLE_TOWER_MULTI_BATTLE_PARTNER_ALT_2 0x0BC
#define FLAG_HIDE_BATTLE_FRONTIER_RECEPTION_GATE_SCOTT 0x0BD
#define FLAG_CANCEL_BATTLE_ROOM_CHALLENGE 0x0BE
#define FLAG_0x0BF 0x0BF
#define FLAG_BATTLE_FRONTIER_UNLOCKED 0x0BF
#define FLAG_0x0C0 0x0C0
#define FLAG_0x0C1 0x0C1
#define FLAG_0x0C2 0x0C2

View File

@ -1,17 +1,21 @@
#ifndef GUARD_CONSTANTS_SEAGALLOP_H
#define GUARD_CONSTANTS_SEAGALLOP_H
#define SEAGALLOP_VERMILION_CITY 0
#define SEAGALLOP_ONE_ISLAND 1
#define SEAGALLOP_TWO_ISLAND 2
#define SEAGALLOP_THREE_ISLAND 3
#define SEAGALLOP_FOUR_ISLAND 4
#define SEAGALLOP_FIVE_ISLAND 5
#define SEAGALLOP_SIX_ISLAND 6
#define SEAGALLOP_SEVEN_ISLAND 7
#define SEAGALLOP_CINNABAR_ISLAND 8
#define SEAGALLOP_NAVEL_ROCK 9
#define SEAGALLOP_BIRTH_ISLAND 10
enum SeagallopLocation
{
SEAGALLOP_VERMILION_CITY,
SEAGALLOP_ONE_ISLAND,
SEAGALLOP_TWO_ISLAND,
SEAGALLOP_THREE_ISLAND,
SEAGALLOP_FOUR_ISLAND,
SEAGALLOP_FIVE_ISLAND,
SEAGALLOP_SIX_ISLAND,
SEAGALLOP_SEVEN_ISLAND,
SEAGALLOP_CINNABAR_ISLAND,
SEAGALLOP_NAVEL_ROCK,
SEAGALLOP_BIRTH_ISLAND,
SEAGALLOP_BATTLE_FRONTIER,
};
#define SEAGALLOP_MORE 254

View File

@ -1168,6 +1168,16 @@ static void MultichoiceDynamic_MoveCursor(s32 itemIndex, bool8 onInit, struct Li
}
}
u32 GetMultiChoiceWindowHeight(u8 argc, u8 maxBeforeScroll)
{
u32 windowHeight;
u8 numItems = argc < maxBeforeScroll ? argc : maxBeforeScroll;
windowHeight = numItems * GetFontAttribute(sScriptableListMenuTemplate.fontId, FONTATTR_MAX_LETTER_HEIGHT);
return (windowHeight + 7) / 8;
}
static void DrawMultichoiceMenuDynamic(u8 left, u8 top, u8 argc, struct ListMenuItem *items, bool8 ignoreBPress, u32 initialRow, u8 maxBeforeScroll, u32 callbackSet)
{
u32 i;
@ -1183,7 +1193,8 @@ static void DrawMultichoiceMenuDynamic(u8 left, u8 top, u8 argc, struct ListMenu
width = DisplayTextAndGetWidth(items[i].name, width);
}
LoadMessageBoxAndBorderGfx();
windowHeight = (argc < maxBeforeScroll) ? argc * 2 : maxBeforeScroll * 2;
windowHeight = GetMultiChoiceWindowHeight(argc, maxBeforeScroll);
newWidth = ConvertPixelWidthToTileWidth(width);
left = ScriptMenu_AdjustLeftCoordFromWidth(left, newWidth);
windowId = CreateWindowFromRect(left, top, newWidth, windowHeight);

View File

@ -61,17 +61,18 @@ static const struct BgTemplate sBGTemplates[] = {
static const s8 sSeag[][4] = {
// Map X Y
[SEAGALLOP_VERMILION_CITY] = {MAP(MAP_VERMILION_CITY), 0x17, 0x20},
[SEAGALLOP_ONE_ISLAND] = {MAP(MAP_ONE_ISLAND_HARBOR), 0x08, 0x05},
[SEAGALLOP_TWO_ISLAND] = {MAP(MAP_TWO_ISLAND_HARBOR), 0x08, 0x05},
[SEAGALLOP_THREE_ISLAND] = {MAP(MAP_THREE_ISLAND_HARBOR), 0x08, 0x05},
[SEAGALLOP_FOUR_ISLAND] = {MAP(MAP_FOUR_ISLAND_HARBOR), 0x08, 0x05},
[SEAGALLOP_FIVE_ISLAND] = {MAP(MAP_FIVE_ISLAND_HARBOR), 0x08, 0x05},
[SEAGALLOP_SIX_ISLAND] = {MAP(MAP_SIX_ISLAND_HARBOR), 0x08, 0x05},
[SEAGALLOP_SEVEN_ISLAND] = {MAP(MAP_SEVEN_ISLAND_HARBOR), 0x08, 0x05},
[SEAGALLOP_CINNABAR_ISLAND] = {MAP(MAP_CINNABAR_ISLAND), 0x15, 0x07},
[SEAGALLOP_NAVEL_ROCK] = {MAP(MAP_NAVEL_ROCK_HARBOR), 0x08, 0x05},
[SEAGALLOP_BIRTH_ISLAND] = {MAP(MAP_BIRTH_ISLAND_HARBOR), 0x08, 0x05}
[SEAGALLOP_VERMILION_CITY] = {MAP(MAP_VERMILION_CITY), 23, 32},
[SEAGALLOP_ONE_ISLAND] = {MAP(MAP_ONE_ISLAND_HARBOR), 8, 5},
[SEAGALLOP_TWO_ISLAND] = {MAP(MAP_TWO_ISLAND_HARBOR), 8, 5},
[SEAGALLOP_THREE_ISLAND] = {MAP(MAP_THREE_ISLAND_HARBOR), 8, 5},
[SEAGALLOP_FOUR_ISLAND] = {MAP(MAP_FOUR_ISLAND_HARBOR), 8, 5},
[SEAGALLOP_FIVE_ISLAND] = {MAP(MAP_FIVE_ISLAND_HARBOR), 8, 5},
[SEAGALLOP_SIX_ISLAND] = {MAP(MAP_SIX_ISLAND_HARBOR), 8, 5},
[SEAGALLOP_SEVEN_ISLAND] = {MAP(MAP_SEVEN_ISLAND_HARBOR), 8, 5},
[SEAGALLOP_CINNABAR_ISLAND] = {MAP(MAP_CINNABAR_ISLAND), 21, 7},
[SEAGALLOP_NAVEL_ROCK] = {MAP(MAP_NAVEL_ROCK_HARBOR), 8, 5},
[SEAGALLOP_BIRTH_ISLAND] = {MAP(MAP_BIRTH_ISLAND_HARBOR), 8, 5},
[SEAGALLOP_BATTLE_FRONTIER] = {MAP(MAP_BATTLE_FRONTIER_OUTSIDE_WEST), 20, 68},
};
// Bitpacked array. In the commented section, right-most bit is the
@ -95,7 +96,8 @@ static const u16 sTravelDirectionMatrix[] = {
[SEAGALLOP_SEVEN_ISLAND] = 0x440, // 10001000000
[SEAGALLOP_CINNABAR_ISLAND] = 0x7ff, // 11111111111
[SEAGALLOP_NAVEL_ROCK] = 0x6e0, // 11011100000
[SEAGALLOP_BIRTH_ISLAND] = 0x000 // 00000000000
[SEAGALLOP_BIRTH_ISLAND] = 0x000, // 00000000000
[SEAGALLOP_BATTLE_FRONTIER] = 0x000, // 00000000000
};
static const union AnimCmd sSpriteAnims_Ferry_WB[] = {
@ -470,23 +472,26 @@ u8 GetSeagallopNumber(void)
if (originId == SEAGALLOP_BIRTH_ISLAND || destId == SEAGALLOP_BIRTH_ISLAND)
return 12;
if ((originId == SEAGALLOP_ONE_ISLAND
|| originId == SEAGALLOP_TWO_ISLAND
|| originId == SEAGALLOP_THREE_ISLAND)
&& (destId == SEAGALLOP_ONE_ISLAND
|| destId == SEAGALLOP_TWO_ISLAND
if (originId == SEAGALLOP_BATTLE_FRONTIER || destId == SEAGALLOP_BATTLE_FRONTIER)
return 14;
if ((originId == SEAGALLOP_ONE_ISLAND
|| originId == SEAGALLOP_TWO_ISLAND
|| originId == SEAGALLOP_THREE_ISLAND)
&& (destId == SEAGALLOP_ONE_ISLAND
|| destId == SEAGALLOP_TWO_ISLAND
|| destId == SEAGALLOP_THREE_ISLAND))
return 2;
if ((originId == SEAGALLOP_FOUR_ISLAND
|| originId == SEAGALLOP_FIVE_ISLAND)
&& (destId == SEAGALLOP_FOUR_ISLAND
if ((originId == SEAGALLOP_FOUR_ISLAND
|| originId == SEAGALLOP_FIVE_ISLAND)
&& (destId == SEAGALLOP_FOUR_ISLAND
|| destId == SEAGALLOP_FIVE_ISLAND))
return 3;
if ((originId == SEAGALLOP_SIX_ISLAND
|| originId == SEAGALLOP_SEVEN_ISLAND)
&& (destId == SEAGALLOP_SIX_ISLAND
if ((originId == SEAGALLOP_SIX_ISLAND
|| originId == SEAGALLOP_SEVEN_ISLAND)
&& (destId == SEAGALLOP_SIX_ISLAND
|| destId == SEAGALLOP_SEVEN_ISLAND))
return 5;
@ -495,8 +500,8 @@ u8 GetSeagallopNumber(void)
bool8 IsPlayerLeftOfVermilionSailor(void)
{
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(MAP_VERMILION_CITY)
&& gSaveBlock1Ptr->location.mapNum == MAP_NUM(MAP_VERMILION_CITY)
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(MAP_VERMILION_CITY)
&& gSaveBlock1Ptr->location.mapNum == MAP_NUM(MAP_VERMILION_CITY)
&& gSaveBlock1Ptr->pos.x < 24)
return TRUE;

View File

@ -2255,10 +2255,21 @@ void DecompressGlyph_Small(u16 glyphId, bool32 isJapanese)
}
else
{
glyphs = gFontSmallLatinGlyphs + (0x10 * glyphId);
DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop);
DecompressGlyphTile(glyphs + 0x8, gCurGlyph.gfxBufferBottom);
glyphs = gFontSmallLatinGlyphs + (0x20 * glyphId);
gCurGlyph.width = gFontSmallLatinGlyphWidths[glyphId];
if (gCurGlyph.width <= 8)
{
DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop);
DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom);
}
else
{
DecompressGlyphTile(glyphs, gCurGlyph.gfxBufferTop);
DecompressGlyphTile(glyphs + 0x8, gCurGlyph.gfxBufferTop + 8);
DecompressGlyphTile(glyphs + 0x10, gCurGlyph.gfxBufferBottom);
DecompressGlyphTile(glyphs + 0x18, gCurGlyph.gfxBufferBottom + 8);
}
gCurGlyph.height = 13;
}
}