From 047effba941ca96bf0b3d16fc2ddef964e4f17d8 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 20 Dec 2015 12:54:08 -0500 Subject: [PATCH] Menu joy flags; started with link address space --- battle/core.asm | 2 +- constants/pokemon_constants.asm | 1 + engine/learn.asm | 2 +- engine/link.asm | 335 +++++------ engine/main_menu.asm | 989 ++------------------------------ engine/menu.asm | 20 +- engine/party_menu.asm | 8 +- engine/scrolling_menu.asm | 51 +- engine/tmhm2.asm | 4 +- home/menu.asm | 64 +-- home/serial.asm | 16 +- main.asm | 17 +- misc/mobile_12_2.asm | 2 +- misc/mobile_22.asm | 4 +- misc/mobile_40.asm | 16 +- misc/mobile_5b.asm | 2 +- misc/mobile_menu.asm | 882 ++++++++++++++++++++++++++++ wram.asm | 71 ++- 18 files changed, 1279 insertions(+), 1207 deletions(-) create mode 100755 misc/mobile_menu.asm diff --git a/battle/core.asm b/battle/core.asm index e5ee3c1be..37136e814 100644 --- a/battle/core.asm +++ b/battle/core.asm @@ -5694,7 +5694,7 @@ MoveSelectionScreen: ; 3e4bc .okay ld a, b - ld [w2DMenuFlags4], a + ld [wMenuJoypadFilter], a ld a, c ld [w2DMenuFlags1], a xor a diff --git a/constants/pokemon_constants.asm b/constants/pokemon_constants.asm index 654459c44..5041f7064 100644 --- a/constants/pokemon_constants.asm +++ b/constants/pokemon_constants.asm @@ -291,6 +291,7 @@ MON_SAT EQUS "(PartyMon1SpclAtk - PartyMon1)" MON_SDF EQUS "(PartyMon1SpclDef - PartyMon1)" BOXMON_STRUCT_LENGTH EQUS "(PartyMon1End - PartyMon1)" PARTYMON_STRUCT_LENGTH EQUS "(PartyMon1StatsEnd - PartyMon1)" +REDMON_STRUCT_LENGTH EQU 44 const_value SET 1 const MONMENU_CUT ; 1 diff --git a/engine/learn.asm b/engine/learn.asm index 8520a29f7..16f7474c3 100755 --- a/engine/learn.asm +++ b/engine/learn.asm @@ -158,7 +158,7 @@ ForgetMove: ; 65d3 ld [wMenuCursorY], a ld [wMenuCursorX], a ld a, $3 - ld [w2DMenuFlags4], a + ld [wMenuJoypadFilter], a ld a, $20 ld [w2DMenuFlags1], a xor a diff --git a/engine/link.asm b/engine/link.asm index b6bbee66b..1eeb863e0 100755 --- a/engine/link.asm +++ b/engine/link.asm @@ -17,13 +17,13 @@ LinkCommunications: ; 28000 callba Function16d69a call WaitBGMap2 hlcoord 3, 8 - ld b, $2 - ld c, $c + ld b, 2 + ld c, 12 ld d, h ld e, l callba Function4d35b hlcoord 4, 10 - ld de, String28419 + ld de, String_PleaseWait call PlaceString call Function28eff call WaitBGMap2 @@ -33,11 +33,11 @@ LinkCommunications: ; 28000 ld [hl], $50 ld a, [wLinkMode] cp LINK_TIMECAPSULE - jp nz, Function28177 + jp nz, Gen2ToGen2LinkComms -Function2805d: ; 2805d - call Function28426 - call Function28499 +TimeCapsule: ; 2805d + call ClearLinkData + call Link_PrepPartyData_Gen1 call Function28434 xor a ld [wPlayerLinkAction], a @@ -76,9 +76,9 @@ Function2805d: ; 2805d call Function75f ld a, $fe ld [de], a - ld hl, OverworldMap - ld de, wd26b - ld bc, $1a8 + ld hl, wLinkData + ld de, OTPlayerName + ld bc, 9 + NAME_LENGTH + 1 + PARTY_LENGTH + 1 + PARTY_LENGTH * REDMON_STRUCT_LENGTH + 2 * (PARTY_LENGTH * NAME_LENGTH) ; $1a8 call Function75f ld a, $fe ld [de], a @@ -102,7 +102,7 @@ Function2805d: ; 2805d jp z, Function28b22 cp $7 jp nc, Function28b22 - ld de, OverworldMap + ld de, wLinkData ld bc, $1a2 call Function2879e ld de, wPlayerTrademonSpecies @@ -135,7 +135,7 @@ Function2805d: ; 2805d ld hl, wc90f dec c jr nz, .asm_280fe - ld hl, OverworldMap + ld hl, wLinkData ld de, wd26b ld bc, NAME_LENGTH call CopyBytes @@ -177,9 +177,9 @@ Function2805d: ; 2805d jp Function287e3 ; 28177 -Function28177: ; 28177 - call Function28426 - call Function28595 +Gen2ToGen2LinkComms: ; 28177 + call ClearLinkData + call Link_PrepPartyData_Gen2 call Function28434 call Function29dba ld a, [ScriptVar] @@ -187,8 +187,8 @@ Function28177: ; 28177 jp z, Function283b2 ld a, [hLinkPlayerNumber] cp $2 - jr nz, .asm_281ae - ld c, $3 + jr nz, .Player2 + ld c, 3 call DelayFrames xor a ld [hSerialSend], a @@ -204,10 +204,10 @@ Function28177: ; 28177 ld a, $81 ld [rSC], a -.asm_281ae +.Player2 ld de, MUSIC_NONE call PlayMusic - ld c, $3 + ld c, 3 call DelayFrames xor a ld [rIF], a @@ -219,7 +219,7 @@ Function28177: ; 28177 call Function75f ld a, $fe ld [de], a - ld hl, OverworldMap + ld hl, wLinkData ld de, wd26b ld bc, $1c2 call Function75f @@ -247,7 +247,7 @@ Function28177: ; 28177 call Function287ab ld hl, wd26b call Function287ca - ld de, OverworldMap + ld de, wLinkData ld bc, $1b9 call Function2879e ld de, wPlayerTrademonSpecies @@ -391,7 +391,7 @@ Function28177: ; 28177 ld [de], a .asm_282fe - ld hl, OverworldMap + ld hl, wLinkData ld de, wd26b ld bc, NAME_LENGTH call CopyBytes @@ -470,21 +470,21 @@ Function28177: ; 28177 ; 283b2 Function283b2: ; 283b2 - ld de, UnknownText_0x283ed + ld de, .TooMuchTimeHasElapsed ld b, $a -.asm_283b7 +.loop call DelayFrame call LinkDataReceived dec b - jr nz, .asm_283b7 + jr nz, .loop xor a ld [hld], a ld [hl], a ld [hVBlank], a push de hlcoord 0, 12 - ld b, $4 - ld c, $12 + ld b, 4 + ld c, 18 push de ld d, h ld e, l @@ -501,7 +501,7 @@ Function283b2: ; 283b2 ret ; 283ed -UnknownText_0x283ed: ; 0x283ed +.TooMuchTimeHasElapsed: ; 0x283ed ; Too much time has elapsed. Please try again. text_jump UnknownText_0x1c4183 db "@" @@ -541,20 +541,20 @@ Function283f2: ; 283f2 ret ; 28419 -String28419: ; 28419 +String_PleaseWait: ; 28419 db "PLEASE WAIT!@" ; 28426 -Function28426: ; 28426 - ld hl, OverworldMap - lb bc, 5, SCREEN_WIDTH -.asm_2842c +ClearLinkData: ; 28426 + ld hl, wLinkData + ld bc, wLinkDataEnd - wLinkData +.loop xor a ld [hli], a dec bc ld a, b or c - jr nz, .asm_2842c + jr nz, .loop ret ; 28434 @@ -633,15 +633,15 @@ endr ret ; 28499 -Function28499: ; 28499 - ld de, OverworldMap +Link_PrepPartyData_Gen1: ; 28499 + ld de, wLinkData ld a, $fd ld b, $6 -.asm_284a0 +.loop1 ld [de], a inc de dec b - jr nz, .asm_284a0 + jr nz, .loop1 ld hl, PlayerName ld bc, NAME_LENGTH call CopyBytes @@ -650,10 +650,10 @@ Function28499: ; 28499 ld a, [hli] ld [de], a inc de -.asm_284b5 +.loop2 ld a, [hli] - cp $ff - jr z, .asm_284ce + cp -1 + jr z, .done_party ld [wd265], a push hl push de @@ -663,34 +663,34 @@ Function28499: ; 28499 ld a, [wd265] ld [de], a inc de - jr .asm_284b5 + jr .loop2 -.asm_284ce +.done_party ld [de], a pop de - ld hl, $8 + ld hl, 1 + PARTY_LENGTH + 1 add hl, de ld d, h ld e, l ld hl, PartyMon1Species - ld c, $6 -.asm_284db + ld c, PARTY_LENGTH +.mon_loop push bc - call Function284f6 + call .ConvertPartyStruct2to1 ld bc, PARTYMON_STRUCT_LENGTH add hl, bc pop bc dec c - jr nz, .asm_284db + jr nz, .mon_loop ld hl, PartyMonOT - call .asm_284f0 + call .copy_ot_nicks ld hl, PartyMonNicknames -.asm_284f0 - ld bc, $42 +.copy_ot_nicks + ld bc, PARTY_LENGTH * NAME_LENGTH jp CopyBytes ; 284f6 -Function284f6: ; 284f6 +.ConvertPartyStruct2to1: ; 284f6 ld b, h ld c, l push de @@ -703,7 +703,7 @@ Function284f6: ; 284f6 ld a, [wd265] ld [de], a inc de - ld hl, $22 + ld hl, MON_HP add hl, bc ld a, [hli] ld [de], a @@ -714,26 +714,26 @@ Function284f6: ; 284f6 xor a ld [de], a inc de - ld hl, $20 + ld hl, MON_STATUS add hl, bc ld a, [hl] ld [de], a inc de ld a, [bc] - cp $51 - jr z, .asm_28528 - cp $52 - jr nz, .asm_28530 + cp MAGNEMITE + jr z, .steel_type + cp MAGNETON + jr nz, .skip_steel -.asm_28528 - ld a, $17 +.steel_type + ld a, ELECTRIC ld [de], a inc de ld [de], a inc de - jr .asm_28544 + jr .done_steel -.asm_28530 +.skip_steel push bc dec a ld hl, BaseData + 7 ; type @@ -744,15 +744,15 @@ Function284f6: ; 284f6 call FarCopyBytes pop bc -.asm_28544 +.done_steel push bc - ld hl, $1 + ld hl, MON_ITEM add hl, bc - ld bc, $1a + ld bc, MON_HAPPINESS - MON_ITEM call CopyBytes pop bc - ld hl, $1f + ld hl, MON_LEVEL add hl, bc ld a, [hl] ld [de], a @@ -760,9 +760,9 @@ Function284f6: ; 284f6 inc de push bc - ld hl, $24 + ld hl, MON_MAXHP add hl, bc - ld bc, 8 + ld bc, MON_SAT - MON_MAXHP call CopyBytes pop bc @@ -781,19 +781,19 @@ Function284f6: ; 284f6 ld [BaseSpecialAttack], a pop bc - ld hl, $a + ld hl, MON_EXP + 2 add hl, bc - ld c, $5 - ld b, $1 + ld c, STAT_SATK + ld b, TRUE predef CalcPkmnStatC pop bc pop de - ld a, [$ffb5] + ld a, [hQuotient + 1] ld [de], a inc de - ld a, [$ffb6] + ld a, [hQuotient + 2] ld [de], a inc de ld h, b @@ -801,10 +801,10 @@ Function284f6: ; 284f6 ret ; 28595 -Function28595: ; 28595 - ld de, wc800 - ld a, EGG - ld b, PARTY_LENGTH +Link_PrepPartyData_Gen2: ; 28595 + ld de, wLinkData + ld a, $fd + ld b, 6 .loop1 ld [de], a inc de @@ -966,7 +966,7 @@ Function2868a: ; 2868a ld [hli], a ld [hl], b ld hl, OTPartyMon1Species - ld c, $6 + ld c, PARTY_LENGTH .loop push bc call Function286ba @@ -977,10 +977,10 @@ Function2868a: ; 2868a lb bc, 1, 8 add hl, bc ld de, OTPartyMonOT - ld bc, $42 + ld bc, PARTY_LENGTH * NAME_LENGTH call CopyBytes ld de, OTPartyMonNicknames - ld bc, $42 + ld bc, PARTY_LENGTH * PKMN_NAME_LENGTH jp CopyBytes ; 286ba @@ -998,7 +998,7 @@ Function286ba: ; 286ba ld a, [wd265] ld [bc], a ld [CurSpecies], a - ld hl, $22 + ld hl, MON_HP add hl, bc ld a, [de] inc de @@ -1069,27 +1069,27 @@ Function286ba: ; 286ba ld e, l ld hl, $a add hl, bc - ld c, $5 - ld b, $1 + ld c, STAT_SATK + ld b, TRUE predef CalcPkmnStatC pop bc pop hl - ld a, [$ffb5] + ld a, [hQuotient + 1] ld [hli], a - ld a, [$ffb6] + ld a, [hQuotient + 2] ld [hli], a push hl push bc ld hl, $a add hl, bc - ld c, $6 - ld b, $1 + ld c, STAT_SDEF + ld b, TRUE predef CalcPkmnStatC pop bc pop hl - ld a, [$ffb5] + ld a, [hQuotient + 1] ld [hli], a - ld a, [$ffb6] + ld a, [hQuotient + 2] ld [hli], a push hl ld hl, $1b @@ -1150,16 +1150,16 @@ Function28771: ; 28771 ; 2879e Function2879e: ; 2879e -.asm_2879e +.loop ld a, [hli] cp $fe - jr z, .asm_2879e + jr z, .loop ld [de], a inc de dec bc ld a, b or c - jr nz, .asm_2879e + jr nz, .loop ret ; 287ab @@ -1171,39 +1171,39 @@ Function287ab: ; 287ab call Function287d8 ld de, LinkBattleRNs ld c, $a -.asm_287bb +.loop ld a, [hli] cp $fe - jr z, .asm_287bb + jr z, .loop cp $fd - jr z, .asm_287bb + jr z, .loop ld [de], a inc de dec c - jr nz, .asm_287bb + jr nz, .loop ret ; 287ca Function287ca: ; 287ca -.asm_287ca +.loop ld a, [hli] and a - jr z, .asm_287ca + jr z, .loop cp $fd - jr z, .asm_287ca + jr z, .loop cp $fe - jr z, .asm_287ca + jr z, .loop dec hl ret ; 287d8 Function287d8: ; 287d8 -.asm_287d8 +.loop ld a, [hli] cp $fd - jr z, .asm_287d8 + jr z, .loop cp $fe - jr z, .asm_287d8 + jr z, .loop dec hl ret ; 287e3 @@ -1226,19 +1226,19 @@ endr ; 28803 Function28803: ; 28803 - ld a, $1 + ld a, OTPARTYMON ld [MonType], a - ld a, $c1 - ld [w2DMenuFlags4], a + ld a, A_BUTTON | D_UP | D_DOWN + ld [wMenuJoypadFilter], a ld a, [OTPartyCount] ld [w2DMenuNumRows], a - ld a, $1 + ld a, 1 ld [w2DMenuNumCols], a - ld a, $9 + ld a, 9 ld [w2DMenuCursorInitY], a - ld a, $6 + ld a, 6 ld [w2DMenuCursorInitX], a - ld a, $1 + ld a, 1 ld [wMenuCursorX], a ld a, $10 ld [w2DMenuFlags3], a @@ -1293,17 +1293,17 @@ Function2888b: ; 2888b callba Function49856 xor a ld [MonType], a - ld a, $c1 - ld [w2DMenuFlags4], a + ld a, A_BUTTON | D_UP | D_DOWN + ld [wMenuJoypadFilter], a ld a, [PartyCount] ld [w2DMenuNumRows], a - ld a, $1 + ld a, 1 ld [w2DMenuNumCols], a - ld a, $1 + ld a, 1 ld [w2DMenuCursorInitY], a - ld a, $6 + ld a, 6 ld [w2DMenuCursorInitX], a - ld a, $1 + ld a, 1 ld [wMenuCursorX], a ld a, $10 ld [w2DMenuFlags3], a @@ -1376,8 +1376,8 @@ Function28926: ; 28926 ld a, [wMenuCursorY] push af hlcoord 0, 15 - ld b, $1 - ld c, $12 + ld b, 1 + ld c, 18 call Predef_LinkTextbox hlcoord 2, 16 ld de, String28ab4 @@ -1385,19 +1385,19 @@ Function28926: ; 28926 callba Function4d354 .asm_28946 - ld a, $7f + ld a, " " ldcoord_a 11, 16 - ld a, $13 - ld [w2DMenuFlags4], a - ld a, $1 + ld a, A_BUTTON | B_BUTTON | D_RIGHT + ld [wMenuJoypadFilter], a + ld a, 1 ld [w2DMenuNumRows], a - ld a, $1 + ld a, 1 ld [w2DMenuNumCols], a - ld a, $10 + ld a, 16 ld [w2DMenuCursorInitY], a - ld a, $1 + ld a, 1 ld [w2DMenuCursorInitX], a - ld a, $1 + ld a, 1 ld [wMenuCursorY], a ld [wMenuCursorX], a ld a, $20 @@ -1406,9 +1406,9 @@ Function28926: ; 28926 ld [w2DMenuFlags1], a ld [w2DMenuFlags2], a call ScrollingMenuJoypad - bit 4, a + bit D_RIGHT_F, a jr nz, .asm_2898d - bit 1, a + bit B_BUTTON_F, a jr z, .asm_289cd .asm_28983 pop af @@ -1417,19 +1417,19 @@ Function28926: ; 28926 jp Function2888b .asm_2898d - ld a, $7f + ld a, " " ldcoord_a 1, 16 - ld a, $23 - ld [w2DMenuFlags4], a - ld a, $1 + ld a, A_BUTTON | B_BUTTON | D_LEFT + ld [wMenuJoypadFilter], a + ld a, 1 ld [w2DMenuNumRows], a - ld a, $1 + ld a, 1 ld [w2DMenuNumCols], a - ld a, $10 + ld a, 16 ld [w2DMenuCursorInitY], a - ld a, $b + ld a, 11 ld [w2DMenuCursorInitX], a - ld a, $1 + ld a, 1 ld [wMenuCursorY], a ld [wMenuCursorX], a ld a, $20 @@ -1438,9 +1438,9 @@ Function28926: ; 28926 ld [w2DMenuFlags1], a ld [w2DMenuFlags2], a call ScrollingMenuJoypad - bit 5, a + bit D_LEFT_F, a jp nz, .asm_28946 - bit 1, a + bit B_BUTTON_F, a jr nz, .asm_28983 jr .asm_289fe @@ -1485,8 +1485,8 @@ Function28926: ; 28926 ld [wcf57], a ld [wOtherPlayerLinkAction], a hlcoord 0, 12 - ld b, $4 - ld c, $12 + ld b, 4 + ld c, 18 call Predef_LinkTextbox callba Function4d354 ld hl, UnknownText_0x28aaf @@ -1517,8 +1517,8 @@ Function28926: ; 28926 .asm_28a89 hlcoord 0, 12 - ld b, $4 - ld c, $12 + ld b, 4 + ld c, 18 call Predef_LinkTextbox hlcoord 1, 14 ld de, String28ece @@ -1526,7 +1526,7 @@ Function28926: ; 28926 ld a, $1 ld [wPlayerLinkAction], a callba Function16d6ce - ld c, $64 + ld c, 100 call DelayFrames jp Function287e3 ; 28aaf @@ -1557,45 +1557,45 @@ Function28ac9: ; 28ac9 push bc ld bc, NAME_LENGTH add hl, bc - ld [hl], $7f + ld [hl], " " pop bc pop hl Function28ade: ; 28ade -.asm_28ade - ld a, $ed +.loop1 + ld a, "▶" ldcoord_a 9, 17 -.asm_28ae3 +.loop2 call JoyTextDelay ld a, [hJoyLast] and a - jr z, .asm_28ae3 - bit 0, a - jr nz, .asm_28b0b + jr z, .loop2 + bit A_BUTTON_F, a + jr nz, .a_button push af ld a, " " ldcoord_a 9, 17 pop af - bit 6, a - jr z, .asm_28b03 + bit D_UP_F, a + jr z, .d_up ld a, [OTPartyCount] ld [wMenuCursorY], a jp Function28803 -.asm_28b03 +.d_up ld a, $1 ld [wMenuCursorY], a jp Function2888b -.asm_28b0b - ld a, $ec +.a_button + ld a, "▷" ldcoord_a 9, 17 ld a, $f ld [wPlayerLinkAction], a callba Function16d6ce ld a, [wOtherPlayerLinkMode] cp $f - jr nz, .asm_28ade + jr nz, .loop1 Function28b22: ; 28b22 call RotateThreePalettesRight @@ -1693,28 +1693,28 @@ Function28b87: ; 28b87 call PlaceWholeStringInBoxAtOnce call LoadStandardMenuDataHeader hlcoord 10, 7 - ld b, $3 - ld c, $7 + ld b, 3 + ld c, 7 call Predef_LinkTextbox ld de, String28eab hlcoord 12, 8 call PlaceString - ld a, $8 + ld a, 8 ld [w2DMenuCursorInitY], a - ld a, $b + ld a, 11 ld [w2DMenuCursorInitX], a - ld a, $1 + ld a, 1 ld [w2DMenuNumCols], a - ld a, $2 + ld a, 2 ld [w2DMenuNumRows], a xor a ld [w2DMenuFlags1], a ld [w2DMenuFlags2], a ld a, $20 ld [w2DMenuFlags3], a - ld a, $3 - ld [w2DMenuFlags4], a - ld a, $1 + ld a, A_BUTTON | B_BUTTON + ld [wMenuJoypadFilter], a + ld a, 1 ld [wMenuCursorY], a ld [wMenuCursorX], a callba Function4d354 @@ -1991,8 +1991,8 @@ Function28b87: ; 28b87 call DelayFrames ld a, [wLinkMode] cp LINK_TIMECAPSULE - jp z, Function2805d - jp Function28177 + jp z, TimeCapsule + jp Gen2ToGen2LinkComms ; 28ea3 Function28ea3: ; 28ea3 @@ -2593,5 +2593,6 @@ Special_CableClubCheckWhichChris: ; 29f47 ; 29f54 GFX_29f54: ; 29f54 +; unreferenced INCBIN "gfx/unknown/029f54.2bpp" ; 29fe4 diff --git a/engine/main_menu.asm b/engine/main_menu.asm index 6326b0b98..2012bf5ff 100755 --- a/engine/main_menu.asm +++ b/engine/main_menu.asm @@ -11,17 +11,17 @@ MainMenu: ; 49cdc call SetPalettes ld hl, GameTimerPause res 0, [hl] - call Function49da4 + call MainMenu_GetWhichMenu ld [wWhichIndexSet], a - call Function49e09 - ld hl, MenuDataHeader_0x49d14 + call MainMenu_PrintCurrentTimeAndDay + ld hl, .MenuDataHeader call LoadMenuDataHeader - call Function49de4 + call MainMenuJoypadLoop call WriteBackup jr c, .quit call ClearTileMap ld a, [MenuSelection] - ld hl, Jumptable_49d60 + ld hl, .Jumptable rst JumpTable jr MainMenu @@ -29,23 +29,23 @@ MainMenu: ; 49cdc ret ; 49d14 -MenuDataHeader_0x49d14: ; 49d14 +.MenuDataHeader: ; 49d14 db $40 ; flags db 00, 00 ; start coords db 07, 16 ; end coords - dw MenuData2_0x49d1c + dw .MenuData2 db 1 ; default option ; 49d1c -MenuData2_0x49d1c: ; 49d1c +.MenuData2: ; 49d1c db $80 ; flags db 0 ; items dw MainMenuItems dw PlaceMenuStrings - dw MainMenuText + dw .Strings ; 49d20 -MainMenuText: ; 49d24 +.Strings: ; 49d24 db "CONTINUE@" db "NEW GAME@" db "OPTION@" @@ -53,13 +53,14 @@ MainMenuText: ; 49d24 db "MOBILE@" db "MOBILE STUDIUM@" -Jumptable_49d60: ; 0x49d60 - dw MainMenu_Continue - dw MainMenu_NewGame - dw MainMenu_Options - dw MainMenu_MysteryGift - dw MainMenu_Mobile - dw MainMenu_MobileStudium +.Jumptable: ; 0x49d60 + jumptable_start + jumptable MainMenu_Continue + jumptable MainMenu_NewGame + jumptable MainMenu_Options + jumptable MainMenu_MysteryGift + jumptable MainMenu_Mobile + jumptable MainMenu_MobileStudium ; 0x49d6c CONTINUE EQU 0 @@ -146,14 +147,14 @@ StudiumMenu: ; 0x49d9e db -1 -Function49da4: ; 49da4 +MainMenu_GetWhichMenu: ; 49da4 nop nop nop ld a, [wSaveFileExists] and a jr nz, .next - ld a, $0 + ld a, $0 ; New Game ret .next @@ -164,12 +165,12 @@ Function49da4: ; 49da4 ld a, BANK(sNumDailyMysteryGiftPartnerIDs) call GetSRAMBank ld a, [sNumDailyMysteryGiftPartnerIDs] - cp $ff + cp -1 call CloseSRAM - jr nz, .done + jr nz, .mystery_gift ld a, [StatusFlags] bit 7, a - ld a, $1 + ld a, $1 ; Continue jr z, .ok jr .ok @@ -177,10 +178,10 @@ Function49da4: ; 49da4 jr .ok2 .ok2 - ld a, $1 + ld a, $1 ; Continue ret -.done +.mystery_gift ld a, [StatusFlags] bit 7, a jr z, .ok3 @@ -190,47 +191,47 @@ Function49da4: ; 49da4 jr .ok4 .ok4 - ld a, $6 + ld a, $6 ; Mystery Gift ret ; 49de4 -Function49de4: ; 49de4 +MainMenuJoypadLoop: ; 49de4 call SetUpMenu -.asm_49de7 - call Function49e09 +.loop + call MainMenu_PrintCurrentTimeAndDay ld a, [w2DMenuFlags1] set 5, a ld [w2DMenuFlags1], a call Function1f1a ld a, [wMenuJoypad] - cp $2 - jr z, .asm_49e07 - cp $1 - jr z, .asm_49e02 - jr .asm_49de7 + cp B_BUTTON + jr z, .b_button + cp A_BUTTON + jr z, .a_button + jr .loop -.asm_49e02 +.a_button call PlayClickSFX and a ret -.asm_49e07 +.b_button scf ret ; 49e09 -Function49e09: ; 49e09 +MainMenu_PrintCurrentTimeAndDay: ; 49e09 ld a, [wSaveFileExists] and a ret z xor a ld [hBGMapMode], a - call Function49e27 + call .PlaceBox ld hl, Options ld a, [hl] push af - set 4, [hl] - call Function49e3d + set NO_TEXT_SCROLL, [hl] + call .PlaceTime pop af ld [Options], a ld a, $1 @@ -239,34 +240,34 @@ Function49e09: ; 49e09 ; 49e27 -Function49e27: ; 49e27 +.PlaceBox: ; 49e27 call CheckRTCStatus and $80 - jr nz, .asm_49e39 + jr nz, .TimeFail hlcoord 0, 14 - ld b, $2 - ld c, $12 + ld b, 2 + ld c, 18 call TextBox ret -.asm_49e39 +.TimeFail call SpeechTextBox ret ; 49e3d -Function49e3d: ; 49e3d +.PlaceTime: ; 49e3d ld a, [wSaveFileExists] and a ret z call CheckRTCStatus and $80 - jp nz, Function49e75 + jp nz, .PrintTimeNotSet call UpdateTime call GetWeekday ld b, a decoord 1, 15 - call Function49e91 + call .PlaceCurrentDay decoord 4, 16 ld a, [hHours] ld c, a @@ -277,13 +278,13 @@ Function49e3d: ; 49e3d lb bc, PRINTNUM_LEADINGZEROS | 1, 2 call PrintNum ret -; 49e70 -; 49e70 +.min +; unreferenced db "min.@" ; 49e75 -Function49e75: ; 49e75 +.PrintTimeNotSet: ; 49e75 hlcoord 1, 14 ld de, .TimeNotSet call PlaceString @@ -294,12 +295,13 @@ Function49e75: ; 49e75 db "TIME NOT SET@" ; 49e8c -UnknownText_0x49e8c: ; 49e8c +.UnusedText ; 49e8c + ; Clock time unknown text_jump UnknownText_0x1c5182 db "@" ; 49e91 -Function49e91: ; 49e91 +.PlaceCurrentDay: ; 49e91 push de ld hl, .Days ld a, b @@ -357,886 +359,3 @@ MainMenu_MysteryGift: ; 49ef5 callba MysteryGift ret ; 49efc - -MainMenu_Mobile: ; 49efc - call ClearBGPalettes - ld a, MUSIC_MOBILE_ADAPTER_MENU - ld [wMapMusic], a - ld de, MUSIC_MOBILE_ADAPTER_MENU - call Function4a6c5 -Function49f0a: ; 49f0a - call ClearBGPalettes - call Function4a3a7 - call Function4a492 - call ClearBGPalettes -Function49f16: ; 49f16 - call MobileMenu_InitMenuBuffers - ld c, 12 - call DelayFrames - hlcoord 4, 0 - ld b, 10 - ld c, 10 - call Function48cdc - hlcoord 6, 2 - ld de, MobileString1 - call PlaceString - hlcoord 0, 12 - ld b, 4 - ld c, SCREEN_HEIGHT - call TextBox - xor a - ld de, String_0x49fe9 - hlcoord 1, 14 - call PlaceString - call WaitBGMap2 - call SetPalettes - call StaticMenuJoypad - ld hl, wMenuCursorY - ld b, [hl] - push bc - jr .check_buttons - -.joy_loop - call ScrollingMenuJoypad - ld hl, wMenuCursorY - ld b, [hl] - push bc - -.check_buttons - bit A_BUTTON_F, a - jr nz, .a_button - bit B_BUTTON_F, a - jr nz, .b_button - jr .next - -.a_button - ld hl, wMenuCursorY - ld a, [hl] - cp 1 - jp z, Function4a098 - cp 2 - jp z, Function4a0b9 - cp 3 - jp z, Function4a0c2 - cp 4 - jp z, Function4a100 - ld a, 1 - call MenuClickSound -.b_button - pop bc - call ClearBGPalettes - call ClearTileMap - ld a, MUSIC_MAIN_MENU - ld [wMapMusic], a - ld de, MUSIC_MAIN_MENU - call Function4a6c5 - ret - -.next - ld hl, wMenuCursorY - ld a, [hl] - dec a - ld hl, MobileStrings2 - call GetNthString - ld d, h - ld e, l - hlcoord 1, 13 - ld b, 4 - ld c, SCREEN_HEIGHT - call ClearBox - hlcoord 1, 14 - call PlaceString - jp .useless_jump - -.useless_jump - call MobileMenu_InitMenuBuffers - pop bc - ld hl, wMenuCursorY - ld [hl], b - ld b, $a - ld c, $1 - hlcoord 5, 1 - call ClearBox - jp .joy_loop -; 49fcc - - -MobileString1: ; 49fcc - db "めいしフ,ルダー" - next "あいさつ" - next "プロフィール" - next "せ", $1e, "い" - next "もどる" - db "@" -; 49fe9 - - -MobileStrings2: - -String_0x49fe9: ; 49fe9 - db "めいし¯つくったり" - next "ほぞんしておける フ,ルダーです@" -; 4a004 - -String_0x4a004: ; 4a004 - db "モバイルたいせんや じぶんのめいしで" - next "つかう あいさつ¯つくります@" -; 4a026 - -String_0x4a026: ; 4a026 - db "あなた%じゅうしょや ねんれいの" - next "せ", $1e, "い¯かえられます@" -; 4a042 - -String_0x4a042: ; 4a042 - db "モバイルセンター", $1d, "せつぞくするとき" - next "ひつような こと¯きめます@" -; 4a062 - -String_0x4a062: ; 4a062 - db "まえ%がめん ", $1d, "もどります" - next "@" -; 4a071 - -MobileMenu_InitMenuBuffers: ; 4a071 (12:6071) - ld hl, w2DMenuCursorInitY - ld a, 2 - ld [hli], a - ld a, 5 ; w2DMenuCursorInitX - ld [hli], a - ld a, 5 ; w2DMenuNumRows - ld [hli], a - ld a, 1 ; w2DMenuNumCols - ld [hli], a - ld [hl], $0 ; w2DMenuFlags1 - set 5, [hl] - inc hl - xor a ; w2DMenuFlags2 - ld [hli], a - ld a, $20 ; w2DMenuFlags3 - ld [hli], a - ; this is a stupid way to load $c3 - ld a, $1 - add $40 - add $80 - add $2 - ld [hli], a ; w2DMenuFlags4 - ld a, 1 -rept 2 - ld [hli], a ; wMenuCursorY, wMenuCursorX -endr - ret - -Function4a098: ; 4a098 (12:6098) - ld a, 2 - call MenuClickSound - call PlaceHollowCursor - call WaitBGMap - call LoadStandardMenuDataHeader - callba Function89de0 - call Call_ExitMenu - call MG_Mobile_Layout_LoadPals - call Function4a485 - pop bc - jp Function49f16 - -Function4a0b9: ; 4a0b9 (12:60b9) - ld a, 2 - call MenuClickSound - pop bc - jp Function4a4c4 - -Function4a0c2: ; 4a0c2 (12:60c2) - ld a, 2 - call MenuClickSound - ld a, BANK(sPlayerData) - call GetSRAMBank - ld hl, sPlayerData + PlayerName - wPlayerData - ld de, PlayerName - ld bc, 6 ; japanese name length - call CopyBytes - call CloseSRAM - callba _LoadData - ld c, 2 - call DelayFrames - ld c, $1 - call InitMobileProfile - push af - call ClearBGPalettes - pop af - and a - jr nz, .skip_save - callba _SaveData -.skip_save - ld c, 5 - call DelayFrames - jr asm_4a111 - -Function4a100: ; 4a100 (12:6100) - ld a, 2 - call MenuClickSound - call ClearBGPalettes - call Function4a13b - call ClearBGPalettes - call ClearTileMap - -asm_4a111: ; 4a111 (12:6111) - pop bc - call LoadFontsExtra - jp Function49f0a - -Function4a118: ; 4a118 (12:6118) - ld hl, w2DMenuCursorInitY - ld a, $1 - ld [hli], a - ld a, $d - ld [hli], a - ld a, $3 - ld [hli], a - ld a, $1 - ld [hli], a - ld [hl], $0 - set 5, [hl] - inc hl - xor a - ld [hli], a - ld a, $20 - ld [hli], a - ld a, $1 - add $2 - ld [hli], a - ld a, $1 -rept 2 - ld [hli], a -endr - ret - -Function4a13b: ; 4a13b (12:613b) - call Function4a3a7 - call Function4a492 - call Function4a373 - ld c, 10 - call DelayFrames - -Function4a149: ; 4a149 (12:6149) - hlcoord 1, 2 - ld b, $6 - ld c, $10 - call Function48cdc - hlcoord 3, 4 - ld de, String_4a1ef - call PlaceString - hlcoord 0, 12 - ld b, $4 - ld c, $12 - call TextBox - ld a, [wMenuCursorY] - dec a - ld hl, Strings_4a23d - call GetNthString - ld d, h - ld e, l - hlcoord 1, 13 - ld b, $4 - ld c, $12 - call ClearBox - hlcoord 1, 14 - call PlaceString - callba Function104148 - call SetPalettes - call StaticMenuJoypad - ld hl, wMenuCursorY - ld b, [hl] - push bc - jr asm_4a19d - -Function4a195: ; 4a195 (12:6195) - call ScrollingMenuJoypad - ld hl, wMenuCursorY - ld b, [hl] - push bc - -asm_4a19d: ; 4a19d (12:619d) - bit 0, a - jr nz, .asm_4a1a7 - bit 1, a - jr nz, .asm_4a1ba - jr .asm_4a1bc -.asm_4a1a7 - ld hl, wMenuCursorY - ld a, [hl] - cp $1 - jp z, Function4a20e - cp $2 - jp z, Function4a221 - ld a, $1 - call MenuClickSound -.asm_4a1ba - pop bc - ret -.asm_4a1bc - ld hl, wMenuCursorY - ld a, [hl] - dec a - ld hl, Strings_4a23d - call GetNthString - ld d, h - ld e, l - hlcoord 1, 13 - ld b, $4 - ld c, $12 - call ClearBox - hlcoord 1, 14 - call PlaceString - jr .asm_4a1db -.asm_4a1db - call Function4a373 - pop bc - ld hl, wMenuCursorY - ld [hl], b - lb bc, 6, 1 - hlcoord 2, 3 - call ClearBox - jp Function4a195 -; 4a1ef (12:61ef) - -String_4a1ef: ; 4a1ef - db "モバイルセンター¯えらぶ" - next "ログインパスワード¯いれる" - next "もどる@" -; 4a20e - -Function4a20e: ; 4a20e (12:620e) - ld a, $1 - call MenuClickSound - callba Function1719c8 - call ClearBGPalettes - call DelayFrame - jr Function4a239 - -Function4a221: ; 4a221 (12:6221) - ld a, $1 - call MenuClickSound - call Function4a28a - jr c, Function4a239 - call Function4a373 - ld a, $2 - ld [wMenuCursorY], a - jr .asm_4a235 -.asm_4a235 - pop bc - jp Function4a149 - -Function4a239: ; 4a239 (12:6239) - pop bc - jp Function4a13b -; 4a23d (12:623d) - -Strings_4a23d: ; 4a23d - db "いつも せつぞく¯する" - next "モバイルセンター¯えらびます@" - - db "モバイルセンター", $1d, "せつぞくするとき" - next "つかうパスワード¯ほぞんできます@" - - db "まえ%がめん ", $1d, "もどります@" - - db "@" -; 4a28a - -Function4a28a: ; 4a28a (12:628a) - hlcoord 2, 3 - lb bc, 6, 1 - ld a, " " - call Function4a6d8 - call PlaceHollowCursor - call WaitBGMap - call LoadStandardMenuDataHeader - ld a, $5 - call GetSRAMBank - ld a, [$aa4b] - call CloseSRAM - and a - jr z, .asm_4a2df - hlcoord 12, 0 - ld b, $5 - ld c, $6 - call Function48cdc - hlcoord 14, 1 - ld de, String_4a34b - call PlaceString - callba Function104148 - call Function4a118 - call ScrollingMenuJoypad - push af - call PlayClickSFX - pop af - bit 1, a - jr nz, .asm_4a33b - ld a, [wMenuCursorY] - cp $2 - jr z, .asm_4a2f0 - cp $3 - jr z, .asm_4a33b -.asm_4a2df - callba Function11765d - call ClearBGPalettes - call Call_ExitMenu - call LoadFontsExtra - scf - ret -.asm_4a2f0 - call PlaceHollowCursor - ld hl, UnknownText_0x4a358 - call PrintText - hlcoord 14, 7 - ld b, $3 - ld c, $4 - call TextBox - callba Function104148 - ld hl, MenuDataHeader_0x4a362 - call LoadMenuDataHeader - call VerticalMenu - bit 1, a - jr nz, .asm_4a338 - ld a, [wMenuCursorY] - cp $2 - jr z, .asm_4a338 - ld a, $5 - call GetSRAMBank - ld hl, $aa4b - xor a - ld bc, $11 - call ByteFill - call CloseSRAM - ld hl, UnknownText_0x4a35d - call PrintText - call JoyWaitAorB -.asm_4a338 - call ExitMenu -.asm_4a33b - call Call_ExitMenu - callba Function104148 - xor a - ret -; 4a346 (12:6346) - -MenuDataHeader_0x4a346: ; 0x4a346 - db $40 ; flags - db 00, 12 ; start coords - db 06, 19 ; end coords - -String_4a34b: ; 4a34b - db "いれなおす" - next "けす" - next "もどる@" -; 4a358 - -UnknownText_0x4a358: ; 0x4a358 - ; Delete the saved LOG-IN PASSWORD? - text_jump UnknownText_0x1c5196 - db "@" -; 0x4a35d - -UnknownText_0x4a35d: ; 0x4a35d - ; Deleted the LOG-IN PASSWORD. - text_jump UnknownText_0x1c51b9 - db "@" -; 0x4a362 - -MenuDataHeader_0x4a362: ; 0x4a362 - db $40 ; flags - db 07, 14 ; start coords - db 11, 19 ; end coords - dw MenuData2_0x4a36a - db 2 ; default option -; 0x4a36a - -MenuData2_0x4a36a: ; 0x4a36a - db $e0 ; flags - db 2 ; items - db "はい@" - db "いいえ@" -; 0x4a373 - -Function4a373: ; 4a373 (12:6373) - ld hl, w2DMenuCursorInitY - ld a, $4 - ld [hli], a - ld a, $2 - ld [hli], a - ld a, $3 - ld [hli], a - ld a, $1 - ld [hli], a - ld [hl], $0 - set 5, [hl] - inc hl - xor a - ld [hli], a - ld a, $20 - ld [hli], a - ld a, $1 - add $40 - add $80 - add $2 - ld [hli], a - ld a, $1 -rept 2 - ld [hli], a -endr - ret -; 4a39a (12:639a) - -Function4a39a: ; 4a39a - call Function4a485 - call Function4a492 - call Function4a3aa - call SetPalettes - ret -; 4a3a7 - -Function4a3a7: ; 4a3a7 (12:63a7) - call Function4a485 -Function4a3aa: ; 4a3aa - hlcoord 0, 0 - lb bc, 3, 1 - xor a - call Function4a6d8 - lb bc, 1, 1 - ld a, $1 - call Function4a6d8 - lb bc, 1, 1 - xor a - call Function4a6d8 - lb bc, 1, 1 - ld a, $1 - call Function4a6d8 - lb bc, 4, 1 - ld a, $2 - call Function4a6d8 - lb bc, 1, 1 - ld a, $3 - call Function4a6d8 - lb bc, 1, 1 - ld a, " " - call Function4a6d8 - hlcoord 1, 0 - ld a, $1 - lb bc, 3, 18 - call Function4a6d8 - lb bc, 1, 18 - ld a, $0 - call Function4a6d8 - lb bc, 1, 18 - ld a, $1 - call Function4a6d8 - lb bc, 1, 18 - ld a, $2 - call Function4a6d8 - lb bc, 11, 18 - ld a, " " - call Function4a6d8 - hlcoord 19, 0 - lb bc, 3, 1 - ld a, $0 - call Function4a6d8 - lb bc, 1, 1 - ld a, $1 - call Function4a6d8 - lb bc, 1, 1 - xor a - call Function4a6d8 - lb bc, 1, 1 - ld a, $1 - call Function4a6d8 - lb bc, 4, 1 - ld a, $2 - call Function4a6d8 - lb bc, 1, 1 - ld a, $3 - call Function4a6d8 - lb bc, 1, 1 - ld a, " " - call Function4a6d8 - ret -; 4a449 (12:6449) - -Function4a449: ; 4a449 - ld bc, 3 * SCREEN_WIDTH - ld a, $0 - hlcoord 0, 0 - call ByteFill - ld bc, 2 * SCREEN_WIDTH - ld a, $1 - call ByteFill - ld bc, 2 * SCREEN_WIDTH - ld a, $0 - call ByteFill - ld bc, 2 * SCREEN_WIDTH - ld a, $1 - call ByteFill - ld bc, SCREEN_WIDTH - ld a, $2 - call ByteFill - ld bc, SCREEN_WIDTH - ld a, $3 - call ByteFill - ld bc, SCREEN_WIDTH - ld a, " " - call ByteFill - ret -; 4a485 - -Function4a485: ; 4a485 (12:6485) - ld de, GFX_49c0c - ld hl, VTiles2 tile $00 - lb bc, BANK(GFX_49c0c), 13 - call Get2bpp - ret - -Function4a492: ; 4a492 (12:6492) - call MG_Mobile_Layout00 - ret - - -MainMenu_MobileStudium: ; 4a496 - ld a, [StartDay] - ld b, a - ld a, [StartHour] - ld c, a - ld a, [StartMinute] - ld d, a - ld a, [StartSecond] - ld e, a - push bc - push de - callba MobileStudium - call ClearBGPalettes - pop de - pop bc - ld a, b - ld [StartDay], a - ld a, c - ld [StartHour], a - ld a, d - ld [StartMinute], a - ld a, e - ld [StartSecond], a - ret -; 4a4c4 - - -Function4a4c4: ; 4a4c4 (12:64c4) - call ClearBGPalettes - call Function4a3a7 - call Function4a492 - call Function4a680 - call ClearBGPalettes - ld c, 20 - call DelayFrames - hlcoord 2, 0 - ld b, $a - ld c, $e - call Function48cdc - hlcoord 4, 2 - ld de, String_4a5c5 - call PlaceString - hlcoord 4, 4 - ld de, String_4a5cd - call PlaceString - hlcoord 4, 6 - ld de, String_4a5da - call PlaceString - hlcoord 4, 8 - ld de, String_4a5e6 - call PlaceString - hlcoord 4, 10 - ld de, String_4a5f2 - call PlaceString - hlcoord 0, 12 - ld b, $4 - ld c, $12 - call TextBox - xor a - ld hl, Strings_4a5f6 - ld d, h - ld e, l - hlcoord 1, 14 - call PlaceString - ld a, $1 - ld hl, Strings_4a5f6 - call GetNthString - ld d, h - ld e, l - hlcoord 1, 16 - call PlaceString - call WaitBGMap2 - call SetPalettes - call StaticMenuJoypad - ld hl, wMenuCursorY - ld b, [hl] - push bc - jr asm_4a54d - -Function4a545: ; 4a545 (12:6545) - call ScrollingMenuJoypad - ld hl, wMenuCursorY - ld b, [hl] - push bc - -asm_4a54d: ; 4a54d (12:654d) - bit 0, a - jr nz, .asm_4a557 - bit 1, a - jr nz, .asm_4a574 - jr .asm_4a57e -.asm_4a557 - ld hl, wMenuCursorY - ld a, [hl] - cp $1 - jp z, Function4a6ab - cp $2 - jp z, Function4a6ab - cp $3 - jp z, Function4a6ab - cp $4 - jp z, Function4a6ab - ld a, $1 - call MenuClickSound -.asm_4a574 - pop bc - call ClearBGPalettes - call ClearTileMap - jp Function49f0a -.asm_4a57e - ld hl, wMenuCursorY - ld a, [hl] - dec a - add a - push af - ld hl, Strings_4a5f6 - call GetNthString - ld d, h - ld e, l - hlcoord 1, 13 - ld b, $4 - ld c, $12 - call ClearBox - hlcoord 1, 14 - call PlaceString - pop af - inc a - ld hl, Strings_4a5f6 - call GetNthString - ld d, h - ld e, l - hlcoord 1, 16 - call PlaceString - jp Function4a5b0 - -Function4a5b0: ; 4a5b0 (12:65b0) - call Function4a680 - pop bc - ld hl, wMenuCursorY - ld [hl], b - ld b, $a - ld c, $1 - hlcoord 3, 1 - call ClearBox - jp Function4a545 -; 4a5c5 (12:65c5) - -String_4a5c5: ; 4a5c5 - db "じこしょうかい@" -String_4a5cd: ; 4a5cd - db "たいせん ", $4a, "はじまるとき@" -String_4a5da: ; 4a5da - db "たいせん ", $1d, "かったとき@" -String_4a5e6: ; 4a5e6 - db "たいせん ", $1d, "まけたとき@" -String_4a5f2: ; 4a5f2 - db "もどる@" -; 4a5f6 - -Strings_4a5f6: ; 4a5f6 - db "めいし や ニュース ", $1d, "のせる@" - db "あなた%あいさつです@" - db "モバイル たいせん", $4a, "はじまるとき@" - db "あいて", $1d, "みえる あいさつです@" - db "モバイル たいせんで かったとき@" - db "あいて", $1d, "みえる あいさつです@" - db "モバイル たいせんで まけたとき@" - db "あいて", $1d, "みえる あいさつです@" - db "まえ%がめん ", $1d, "もどります@" - db "@" -; 4a680 - -Function4a680: ; 4a680 (12:6680) - ld hl, w2DMenuCursorInitY - ld a, $2 - ld [hli], a - ld a, $3 - ld [hli], a - ld a, $5 - ld [hli], a - ld a, $1 - ld [hli], a - ld [hl], $0 - set 5, [hl] - inc hl - xor a - ld [hli], a - ld a, $20 - ld [hli], a - ld a, $1 - add $40 - add $80 - add $2 - ld [hli], a - ld a, $1 -rept 2 - ld [hli], a -endr - xor a -rept 3 - ld [hli], a -endr - ret - -Function4a6ab: ; 4a6ab (12:66ab) - ld a, $2 - call MenuClickSound - call ClearBGPalettes - ld b, SCGB_08 - call GetSGBLayout - callba Function11c1ab - pop bc - call LoadFontsExtra - jp Function4a4c4 - -Function4a6c5: ; 4a6c5 (12:66c5) - ld a, $5 - ld [MusicFade], a - ld a, e - ld [MusicFadeIDLo], a - ld a, d - ld [MusicFadeIDHi], a - ld c, 22 - call DelayFrames - ret - -Function4a6d8: ; 4a6d8 (12:66d8) - push bc - push hl -.asm_4a6da - ld [hli], a - dec c - jr nz, .asm_4a6da - pop hl - ld bc, $14 - add hl, bc - pop bc - dec b - jr nz, Function4a6d8 - ret diff --git a/engine/menu.asm b/engine/menu.asm index d5ec64d72..aa2cddfa5 100755 --- a/engine/menu.asm +++ b/engine/menu.asm @@ -42,7 +42,7 @@ _InterpretMobileMenu:: ; 2403c and a jr nz, .quit call MobileMenuJoypad - ld a, [w2DMenuFlags4] + ld a, [wMenuJoypadFilter] and c jr z, .loop call Mobile_GetMenuSelection @@ -246,16 +246,16 @@ Init2DMenuCursorPosition: ; 2411a (9:411a) .InitFlags_c: ; 24193 ld hl, wMenuData2Flags - ld a, %001 + ld a, A_BUTTON bit 0, [hl] jr nz, .skip - or %010 + or B_BUTTON .skip bit 1, [hl] jr z, .skip2 - or %100 + or SELECT .skip2 - ld [w2DMenuFlags4], a + ld [wMenuJoypadFilter], a ret ; 241a8 @@ -307,7 +307,7 @@ Function241d5: ; 241d5 jr nz, .done call GetMenuJoypad ld c, a - ld a, [w2DMenuFlags4] + ld a, [wMenuJoypadFilter] and c jr z, .loop @@ -345,7 +345,7 @@ MenuJoypadLoop: ; 24216 jr nz, .done call GetMenuJoypad ld b, a - ld a, [w2DMenuFlags4] + ld a, [wMenuJoypadFilter] and b jr z, .loop @@ -812,11 +812,11 @@ _InitVerticalMenuCursor:: ; 2446d ; w2DMenuFlags3 ld a, %00100000 ld [hli], a -; w2DMenuFlags4 - ld a, %001 +; wMenuJoypadFilter + ld a, A_BUTTON bit 0, b jr nz, .skip_bit_1 - add %010 + add B_BUTTON .skip_bit_1 ld [hli], a ; wMenuCursorY diff --git a/engine/party_menu.asm b/engine/party_menu.asm index 59eb4afbe..18ec493af 100644 --- a/engine/party_menu.asm +++ b/engine/party_menu.asm @@ -693,12 +693,12 @@ InitPartyMenuWithCancel: ; 50405 jr c, .done .skip - ld a, $1 + ld a, 1 .done ld [wMenuCursorY], a ld a, A_BUTTON | B_BUTTON - ld [w2DMenuFlags4], a + ld [wMenuJoypadFilter], a ret ; 5042d @@ -716,11 +716,11 @@ InitPartyMenuNoCancel: ; 0x5042d cp b jr c, .done .skip - ld a, $1 + ld a, 1 .done ld [wMenuCursorY], a ld a, A_BUTTON | B_BUTTON - ld [w2DMenuFlags4], a + ld [wMenuJoypadFilter], a ret ; 5044f (14:444f) diff --git a/engine/scrolling_menu.asm b/engine/scrolling_menu.asm index c5a671ce6..a32f22abd 100755 --- a/engine/scrolling_menu.asm +++ b/engine/scrolling_menu.asm @@ -279,65 +279,64 @@ ScrollingMenu_InitFlags: ; 24764 ld a, [wScrollingMenuListSize] ld b, a ld a, [wMenuBorderTopCoord] - add $1 + add 1 ld [w2DMenuCursorInitY], a ld a, [wMenuBorderLeftCoord] - add $0 + add 0 ld [w2DMenuCursorInitX], a ld a, [wMenuData2_ScrollingMenuHeight] cp b - jr c, .asm_24786 - jr z, .asm_24786 + jr c, .no_extra_row + jr z, .no_extra_row ld a, b inc a - -.asm_24786 +.no_extra_row ld [w2DMenuNumRows], a - ld a, $1 + ld a, 1 ld [w2DMenuNumCols], a ld a, $8c bit 2, c - jr z, .asm_24796 + jr z, .skip_set_0 set 0, a -.asm_24796 +.skip_set_0 bit 3, c - jr z, .asm_2479c + jr z, .skip_set_1 set 1, a -.asm_2479c +.skip_set_1 ld [w2DMenuFlags1], a xor a ld [w2DMenuFlags2], a ld a, $20 ld [w2DMenuFlags3], a - ld a, $c3 + ld a, A_BUTTON | B_BUTTON | D_UP | D_DOWN bit 7, c - jr z, .asm_247b0 - add $4 + jr z, .disallow_select + add SELECT -.asm_247b0 +.disallow_select bit 6, c - jr z, .asm_247b6 - add $8 + jr z, .disallow_start + add START -.asm_247b6 - ld [w2DMenuFlags4], a +.disallow_start + ld [wMenuJoypadFilter], a ld a, [w2DMenuNumRows] ld b, a ld a, [wMenuCursorBuffer] and a - jr z, .asm_247c8 + jr z, .reset_cursor cp b - jr z, .asm_247ca - jr c, .asm_247ca + jr z, .cursor_okay + jr c, .cursor_okay -.asm_247c8 - ld a, $1 +.reset_cursor + ld a, 1 -.asm_247ca +.cursor_okay ld [wMenuCursorY], a - ld a, $1 + ld a, 1 ld [wMenuCursorX], a xor a ld [wCursorCurrentTile], a diff --git a/engine/tmhm2.asm b/engine/tmhm2.asm index 9476ce4cd..2cdcd68a5 100755 --- a/engine/tmhm2.asm +++ b/engine/tmhm2.asm @@ -216,8 +216,8 @@ TMHM_PocketLoop: ; 2c8d3 (b:48d3) ld [w2DMenuFlags2], a ld a, $20 ld [w2DMenuFlags3], a - ld a, $f3 - ld [w2DMenuFlags4], a + ld a, A_BUTTON | B_BUTTON | D_UP | D_DOWN | D_LEFT | D_RIGHT + ld [wMenuJoypadFilter], a ld a, [wTMHMPocketCursor] inc a ld [wMenuCursorY], a diff --git a/home/menu.asm b/home/menu.asm index 0427bbd1b..a79986d18 100644 --- a/home/menu.asm +++ b/home/menu.asm @@ -343,27 +343,27 @@ Function1eda:: ; 1eda Function1eff:: ; 1eff call InitVerticalMenuCursor - ld hl, w2DMenuFlags4 + ld hl, wMenuJoypadFilter ld a, [wMenuData2Flags] bit 3, a - jr z, .skip3 - set 3, [hl] + jr z, .disallow_select + set START_F, [hl] -.skip3 +.disallow_select ld a, [wMenuData2Flags] bit 2, a - jr z, .skip4_5 - set 5, [hl] - set 4, [hl] + jr z, .disallow_left_right + set D_LEFT_F, [hl] + set D_RIGHT_F, [hl] -.skip4_5 +.disallow_left_right ret ; 1f1a Function1f1a:: ; 1f1a call ScrollingMenuJoypad - ld hl, w2DMenuFlags4 + ld hl, wMenuJoypadFilter and [hl] jr Function1f2a ; 1f23 @@ -375,35 +375,35 @@ Function1f23:: ; 1f23 ; 1f2a Function1f2a:: ; 1f2a - bit 0, a - jr nz, .asm_1f52 - bit 1, a - jr nz, .asm_1f6d - bit 3, a - jr nz, .asm_1f6d - bit 4, a - jr nz, .asm_1f44 - bit 5, a - jr nz, .asm_1f4b + bit A_BUTTON_F, a + jr nz, .a_button + bit B_BUTTON_F, a + jr nz, .b_start + bit START_F, a + jr nz, .b_start + bit D_RIGHT_F, a + jr nz, .d_right + bit D_LEFT_F, a + jr nz, .d_left xor a ld [wMenuJoypad], a - jr .asm_1f57 + jr .done -.asm_1f44 - ld a, $10 +.d_right + ld a, D_RIGHT ld [wMenuJoypad], a - jr .asm_1f57 + jr .done -.asm_1f4b - ld a, $20 +.d_left + ld a, D_LEFT ld [wMenuJoypad], a - jr .asm_1f57 + jr .done -.asm_1f52 - ld a, $1 +.a_button + ld a, A_BUTTON ld [wMenuJoypad], a -.asm_1f57 +.done call GetMenuIndexSet ld a, [wMenuCursorY] ld l, a @@ -416,10 +416,10 @@ Function1f2a:: ; 1f2a and a ret -.asm_1f6d - ld a, $2 +.b_start + ld a, B_BUTTON ld [wMenuJoypad], a - ld a, $ff + ld a, -1 ld [MenuSelection], a scf ret diff --git a/home/serial.asm b/home/serial.asm index b710a3204..ad7d96103 100644 --- a/home/serial.asm +++ b/home/serial.asm @@ -92,7 +92,7 @@ Serial:: ; 6ef Function75f:: ; 75f ld a, $1 ld [hFFCC], a -.asm_763 +.loop ld a, [hl] ld [hSerialSend], a call Function78a @@ -100,28 +100,28 @@ Function75f:: ; 75f ld b, a inc hl ld a, $30 -.asm_76e +.wait dec a - jr nz, .asm_76e + jr nz, .wait ld a, [hFFCC] and a ld a, b pop bc - jr z, .asm_782 + jr z, .load dec hl cp $fd - jr nz, .asm_763 + jr nz, .loop xor a ld [hFFCC], a - jr .asm_763 + jr .loop -.asm_782 +.load ld [de], a inc de dec bc ld a, b or c - jr nz, .asm_763 + jr nz, .loop ret ; 78a diff --git a/main.asm b/main.asm index b3e567aa4..f632bff1a 100644 --- a/main.asm +++ b/main.asm @@ -9805,6 +9805,7 @@ Unknown_4985a: ; unreferenced INCLUDE "event/celebi.asm" INCLUDE "engine/main_menu.asm" +INCLUDE "misc/mobile_menu.asm" INCLUDE "engine/search.asm" INCLUDE "misc/mobile_12_2.asm" ; mobile battle selection @@ -10292,7 +10293,7 @@ Function4d35b: ; 4d35b ld l, e push bc push hl - call Function4d37e + call .PlaceBorder pop hl pop bc ld de, AttrMap - TileMap @@ -10320,12 +10321,12 @@ endr ret ; 4d37e -Function4d37e: ; 4d37e +.PlaceBorder: ; 4d37e push hl ld a, $76 ld [hli], a inc a - call Function4d3ab + call .PlaceRow inc a ld [hl], a pop hl @@ -10336,7 +10337,7 @@ Function4d37e: ; 4d37e ld a, "┌" ld [hli], a ld a, " " - call Function4d3ab + call .PlaceRow ld [hl], "─" pop hl ld de, SCREEN_WIDTH @@ -10346,17 +10347,17 @@ Function4d37e: ; 4d37e ld a, "┐" ld [hli], a ld a, "│" - call Function4d3ab + call .PlaceRow ld [hl], "└" ret ; 4d3ab -Function4d3ab: ; 4d3ab +.PlaceRow: ; 4d3ab ld d, c -.loop +.row_loop ld [hli], a dec d - jr nz, .loop + jr nz, .row_loop ret ; 4d3b1 diff --git a/misc/mobile_12_2.asm b/misc/mobile_12_2.asm index 6865c480a..0e86a75d1 100755 --- a/misc/mobile_12_2.asm +++ b/misc/mobile_12_2.asm @@ -488,7 +488,7 @@ Function4ab06: ; 4ab06 Function4ab1a: ; 4ab1a .asm_4ab1a ld a, $fb - ld [w2DMenuFlags4], a + ld [wMenuJoypadFilter], a ld a, $26 ld [w2DMenuFlags3], a ld a, $2 diff --git a/misc/mobile_22.asm b/misc/mobile_22.asm index 38acfa3af..5bc9389f3 100644 --- a/misc/mobile_22.asm +++ b/misc/mobile_22.asm @@ -2242,7 +2242,7 @@ Function89dab: ; 89dab (22:5dab) callba MobileMenuJoypad call Function8923c ld a, c - ld hl, w2DMenuFlags4 + ld hl, wMenuJoypadFilter and [hl] ret z bit 0, a @@ -3088,7 +3088,7 @@ Function8a31c: ; 8a31c (22:631c) Function8a383: ; 8a383 (22:6383) callba MobileMenuJoypad ld a, c - ld hl, w2DMenuFlags4 + ld hl, wMenuJoypadFilter and [hl] ret z bit 0, a diff --git a/misc/mobile_40.asm b/misc/mobile_40.asm index 0041d549d..e52c62cf3 100644 --- a/misc/mobile_40.asm +++ b/misc/mobile_40.asm @@ -860,7 +860,7 @@ Function100545: ; 100545 Function10054d: ; 10054d callba MobileMenuJoypad ld a, c - ld hl, w2DMenuFlags4 + ld hl, wMenuJoypadFilter and [hl] ret z call MenuClickSound @@ -1829,7 +1829,7 @@ Function100b45: ; 100b45 call Function100e2d pop bc jr c, .asm_100b6b - ld a, [w2DMenuFlags4] + ld a, [wMenuJoypadFilter] and c jr z, .asm_100b48 callba Mobile_GetMenuSelection @@ -1890,7 +1890,7 @@ Function100bc2: ; 100bc2 call Function100e2d pop bc jr c, .asm_100c25 - ld a, [w2DMenuFlags4] + ld a, [wMenuJoypadFilter] and c bit 6, a jp nz, .asm_100bff @@ -2021,7 +2021,7 @@ Function100cb5: ; 100cb5 call Function100dfd pop bc jr c, .asm_100d17 - ld a, [w2DMenuFlags4] + ld a, [wMenuJoypadFilter] and c jr z, .asm_100cc0 call PlaceHollowCursor @@ -2075,7 +2075,7 @@ MobileBattleMonMenu: ; 100d22 call Function100dfd pop bc jr c, .asm_100d54 - ld a, [w2DMenuFlags4] + ld a, [wMenuJoypadFilter] and c jr nz, .asm_100d56 jr .asm_100d30 @@ -5722,7 +5722,7 @@ Function1025ff: ; 1025ff callba Function1009f3 ret c callba MobileMenuJoypad - ld a, [w2DMenuFlags4] + ld a, [wMenuJoypadFilter] and c ret z bit 0, c @@ -5784,7 +5784,7 @@ Function10266b: ; 10266b callba Function1009f3 ret c callba MobileMenuJoypad - ld a, [w2DMenuFlags4] + ld a, [wMenuJoypadFilter] and c ret z bit 0, c @@ -6327,7 +6327,7 @@ Function1029fe: ; 1029fe ret c callba MobileMenuJoypad ld a, c - ld hl, w2DMenuFlags4 + ld hl, wMenuJoypadFilter and [hl] ret z push af diff --git a/misc/mobile_5b.asm b/misc/mobile_5b.asm index cc5f3e8ba..8fcfd3876 100755 --- a/misc/mobile_5b.asm +++ b/misc/mobile_5b.asm @@ -1107,7 +1107,7 @@ Function16d734: ; 16d734 jr nz, .asm_16d758 call Function16d713 ld b, a - ld a, [w2DMenuFlags4] + ld a, [wMenuJoypadFilter] and b jr z, .asm_16d734 diff --git a/misc/mobile_menu.asm b/misc/mobile_menu.asm new file mode 100755 index 000000000..7b88a073a --- /dev/null +++ b/misc/mobile_menu.asm @@ -0,0 +1,882 @@ +MainMenu_Mobile: ; 49efc + call ClearBGPalettes + ld a, MUSIC_MOBILE_ADAPTER_MENU + ld [wMapMusic], a + ld de, MUSIC_MOBILE_ADAPTER_MENU + call Function4a6c5 +Function49f0a: ; 49f0a + call ClearBGPalettes + call Function4a3a7 + call Function4a492 + call ClearBGPalettes +Function49f16: ; 49f16 + call MobileMenu_InitMenuBuffers + ld c, 12 + call DelayFrames + hlcoord 4, 0 + ld b, 10 + ld c, 10 + call Function48cdc + hlcoord 6, 2 + ld de, MobileString1 + call PlaceString + hlcoord 0, 12 + ld b, 4 + ld c, SCREEN_HEIGHT + call TextBox + xor a + ld de, String_0x49fe9 + hlcoord 1, 14 + call PlaceString + call WaitBGMap2 + call SetPalettes + call StaticMenuJoypad + ld hl, wMenuCursorY + ld b, [hl] + push bc + jr .check_buttons + +.joy_loop + call ScrollingMenuJoypad + ld hl, wMenuCursorY + ld b, [hl] + push bc + +.check_buttons + bit A_BUTTON_F, a + jr nz, .a_button + bit B_BUTTON_F, a + jr nz, .b_button + jr .next + +.a_button + ld hl, wMenuCursorY + ld a, [hl] + cp 1 + jp z, Function4a098 + cp 2 + jp z, Function4a0b9 + cp 3 + jp z, Function4a0c2 + cp 4 + jp z, Function4a100 + ld a, 1 + call MenuClickSound +.b_button + pop bc + call ClearBGPalettes + call ClearTileMap + ld a, MUSIC_MAIN_MENU + ld [wMapMusic], a + ld de, MUSIC_MAIN_MENU + call Function4a6c5 + ret + +.next + ld hl, wMenuCursorY + ld a, [hl] + dec a + ld hl, MobileStrings2 + call GetNthString + ld d, h + ld e, l + hlcoord 1, 13 + ld b, 4 + ld c, SCREEN_HEIGHT + call ClearBox + hlcoord 1, 14 + call PlaceString + jp .useless_jump + +.useless_jump + call MobileMenu_InitMenuBuffers + pop bc + ld hl, wMenuCursorY + ld [hl], b + ld b, $a + ld c, $1 + hlcoord 5, 1 + call ClearBox + jp .joy_loop +; 49fcc + + +MobileString1: ; 49fcc + db "めいしフ,ルダー" + next "あいさつ" + next "プロフィール" + next "せ", $1e, "い" + next "もどる" + db "@" +; 49fe9 + + +MobileStrings2: + +String_0x49fe9: ; 49fe9 + db "めいし¯つくったり" + next "ほぞんしておける フ,ルダーです@" +; 4a004 + +String_0x4a004: ; 4a004 + db "モバイルたいせんや じぶんのめいしで" + next "つかう あいさつ¯つくります@" +; 4a026 + +String_0x4a026: ; 4a026 + db "あなた%じゅうしょや ねんれいの" + next "せ", $1e, "い¯かえられます@" +; 4a042 + +String_0x4a042: ; 4a042 + db "モバイルセンター", $1d, "せつぞくするとき" + next "ひつような こと¯きめます@" +; 4a062 + +String_0x4a062: ; 4a062 + db "まえ%がめん ", $1d, "もどります" + next "@" +; 4a071 + +MobileMenu_InitMenuBuffers: ; 4a071 (12:6071) + ld hl, w2DMenuCursorInitY + ld a, 2 + ld [hli], a + ld a, 5 ; w2DMenuCursorInitX + ld [hli], a + ld a, 5 ; w2DMenuNumRows + ld [hli], a + ld a, 1 ; w2DMenuNumCols + ld [hli], a + ld [hl], $0 ; w2DMenuFlags1 + set 5, [hl] + inc hl + xor a ; w2DMenuFlags2 + ld [hli], a + ld a, $20 ; w2DMenuFlags3 + ld [hli], a + ; this is a stupid way to load $c3 + ld a, A_BUTTON + add D_UP + add D_DOWN + add B_BUTTON + ld [hli], a ; wMenuJoypadFilter + ld a, 1 +rept 2 + ld [hli], a ; wMenuCursorY, wMenuCursorX +endr + ret + +Function4a098: ; 4a098 (12:6098) + ld a, 2 + call MenuClickSound + call PlaceHollowCursor + call WaitBGMap + call LoadStandardMenuDataHeader + callba Function89de0 + call Call_ExitMenu + call MG_Mobile_Layout_LoadPals + call Function4a485 + pop bc + jp Function49f16 + +Function4a0b9: ; 4a0b9 (12:60b9) + ld a, 2 + call MenuClickSound + pop bc + jp Function4a4c4 + +Function4a0c2: ; 4a0c2 (12:60c2) + ld a, 2 + call MenuClickSound + ld a, BANK(sPlayerData) + call GetSRAMBank + ld hl, sPlayerData + PlayerName - wPlayerData + ld de, PlayerName + ld bc, 6 ; japanese name length + call CopyBytes + call CloseSRAM + callba _LoadData + ld c, 2 + call DelayFrames + ld c, $1 + call InitMobileProfile + push af + call ClearBGPalettes + pop af + and a + jr nz, .skip_save + callba _SaveData +.skip_save + ld c, 5 + call DelayFrames + jr asm_4a111 + +Function4a100: ; 4a100 (12:6100) + ld a, 2 + call MenuClickSound + call ClearBGPalettes + call Function4a13b + call ClearBGPalettes + call ClearTileMap + +asm_4a111: ; 4a111 (12:6111) + pop bc + call LoadFontsExtra + jp Function49f0a + +Function4a118: ; 4a118 (12:6118) + ld hl, w2DMenuCursorInitY + ld a, $1 + ld [hli], a + ld a, $d + ld [hli], a + ld a, $3 + ld [hli], a + ld a, $1 + ld [hli], a + ld [hl], $0 + set 5, [hl] + inc hl + xor a + ld [hli], a + ld a, $20 + ld [hli], a + ld a, $1 + add $2 + ld [hli], a + ld a, $1 +rept 2 + ld [hli], a +endr + ret + +Function4a13b: ; 4a13b (12:613b) + call Function4a3a7 + call Function4a492 + call Function4a373 + ld c, 10 + call DelayFrames + +Function4a149: ; 4a149 (12:6149) + hlcoord 1, 2 + ld b, $6 + ld c, $10 + call Function48cdc + hlcoord 3, 4 + ld de, String_4a1ef + call PlaceString + hlcoord 0, 12 + ld b, $4 + ld c, $12 + call TextBox + ld a, [wMenuCursorY] + dec a + ld hl, Strings_4a23d + call GetNthString + ld d, h + ld e, l + hlcoord 1, 13 + ld b, $4 + ld c, $12 + call ClearBox + hlcoord 1, 14 + call PlaceString + callba Function104148 + call SetPalettes + call StaticMenuJoypad + ld hl, wMenuCursorY + ld b, [hl] + push bc + jr asm_4a19d + +Function4a195: ; 4a195 (12:6195) + call ScrollingMenuJoypad + ld hl, wMenuCursorY + ld b, [hl] + push bc + +asm_4a19d: ; 4a19d (12:619d) + bit 0, a + jr nz, .asm_4a1a7 + bit 1, a + jr nz, .asm_4a1ba + jr .asm_4a1bc +.asm_4a1a7 + ld hl, wMenuCursorY + ld a, [hl] + cp $1 + jp z, Function4a20e + cp $2 + jp z, Function4a221 + ld a, $1 + call MenuClickSound +.asm_4a1ba + pop bc + ret +.asm_4a1bc + ld hl, wMenuCursorY + ld a, [hl] + dec a + ld hl, Strings_4a23d + call GetNthString + ld d, h + ld e, l + hlcoord 1, 13 + ld b, $4 + ld c, $12 + call ClearBox + hlcoord 1, 14 + call PlaceString + jr .asm_4a1db +.asm_4a1db + call Function4a373 + pop bc + ld hl, wMenuCursorY + ld [hl], b + lb bc, 6, 1 + hlcoord 2, 3 + call ClearBox + jp Function4a195 +; 4a1ef (12:61ef) + +String_4a1ef: ; 4a1ef + db "モバイルセンター¯えらぶ" + next "ログインパスワード¯いれる" + next "もどる@" +; 4a20e + +Function4a20e: ; 4a20e (12:620e) + ld a, $1 + call MenuClickSound + callba Function1719c8 + call ClearBGPalettes + call DelayFrame + jr Function4a239 + +Function4a221: ; 4a221 (12:6221) + ld a, $1 + call MenuClickSound + call Function4a28a + jr c, Function4a239 + call Function4a373 + ld a, $2 + ld [wMenuCursorY], a + jr .asm_4a235 +.asm_4a235 + pop bc + jp Function4a149 + +Function4a239: ; 4a239 (12:6239) + pop bc + jp Function4a13b +; 4a23d (12:623d) + +Strings_4a23d: ; 4a23d + db "いつも せつぞく¯する" + next "モバイルセンター¯えらびます@" + + db "モバイルセンター", $1d, "せつぞくするとき" + next "つかうパスワード¯ほぞんできます@" + + db "まえ%がめん ", $1d, "もどります@" + + db "@" +; 4a28a + +Function4a28a: ; 4a28a (12:628a) + hlcoord 2, 3 + lb bc, 6, 1 + ld a, " " + call Function4a6d8 + call PlaceHollowCursor + call WaitBGMap + call LoadStandardMenuDataHeader + ld a, $5 + call GetSRAMBank + ld a, [$aa4b] + call CloseSRAM + and a + jr z, .asm_4a2df + hlcoord 12, 0 + ld b, $5 + ld c, $6 + call Function48cdc + hlcoord 14, 1 + ld de, String_4a34b + call PlaceString + callba Function104148 + call Function4a118 + call ScrollingMenuJoypad + push af + call PlayClickSFX + pop af + bit 1, a + jr nz, .asm_4a33b + ld a, [wMenuCursorY] + cp $2 + jr z, .asm_4a2f0 + cp $3 + jr z, .asm_4a33b +.asm_4a2df + callba Function11765d + call ClearBGPalettes + call Call_ExitMenu + call LoadFontsExtra + scf + ret +.asm_4a2f0 + call PlaceHollowCursor + ld hl, UnknownText_0x4a358 + call PrintText + hlcoord 14, 7 + ld b, $3 + ld c, $4 + call TextBox + callba Function104148 + ld hl, MenuDataHeader_0x4a362 + call LoadMenuDataHeader + call VerticalMenu + bit 1, a + jr nz, .asm_4a338 + ld a, [wMenuCursorY] + cp $2 + jr z, .asm_4a338 + ld a, $5 + call GetSRAMBank + ld hl, $aa4b + xor a + ld bc, $11 + call ByteFill + call CloseSRAM + ld hl, UnknownText_0x4a35d + call PrintText + call JoyWaitAorB +.asm_4a338 + call ExitMenu +.asm_4a33b + call Call_ExitMenu + callba Function104148 + xor a + ret +; 4a346 (12:6346) + +MenuDataHeader_0x4a346: ; 0x4a346 + db $40 ; flags + db 00, 12 ; start coords + db 06, 19 ; end coords + +String_4a34b: ; 4a34b + db "いれなおす" + next "けす" + next "もどる@" +; 4a358 + +UnknownText_0x4a358: ; 0x4a358 + ; Delete the saved LOG-IN PASSWORD? + text_jump UnknownText_0x1c5196 + db "@" +; 0x4a35d + +UnknownText_0x4a35d: ; 0x4a35d + ; Deleted the LOG-IN PASSWORD. + text_jump UnknownText_0x1c51b9 + db "@" +; 0x4a362 + +MenuDataHeader_0x4a362: ; 0x4a362 + db $40 ; flags + db 07, 14 ; start coords + db 11, 19 ; end coords + dw MenuData2_0x4a36a + db 2 ; default option +; 0x4a36a + +MenuData2_0x4a36a: ; 0x4a36a + db $e0 ; flags + db 2 ; items + db "はい@" + db "いいえ@" +; 0x4a373 + +Function4a373: ; 4a373 (12:6373) + ld hl, w2DMenuCursorInitY + ld a, $4 + ld [hli], a + ld a, $2 + ld [hli], a + ld a, $3 + ld [hli], a + ld a, $1 + ld [hli], a + ld [hl], $0 + set 5, [hl] + inc hl + xor a + ld [hli], a + ld a, $20 + ld [hli], a + ld a, $1 + add $40 + add $80 + add $2 + ld [hli], a + ld a, $1 +rept 2 + ld [hli], a +endr + ret +; 4a39a (12:639a) + +Function4a39a: ; 4a39a + call Function4a485 + call Function4a492 + call Function4a3aa + call SetPalettes + ret +; 4a3a7 + +Function4a3a7: ; 4a3a7 (12:63a7) + call Function4a485 +Function4a3aa: ; 4a3aa + hlcoord 0, 0 + lb bc, 3, 1 + xor a + call Function4a6d8 + lb bc, 1, 1 + ld a, $1 + call Function4a6d8 + lb bc, 1, 1 + xor a + call Function4a6d8 + lb bc, 1, 1 + ld a, $1 + call Function4a6d8 + lb bc, 4, 1 + ld a, $2 + call Function4a6d8 + lb bc, 1, 1 + ld a, $3 + call Function4a6d8 + lb bc, 1, 1 + ld a, " " + call Function4a6d8 + hlcoord 1, 0 + ld a, $1 + lb bc, 3, 18 + call Function4a6d8 + lb bc, 1, 18 + ld a, $0 + call Function4a6d8 + lb bc, 1, 18 + ld a, $1 + call Function4a6d8 + lb bc, 1, 18 + ld a, $2 + call Function4a6d8 + lb bc, 11, 18 + ld a, " " + call Function4a6d8 + hlcoord 19, 0 + lb bc, 3, 1 + ld a, $0 + call Function4a6d8 + lb bc, 1, 1 + ld a, $1 + call Function4a6d8 + lb bc, 1, 1 + xor a + call Function4a6d8 + lb bc, 1, 1 + ld a, $1 + call Function4a6d8 + lb bc, 4, 1 + ld a, $2 + call Function4a6d8 + lb bc, 1, 1 + ld a, $3 + call Function4a6d8 + lb bc, 1, 1 + ld a, " " + call Function4a6d8 + ret +; 4a449 (12:6449) + +Function4a449: ; 4a449 + ld bc, 3 * SCREEN_WIDTH + ld a, $0 + hlcoord 0, 0 + call ByteFill + ld bc, 2 * SCREEN_WIDTH + ld a, $1 + call ByteFill + ld bc, 2 * SCREEN_WIDTH + ld a, $0 + call ByteFill + ld bc, 2 * SCREEN_WIDTH + ld a, $1 + call ByteFill + ld bc, SCREEN_WIDTH + ld a, $2 + call ByteFill + ld bc, SCREEN_WIDTH + ld a, $3 + call ByteFill + ld bc, SCREEN_WIDTH + ld a, " " + call ByteFill + ret +; 4a485 + +Function4a485: ; 4a485 (12:6485) + ld de, GFX_49c0c + ld hl, VTiles2 tile $00 + lb bc, BANK(GFX_49c0c), 13 + call Get2bpp + ret + +Function4a492: ; 4a492 (12:6492) + call MG_Mobile_Layout00 + ret + + +MainMenu_MobileStudium: ; 4a496 + ld a, [StartDay] + ld b, a + ld a, [StartHour] + ld c, a + ld a, [StartMinute] + ld d, a + ld a, [StartSecond] + ld e, a + push bc + push de + callba MobileStudium + call ClearBGPalettes + pop de + pop bc + ld a, b + ld [StartDay], a + ld a, c + ld [StartHour], a + ld a, d + ld [StartMinute], a + ld a, e + ld [StartSecond], a + ret +; 4a4c4 + + +Function4a4c4: ; 4a4c4 (12:64c4) + call ClearBGPalettes + call Function4a3a7 + call Function4a492 + call Function4a680 + call ClearBGPalettes + ld c, 20 + call DelayFrames + hlcoord 2, 0 + ld b, $a + ld c, $e + call Function48cdc + hlcoord 4, 2 + ld de, String_4a5c5 + call PlaceString + hlcoord 4, 4 + ld de, String_4a5cd + call PlaceString + hlcoord 4, 6 + ld de, String_4a5da + call PlaceString + hlcoord 4, 8 + ld de, String_4a5e6 + call PlaceString + hlcoord 4, 10 + ld de, String_4a5f2 + call PlaceString + hlcoord 0, 12 + ld b, $4 + ld c, $12 + call TextBox + xor a + ld hl, Strings_4a5f6 + ld d, h + ld e, l + hlcoord 1, 14 + call PlaceString + ld a, $1 + ld hl, Strings_4a5f6 + call GetNthString + ld d, h + ld e, l + hlcoord 1, 16 + call PlaceString + call WaitBGMap2 + call SetPalettes + call StaticMenuJoypad + ld hl, wMenuCursorY + ld b, [hl] + push bc + jr asm_4a54d + +Function4a545: ; 4a545 (12:6545) + call ScrollingMenuJoypad + ld hl, wMenuCursorY + ld b, [hl] + push bc + +asm_4a54d: ; 4a54d (12:654d) + bit 0, a + jr nz, .asm_4a557 + bit 1, a + jr nz, .asm_4a574 + jr .asm_4a57e +.asm_4a557 + ld hl, wMenuCursorY + ld a, [hl] + cp $1 + jp z, Function4a6ab + cp $2 + jp z, Function4a6ab + cp $3 + jp z, Function4a6ab + cp $4 + jp z, Function4a6ab + ld a, $1 + call MenuClickSound +.asm_4a574 + pop bc + call ClearBGPalettes + call ClearTileMap + jp Function49f0a +.asm_4a57e + ld hl, wMenuCursorY + ld a, [hl] + dec a + add a + push af + ld hl, Strings_4a5f6 + call GetNthString + ld d, h + ld e, l + hlcoord 1, 13 + ld b, $4 + ld c, $12 + call ClearBox + hlcoord 1, 14 + call PlaceString + pop af + inc a + ld hl, Strings_4a5f6 + call GetNthString + ld d, h + ld e, l + hlcoord 1, 16 + call PlaceString + jp Function4a5b0 + +Function4a5b0: ; 4a5b0 (12:65b0) + call Function4a680 + pop bc + ld hl, wMenuCursorY + ld [hl], b + ld b, $a + ld c, $1 + hlcoord 3, 1 + call ClearBox + jp Function4a545 +; 4a5c5 (12:65c5) + +String_4a5c5: ; 4a5c5 + db "じこしょうかい@" +String_4a5cd: ; 4a5cd + db "たいせん ", $4a, "はじまるとき@" +String_4a5da: ; 4a5da + db "たいせん ", $1d, "かったとき@" +String_4a5e6: ; 4a5e6 + db "たいせん ", $1d, "まけたとき@" +String_4a5f2: ; 4a5f2 + db "もどる@" +; 4a5f6 + +Strings_4a5f6: ; 4a5f6 + db "めいし や ニュース ", $1d, "のせる@" + db "あなた%あいさつです@" + db "モバイル たいせん", $4a, "はじまるとき@" + db "あいて", $1d, "みえる あいさつです@" + db "モバイル たいせんで かったとき@" + db "あいて", $1d, "みえる あいさつです@" + db "モバイル たいせんで まけたとき@" + db "あいて", $1d, "みえる あいさつです@" + db "まえ%がめん ", $1d, "もどります@" + db "@" +; 4a680 + +Function4a680: ; 4a680 (12:6680) + ld hl, w2DMenuCursorInitY + ld a, $2 + ld [hli], a + ld a, $3 + ld [hli], a + ld a, $5 + ld [hli], a + ld a, $1 + ld [hli], a + ld [hl], $0 + set 5, [hl] + inc hl + xor a + ld [hli], a + ld a, $20 + ld [hli], a + ld a, $1 + add $40 + add $80 + add $2 + ld [hli], a + ld a, $1 +rept 2 + ld [hli], a +endr + xor a +rept 3 + ld [hli], a +endr + ret + +Function4a6ab: ; 4a6ab (12:66ab) + ld a, $2 + call MenuClickSound + call ClearBGPalettes + ld b, SCGB_08 + call GetSGBLayout + callba Function11c1ab + pop bc + call LoadFontsExtra + jp Function4a4c4 + +Function4a6c5: ; 4a6c5 (12:66c5) + ld a, $5 + ld [MusicFade], a + ld a, e + ld [MusicFadeIDLo], a + ld a, d + ld [MusicFadeIDHi], a + ld c, 22 + call DelayFrames + ret + +Function4a6d8: ; 4a6d8 (12:66d8) + push bc + push hl +.asm_4a6da + ld [hli], a + dec c + jr nz, .asm_4a6da + pop hl + ld bc, SCREEN_WIDTH + add hl, bc + pop bc + dec b + jr nz, Function4a6d8 + ret diff --git a/wram.asm b/wram.asm index 2a4dc2e8a..466c9f9d3 100644 --- a/wram.asm +++ b/wram.asm @@ -44,6 +44,39 @@ party_struct: MACRO \1StatsEnd:: ENDM +red_box_struct: MACRO +\1Species:: db +\1HP:: dw +\1BoxLevel:: db +\1Status:: db +\1Type:: +\1Type1:: db +\1Type2:: db +\1CatchRate:: db +\1Moves:: ds NUM_MOVES +\1OTID:: dw +\1Exp:: ds 3 +\1HPExp:: dw +\1AttackExp:: dw +\1DefenseExp:: dw +\1SpeedExp:: dw +\1SpecialExp:: dw +\1DVs:: ds 2 +\1PP:: ds NUM_MOVES +ENDM + +red_party_struct: MACRO + red_box_struct \1 +\1Level:: db +\1Stats:: +\1MaxHP:: dw +\1Attack:: dw +\1Defense:: dw +\1Speed:: dw +\1Special:: dw +ENDM + + battle_struct: MACRO \1Species:: db \1Item:: db @@ -1136,6 +1169,40 @@ wBillsPCPokemonList:: wMysteryGiftPartyTemp:: ; ds PARTY_LENGTH * (1 + 1 + NUM_MOVES) wMysteryGiftStaging:: +wLinkData:: ; ds $514 + ds 6 +wLinkPlayerName:: ds NAME_LENGTH +wLinkPartyCount:: ds 1 +wLinkPartySpecies:: ds PARTY_LENGTH +wLinkPartySpeciesEnd:: ds 1 + +wTimeCapsulePlayerData:: +wTimeCapsulePartyMon1:: red_party_struct wTimeCapsulePartyMon1 +wTimeCapsulePartyMon2:: red_party_struct wTimeCapsulePartyMon2 +wTimeCapsulePartyMon3:: red_party_struct wTimeCapsulePartyMon3 +wTimeCapsulePartyMon4:: red_party_struct wTimeCapsulePartyMon4 +wTimeCapsulePartyMon5:: red_party_struct wTimeCapsulePartyMon5 +wTimeCapsulePartyMon6:: red_party_struct wTimeCapsulePartyMon6 +wTimeCapsulePartyMonOTNames:: ds PARTY_LENGTH * NAME_LENGTH +wTimeCapsulePartyMonNicks:: ds PARTY_LENGTH * PKMN_NAME_LENGTH +wTimeCapsulePlayerDataEnd:: + ds wTimeCapsulePlayerData - @ + +wLinkPlayerData:: +wLinkPlayerPartyMon1:: party_struct wLinkPlayerPartyMon1 +wLinkPlayerPartyMon2:: party_struct wLinkPlayerPartyMon2 +wLinkPlayerPartyMon3:: party_struct wLinkPlayerPartyMon3 +wLinkPlayerPartyMon4:: party_struct wLinkPlayerPartyMon4 +wLinkPlayerPartyMon5:: party_struct wLinkPlayerPartyMon5 +wLinkPlayerPartyMon6:: party_struct wLinkPlayerPartyMon6 +wLinkPlayerPartyMonOTNames:: ds PARTY_LENGTH * NAME_LENGTH +wLinkPlayerPartyMonNicks:: ds PARTY_LENGTH * PKMN_NAME_LENGTH + + ds $357 + +wLinkDataEnd:: + ds wLinkData - @ + wc800:: ds 1 wc801:: ds 1 wc802:: ds 1 @@ -1514,7 +1581,9 @@ wMenuDataHeaderEnd:: wMenuData2:: wMenuData2Flags:: ds 1 ; cf91 ; bit 7: When set, start printing text one tile to the right of the border +; In scrolling menus, SELECT is functional ; bit 6: When set, start printing text one tile below the border +; In scrolling menus, START is functional ; bit 5: ???? ; bit 4: ???? ; bit 3: ???? @@ -1557,7 +1626,7 @@ w2DMenuNumCols:: ds 1 w2DMenuFlags1:: ds 1 w2DMenuFlags2:: ds 1 w2DMenuFlags3:: ds 1 -w2DMenuFlags4:: ds 1 +wMenuJoypadFilter:: ds 1 wMenuData3End:: wMenuCursorY:: ds 1