Skip to content

Commit

Permalink
Improve mobile-related labels (pret#1061)
Browse files Browse the repository at this point in the history
  • Loading branch information
SatoMew authored and Idain committed Sep 12, 2023
1 parent 1550226 commit bdc7a15
Show file tree
Hide file tree
Showing 23 changed files with 117 additions and 120 deletions.
6 changes: 3 additions & 3 deletions constants/battle_tower_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ DEF BATTLE_TOWER_STRUCT_LENGTH EQU NAME_LENGTH + BATTLETOWER_PARTY_LENGTH * NICK
const BATTLETOWERACTION_LOADLEVELGROUP
const BATTLETOWERACTION_CHECKSAVEFILEISYOURS
const BATTLETOWERACTION_0A
const BATTLETOWERACTION_CHECKMOBILEEVENT
const BATTLETOWERACTION_GSBALL
const BATTLETOWERACTION_0C ; more time stuff in SRAM bank 5
const BATTLETOWERACTION_0D ; more time stuff in SRAM bank 5
const BATTLETOWERACTION_EGGTICKET
Expand All @@ -43,8 +43,8 @@ DEF BATTLE_TOWER_STRUCT_LENGTH EQU NAME_LENGTH + BATTLETOWER_PARTY_LENGTH * NICK
const BATTLETOWERACTION_SAVEOPTIONS

; BattleTowerAction return values
; - from BATTLETOWERACTION_CHECKMOBILEEVENT
DEF MOBILE_EVENT_OBJECT_GS_BALL EQU $b
; - from BATTLETOWERACTION_GSBALL
DEF GS_BALL_AVAILABLE EQU $b

; BattleTowerText arguments (see engine/events/battle_tower/trainer_text.asm)
const_def 1
Expand Down
2 changes: 1 addition & 1 deletion constants/engine_flags.asm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
const ENGINE_CAUGHT_POKERUS
const ENGINE_ROCKET_SIGNAL_ON_CH20
const ENGINE_CREDITS_SKIP
const ENGINE_MAIN_MENU_MOBILE_CHOICES
const ENGINE_MOBILE_SYSTEM ; unused
; wStatusFlags2
const ENGINE_BUG_CONTEST_TIMER
const ENGINE_SAFARI_ZONE
Expand Down
2 changes: 1 addition & 1 deletion constants/event_flags.asm
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@
const EVENT_MET_BUENA
const EVENT_GOT_ODD_EGG
const_skip ; unused
const EVENT_GOT_GS_BALL_FROM_POKECOM_CENTER
const EVENT_GOT_GS_BALL_FROM_GOLDENROD_POKEMON_CENTER
; Unused: next 167 events

const_next 1000
Expand Down
2 changes: 1 addition & 1 deletion data/events/special_pointers.asm
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ SpecialsPointers::
add_special StubbedTrainerRankings_Healings
add_special RefreshSprites
add_special Function1037c2
add_special Mobile_DummyReturnFalse
add_special CheckMobileAdapterStatusSpecial
add_special Function103780
add_special Function10387b
add_special AskRememberPassword
Expand Down
4 changes: 2 additions & 2 deletions engine/battle/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -8350,7 +8350,7 @@ CheckPayDay:

ShowLinkBattleParticipantsAfterEnd:
farcall StubbedTrainerRankings_LinkBattles
farcall BackupMobileEventIndex
farcall BackupGSBallFlag
ld a, [wCurOTMon]
ld hl, wOTPartyMon1Status
call GetPartyLocation
Expand Down Expand Up @@ -8396,7 +8396,7 @@ DisplayLinkBattleResult:
.store_result
hlcoord 6, 8
call PlaceString
farcall BackupMobileEventIndex
farcall BackupGSBallFlag
ld c, 200
call DelayFrames

Expand Down
8 changes: 4 additions & 4 deletions engine/events/battle_tower/battle_tower.asm
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ BattleTowerAction:
dw LoadBattleTowerLevelGroup
dw BattleTower_CheckSaveFileExistsAndIsYours
dw BattleTowerAction_0A
dw CheckMobileEventIndex
dw BattleTowerAction_GSBall
dw BattleTowerAction_0C
dw BattleTowerAction_0D
dw BattleTowerAction_EggTicket
Expand Down Expand Up @@ -1174,10 +1174,10 @@ BattleTowerAction_0A:
call MaxVolume
ret

CheckMobileEventIndex: ; something to do with GS Ball
ld a, BANK(sMobileEventIndex)
BattleTowerAction_GSBall:
ld a, BANK(sGSBallFlag)
call OpenSRAM
ld a, [sMobileEventIndex]
ld a, [sGSBallFlag]
ld [wScriptVar], a
call CloseSRAM
ret
Expand Down
2 changes: 1 addition & 1 deletion engine/link/link.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2034,7 +2034,7 @@ LinkTrade:
.save
farcall SaveAfterLinkTrade
farcall StubbedTrainerRankings_Trades
farcall BackupMobileEventIndex
farcall BackupGSBallFlag
ld c, 40
call DelayFrames
hlcoord 0, 12
Expand Down
4 changes: 2 additions & 2 deletions engine/link/mystery_gift.asm
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ endc
cp RESERVED_GAME_VERSION
jr z, .skip_append_save
call .SaveMysteryGiftTrainerName
farcall RestoreMobileEventIndex
farcall RestoreGSBallFlag
farcall StubbedTrainerRankings_MysteryGift
farcall BackupMobileEventIndex
farcall BackupGSBallFlag
.skip_append_save
ld a, [wMysteryGiftPartnerSentDeco]
and a
Expand Down
18 changes: 7 additions & 11 deletions engine/menus/intro_menu.asm
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ NewGame:
ld [wDebugFlags], a
call ResetWRAM
call NewGame_ClearTilemapEtc
call AreYouABoyOrAreYouAGirl
call PlayerProfileSetup
call OakSpeech
call InitializeWorld

Expand All @@ -77,15 +77,14 @@ NewGame:
ldh [hMapEntryMethod], a
jp FinishContinueFunction

AreYouABoyOrAreYouAGirl:
farcall Mobile_AlwaysReturnNotCarry ; mobile
PlayerProfileSetup:
farcall CheckMobileAdapterStatus
jr c, .ok
farcall InitGender
ret

.ok
ld c, 0
farcall InitMobileProfile ; mobile
farcall InitMobileProfile
ret

if DEF(_DEBUG)
Expand Down Expand Up @@ -220,7 +219,7 @@ endc

farcall DeletePartyMonMail

farcall DeleteMobileEventIndex
farcall ClearGSBallFlag

call ResetGameTime
ret
Expand Down Expand Up @@ -400,12 +399,9 @@ PostCreditsSpawn:
ldh [hMapEntryMethod], a
ret

Continue_MobileAdapterMenu:
farcall Mobile_AlwaysReturnNotCarry ; mobile check
Continue_MobileAdapterMenu: ; unused
farcall CheckMobileAdapterStatus
ret nc

; the rest of this stuff is never reached because
; the previous function returns with carry not set
ld hl, wd479
bit 1, [hl]
ret nz
Expand Down
32 changes: 16 additions & 16 deletions engine/menus/save.asm
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ MoveMonWOMail_InsertMon_SaveGame:
call SaveBackupPokemonData
call SaveBackupChecksum
farcall BackupPartyMonMail
farcall BackupMobileEventIndex
farcall BackupGSBallFlag
farcall SaveRTC
call LoadBox
call ResumeGameLogic
Expand Down Expand Up @@ -161,17 +161,17 @@ AddHallOfFameEntry:
ld bc, wHallOfFamePokemonListEnd - wHallOfFamePokemonList + 1
call CopyBytes
call CloseSRAM
; This vc_hook causes the Virtual Console to set [sMobileEventIndex] and [sMobileEventIndexBackup]
; to MOBILE_EVENT_OBJECT_GS_BALL, which enables you to get the GS Ball, take it to Kurt, and
; encounter Celebi. It assumes that sMobileEventIndex and sMobileEventIndexBackup are at their
; This vc_hook causes the Virtual Console to set [sGSBallFlag] and [sGSBallFlagBackup]
; to GS_BALL_AVAILABLE, which enables you to get the GS Ball, take it to Kurt, and
; encounter Celebi. It assumes that sGSBallFlag and sGSBallFlagBackup are at their
; original addresses.
vc_hook Enable_GS_Ball_mobile_event
vc_assert BANK(sMobileEventIndex) == $1 && sMobileEventIndex == $be3c, \
"sMobileEventIndex is no longer located at 01:be3c."
vc_assert BANK(sMobileEventIndexBackup) == $1 && sMobileEventIndexBackup == $be44, \
"sMobileEventIndexBackup is no longer located at 01:be44."
vc_assert MOBILE_EVENT_OBJECT_GS_BALL == $0b, \
"MOBILE_EVENT_OBJECT_GS_BALL is no longer equal to $0b."
vc_assert BANK(sGSBallFlag) == $1 && sGSBallFlag == $be3c, \
"sGSBallFlag is no longer located at 01:be3c."
vc_assert BANK(sGSBallFlagBackup) == $1 && sGSBallFlagBackup == $be44, \
"sGSBallFlagBackup is no longer located at 01:be44."
vc_assert GS_BALL_AVAILABLE == $b, \
"GS_BALL_AVAILABLE is no longer equal to $b."
ret

SaveGameData:
Expand Down Expand Up @@ -281,7 +281,7 @@ _SaveGameData:
call SaveBackupChecksum
call UpdateStackTop
farcall BackupPartyMonMail
farcall BackupMobileEventIndex
farcall BackupGSBallFlag
farcall SaveRTC
ld a, BANK(sBattleTowerChallengeState)
call OpenSRAM
Expand Down Expand Up @@ -459,11 +459,11 @@ Function14d83: ; unreferenced
call CloseSRAM
ret

Function14d93: ; unreferenced
ld a, BANK(s7_a000) ; MBC30 bank used by JP Crystal; inaccessible by MBC3
DisableMobileStadium: ; unreferenced
ld a, BANK(sMobileStadiumFlag)
call OpenSRAM
xor a
ld [s7_a000], a ; address of MBC30 bank
ld [sMobileStadiumFlag], a
call CloseSRAM
ret

Expand Down Expand Up @@ -600,7 +600,7 @@ TryLoadSaveFile:
call LoadPokemonData
call LoadBox
farcall RestorePartyMonMail
farcall RestoreMobileEventIndex
farcall RestoreGSBallFlag
farcall RestoreMysteryGift
call ValidateBackupSave
call SaveBackupOptions
Expand All @@ -617,7 +617,7 @@ TryLoadSaveFile:
call LoadBackupPokemonData
call LoadBox
farcall RestorePartyMonMail
farcall RestoreMobileEventIndex
farcall RestoreGSBallFlag
farcall RestoreMysteryGift
call ValidateSave
call SaveOptions
Expand Down
2 changes: 1 addition & 1 deletion maps/CeruleanPokecenter1F.asm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ CeruleanPokecenter1FNurseScript:
jumpstd PokecenterNurseScript

CeruleanPokecenter1FSuperNerdScript:
special Mobile_DummyReturnFalse
special CheckMobileAdapterStatusSpecial
iftrue .mobile
jumptextfaceplayer CeruleanPokecenter1FSuperNerdText

Expand Down
2 changes: 1 addition & 1 deletion maps/EcruteakPokecenter1F.asm
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ EcruteakPokecenter1FNurseScript:
jumpstd PokecenterNurseScript

EcruteakPokecenter1FPokefanMScript:
special Mobile_DummyReturnFalse
special CheckMobileAdapterStatusSpecial
iftrue .mobile
jumptextfaceplayer EcruteakPokecenter1FPokefanMText

Expand Down
2 changes: 1 addition & 1 deletion maps/ElmsLab.asm
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ ElmAfterTheftScript:
writetext ElmAfterTheftText5
promptbutton
setevent EVENT_GAVE_MYSTERY_EGG_TO_ELM
setflag ENGINE_MAIN_MENU_MOBILE_CHOICES
setflag ENGINE_MOBILE_SYSTEM
setmapscene ROUTE_29, SCENE_ROUTE29_CATCH_TUTORIAL
clearevent EVENT_ROUTE_30_YOUNGSTER_JOEY
setevent EVENT_ROUTE_30_BATTLE
Expand Down
2 changes: 1 addition & 1 deletion maps/FastShipCabins_SW_SSW_NW.asm
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ TrainerGuitaristClyde:

.Script:
endifjustbattled
special Mobile_DummyReturnFalse
special CheckMobileAdapterStatusSpecial
iftrue .mobile
opentext
writetext GuitaristClydeAfterBattleText
Expand Down
42 changes: 21 additions & 21 deletions maps/GoldenrodPokecenter1F.asm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
object_const_def
const GOLDENRODPOKECENTER1F_NURSE
const GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST
const GOLDENRODPOKECENTER1F_PCC_TRADE_CORNER_RECEPTIONIST
const GOLDENRODPOKECENTER1F_GAMEBOY_KID
const GOLDENRODPOKECENTER1F_LASS
const GOLDENRODPOKECENTER1F_POKEFAN_F
Expand All @@ -15,65 +15,65 @@ GoldenrodPokecenter1FNurseScript:
jumpstd PokecenterNurseScript

GoldenrodPokecenter1F_GSBallSceneLeft:
setval BATTLETOWERACTION_CHECKMOBILEEVENT
setval BATTLETOWERACTION_GSBALL
special BattleTowerAction
ifequal MOBILE_EVENT_OBJECT_GS_BALL, .gsball
ifequal GS_BALL_AVAILABLE, .gsball
end

.gsball
checkevent EVENT_GOT_GS_BALL_FROM_POKECOM_CENTER
checkevent EVENT_GOT_GS_BALL_FROM_GOLDENROD_POKEMON_CENTER
iftrue .cancel
playsound SFX_EXIT_BUILDING
moveobject GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST, 0, 7
disappear GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST
appear GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST
moveobject GOLDENRODPOKECENTER1F_PCC_TRADE_CORNER_RECEPTIONIST, 0, 7
disappear GOLDENRODPOKECENTER1F_PCC_TRADE_CORNER_RECEPTIONIST
appear GOLDENRODPOKECENTER1F_PCC_TRADE_CORNER_RECEPTIONIST
playmusic MUSIC_SHOW_ME_AROUND
applymovement GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST, GoldenrodPokeCenter1FLinkReceptionistApproachPlayerAtLeftDoorwayTileMovement
applymovement GOLDENRODPOKECENTER1F_PCC_TRADE_CORNER_RECEPTIONIST, GoldenrodPokeCenter1FLinkReceptionistApproachPlayerAtLeftDoorwayTileMovement
turnobject PLAYER, UP
opentext
writetext GoldenrodPokeCenter1FLinkReceptionistPleaseAcceptGSBallText
waitbutton
verbosegiveitem GS_BALL
setevent EVENT_GOT_GS_BALL_FROM_POKECOM_CENTER
setevent EVENT_GOT_GS_BALL_FROM_GOLDENROD_POKEMON_CENTER
setevent EVENT_CAN_GIVE_GS_BALL_TO_KURT
writetext GoldenrodPokeCenter1FLinkReceptionistPleaseDoComeAgainText
waitbutton
closetext
applymovement GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST, GoldenrodPokeCenter1FLinkReceptionistWalkToStairsFromLeftDoorwayTileMovement
applymovement GOLDENRODPOKECENTER1F_PCC_TRADE_CORNER_RECEPTIONIST, GoldenrodPokeCenter1FLinkReceptionistWalkToStairsFromLeftDoorwayTileMovement
special RestartMapMusic
disappear GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST
disappear GOLDENRODPOKECENTER1F_PCC_TRADE_CORNER_RECEPTIONIST
playsound SFX_EXIT_BUILDING
.cancel
end

GoldenrodPokecenter1F_GSBallSceneRight:
setval BATTLETOWERACTION_CHECKMOBILEEVENT
setval BATTLETOWERACTION_GSBALL
special BattleTowerAction
ifequal MOBILE_EVENT_OBJECT_GS_BALL, .gsball
ifequal GS_BALL_AVAILABLE, .gsball
end

.gsball
checkevent EVENT_GOT_GS_BALL_FROM_POKECOM_CENTER
checkevent EVENT_GOT_GS_BALL_FROM_GOLDENROD_POKEMON_CENTER
iftrue .cancel
playsound SFX_EXIT_BUILDING
moveobject GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST, 0, 7
disappear GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST
appear GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST
moveobject GOLDENRODPOKECENTER1F_PCC_TRADE_CORNER_RECEPTIONIST, 0, 7
disappear GOLDENRODPOKECENTER1F_PCC_TRADE_CORNER_RECEPTIONIST
appear GOLDENRODPOKECENTER1F_PCC_TRADE_CORNER_RECEPTIONIST
playmusic MUSIC_SHOW_ME_AROUND
applymovement GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST, GoldenrodPokeCenter1FLinkReceptionistApproachPlayerAtRightDoorwayTileMovement
applymovement GOLDENRODPOKECENTER1F_PCC_TRADE_CORNER_RECEPTIONIST, GoldenrodPokeCenter1FLinkReceptionistApproachPlayerAtRightDoorwayTileMovement
turnobject PLAYER, UP
opentext
writetext GoldenrodPokeCenter1FLinkReceptionistPleaseAcceptGSBallText
waitbutton
verbosegiveitem GS_BALL
setevent EVENT_GOT_GS_BALL_FROM_POKECOM_CENTER
setevent EVENT_GOT_GS_BALL_FROM_GOLDENROD_POKEMON_CENTER
setevent EVENT_CAN_GIVE_GS_BALL_TO_KURT
writetext GoldenrodPokeCenter1FLinkReceptionistPleaseDoComeAgainText
waitbutton
closetext
applymovement GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST, GoldenrodPokeCenter1FLinkReceptionistWalkToStairsFromRightDoorwayTileMovement
applymovement GOLDENRODPOKECENTER1F_PCC_TRADE_CORNER_RECEPTIONIST, GoldenrodPokeCenter1FLinkReceptionistWalkToStairsFromRightDoorwayTileMovement
special RestartMapMusic
disappear GOLDENRODPOKECENTER1F_LINK_RECEPTIONIST
disappear GOLDENRODPOKECENTER1F_PCC_TRADE_CORNER_RECEPTIONIST
playsound SFX_EXIT_BUILDING
.cancel
end
Expand Down
4 changes: 2 additions & 2 deletions maps/Pokecenter2F.asm
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ LinkReceptionistScript_Trade:
writetext Text_TradeReceptionistIntro
yesorno
iffalse .Cancel
special Mobile_DummyReturnFalse ; always returns false
special CheckMobileAdapterStatusSpecial
iffalse .NoMobile
writetext Text_TradeReceptionistMobile
special AskMobileOrCable
Expand Down Expand Up @@ -175,7 +175,7 @@ LinkReceptionistScript_Battle:
writetext Text_BattleReceptionistIntro
yesorno
iffalse .Cancel
special Mobile_DummyReturnFalse ; always returns false
special CheckMobileAdapterStatusSpecial
iffalse .NoMobile
writetext Text_BattleReceptionistMobile
special AskMobileOrCable
Expand Down
2 changes: 1 addition & 1 deletion maps/Route40.asm
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Route40Lass1Script:
jumptextfaceplayer Route40Lass1Text

Route40PokefanMScript:
special Mobile_DummyReturnFalse
special CheckMobileAdapterStatusSpecial
iftrue .mobile
jumptextfaceplayer Route40PokefanMText

Expand Down
Loading

0 comments on commit bdc7a15

Please sign in to comment.