diff --git a/audio/music/lookyoungster.asm b/audio/music/lookyoungster.asm index 3dcf302cf..e840facc8 100644 --- a/audio/music/lookyoungster.asm +++ b/audio/music/lookyoungster.asm @@ -59,7 +59,8 @@ Music_LookYoungster_Ch1: rest 1 rest 16 sound_loop 0, .mainloop - sound_ret + + sound_ret ; unused Music_LookYoungster_Ch2: stereo_panning TRUE, FALSE @@ -156,7 +157,8 @@ Music_LookYoungster_Ch2: note C_, 1 rest 1 sound_loop 0, .mainloop - sound_ret + + sound_ret ; unused Music_LookYoungster_Ch3: stereo_panning TRUE, TRUE @@ -290,4 +292,5 @@ Music_LookYoungster_Ch3: note G#, 1 rest 1 sound_loop 0, .mainloop - sound_ret + + sound_ret ; unused diff --git a/charmap.asm b/charmap.asm index 18349b2c7..075eeb5c2 100644 --- a/charmap.asm +++ b/charmap.asm @@ -282,6 +282,7 @@ charmap "「", $70 charmap "」", $71 charmap "』", $73 + charmap "・", $74 charmap "⋯", $75 charmap " ", $7f diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index cf1ad1f8d..8071d475e 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -673,7 +673,7 @@ StartTrainerBattle_LoadPokeBallGraphics: call CopyBytes pop af ldh [rSVBK], a - ld a, 1 + ld a, TRUE ldh [hCGBPalUpdate], a call DelayFrame call BattleStart_CopyTilemapAtOnce diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 0cbdd66fe..cc7ef2e37 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -4920,7 +4920,7 @@ LoadBattleMenu2: ret .mobile - farcall Function100b12 + farcall Mobile_LoadBattleMenu ld a, [wcd2b] and a ret z @@ -5311,7 +5311,7 @@ CheckAmuletCoin: MoveSelectionScreen: call IsMobileBattle jr nz, .not_mobile - farcall MobileMoveSelectionScreen + farcall Mobile_MoveSelectionScreen ret .not_mobile diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index 76a85a76a..4897ae6c4 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -1417,7 +1417,7 @@ BattleAnim_SetBGPals: call CopyPals pop af ldh [rSVBK], a - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -1438,7 +1438,7 @@ BattleAnim_SetOBPals: call CopyPals pop af ldh [rSVBK], a - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret diff --git a/engine/battle_anims/bg_effects.asm b/engine/battle_anims/bg_effects.asm index 63c610850..bdb88d76c 100644 --- a/engine/battle_anims/bg_effects.asm +++ b/engine/battle_anims/bg_effects.asm @@ -2546,7 +2546,7 @@ BGEffects_LoadBGPal0_OBPal1: pop bc pop af ldh [rSVBK], a - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -2573,7 +2573,7 @@ BGEffects_LoadBGPal1_OBPal0: pop bc pop af ldh [rSVBK], a - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret diff --git a/engine/debug/color_picker.asm b/engine/debug/color_picker.asm index 6062e71aa..310244c75 100644 --- a/engine/debug/color_picker.asm +++ b/engine/debug/color_picker.asm @@ -448,7 +448,7 @@ Function81c33: hlcoord 15, 2 ld de, wc608 + 2 call Function81ca7 - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ld a, $3 ld [wJumptableIndex], a @@ -1227,7 +1227,7 @@ Function822a3: call Function81ca7 pop af ldh [rSVBK], a - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a call DelayFrame ret diff --git a/engine/events/heal_machine_anim.asm b/engine/events/heal_machine_anim.asm index 2259752b3..38ccbf12c 100644 --- a/engine/events/heal_machine_anim.asm +++ b/engine/events/heal_machine_anim.asm @@ -167,7 +167,7 @@ INCBIN "gfx/overworld/heal_machine.2bpp" ld bc, 1 palettes ld a, BANK(wOBPals2) call FarCopyWRAM - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -231,7 +231,7 @@ INCLUDE "gfx/overworld/heal_machine.pal" pop af ldh [rSVBK], a - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret diff --git a/engine/events/poisonstep_pals.asm b/engine/events/poisonstep_pals.asm index b2de25fa6..07bd246a1 100644 --- a/engine/events/poisonstep_pals.asm +++ b/engine/events/poisonstep_pals.asm @@ -39,7 +39,7 @@ LoadPoisonBGPals: jr nz, .loop pop af ldh [rSVBK], a - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ld c, 4 call DelayFrames diff --git a/engine/gfx/cgb_layouts.asm b/engine/gfx/cgb_layouts.asm index a31c86ea0..c58b27cd9 100644 --- a/engine/gfx/cgb_layouts.asm +++ b/engine/gfx/cgb_layouts.asm @@ -189,7 +189,7 @@ _CGB_PokegearPals: ld a, BANK(wBGPals1) call FarCopyWRAM call ApplyPals - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -243,7 +243,7 @@ _CGB_StatsScreenHPPals: call ApplyAttrmap call ApplyPals - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -282,7 +282,7 @@ _CGB_Pokedex: call FarCopyWRAM call ApplyAttrmap call ApplyPals - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -317,7 +317,7 @@ _CGB_BillsPC: call InitPartyMenuOBPals call ApplyAttrmap call ApplyPals - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -339,7 +339,7 @@ Function9009: call InitPartyMenuOBPals call ApplyAttrmap call ApplyPals - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -362,7 +362,7 @@ _CGB_PokedexUnownMode: call InitPartyMenuOBPals call ApplyAttrmap call ApplyPals - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -415,7 +415,7 @@ _CGB_SlotMachine: call ByteFill call ApplyAttrmap call ApplyPals - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -433,7 +433,7 @@ _CGB_BetaTitleScreen: call FillBoxCGB call ApplyAttrmap call ApplyPals - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -573,7 +573,7 @@ _CGB_Evolution: call WipeAttrmap call ApplyAttrmap call ApplyPals - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -591,7 +591,7 @@ _CGB_GSTitleScreen: ld a, SCGB_DIPLOMA ld [wDefaultSGBLayout], a call ApplyPals - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -725,7 +725,7 @@ _CGB_TrainerCard: ld [hl], a call ApplyAttrmap call ApplyPals - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -749,7 +749,7 @@ _CGB_MoveList: call FillBoxCGB call ApplyAttrmap call ApplyPals - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -759,7 +759,7 @@ _CGB_BetaPikachuMinigame: call WipeAttrmap call ApplyAttrmap call ApplyPals - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -771,7 +771,7 @@ _CGB_PokedexSearchOption: call WipeAttrmap call ApplyAttrmap call ApplyPals - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -819,7 +819,7 @@ _CGB_PackPals: call FillBoxCGB call ApplyAttrmap call ApplyPals - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -877,7 +877,7 @@ _CGB_MagnetTrain: call FillBoxCGB call ApplyAttrmap call ApplyPals - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret diff --git a/engine/gfx/color.asm b/engine/gfx/color.asm index cece60834..530122bb3 100644 --- a/engine/gfx/color.asm +++ b/engine/gfx/color.asm @@ -150,7 +150,7 @@ Function8b07: ; unreferenced call FarCopyWRAM call ApplyPals - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -352,7 +352,7 @@ ApplyHPBarPals: ld bc, 4 ld a, BANK(wBGPals2) call FarCopyWRAM - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret diff --git a/engine/gfx/crystal_layouts.asm b/engine/gfx/crystal_layouts.asm index dadf40e95..9c47797d1 100644 --- a/engine/gfx/crystal_layouts.asm +++ b/engine/gfx/crystal_layouts.asm @@ -157,7 +157,7 @@ MG_Mobile_Layout01: .asm_49467 farcall ApplyAttrmap farcall ApplyPals - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret diff --git a/engine/gfx/sprite_anims.asm b/engine/gfx/sprite_anims.asm index 89203b561..91d53dca1 100644 --- a/engine/gfx/sprite_anims.asm +++ b/engine/gfx/sprite_anims.asm @@ -180,12 +180,12 @@ DoAnimFrame: ld a, [hl] sla a sla a - ld d, $2 + ld d, 2 ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld a, [hl] - add $3 + add 3 ld [hl], a call .Sprites_Sine @@ -204,7 +204,7 @@ DoAnimFrame: ld a, [hl] inc a ld [hl], a - ld d, $2 + ld d, 2 call .Sprites_Sine ld hl, SPRITEANIMSTRUCT_YOFFSET @@ -391,7 +391,7 @@ DoAnimFrame: inc [hl] .move_vertical ld a, e - ld d, $20 + ld d, 32 call .Sprites_Sine ld hl, SPRITEANIMSTRUCT_YOFFSET @@ -456,10 +456,10 @@ DoAnimFrame: ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld a, [hl] - cp $30 + cp 48 jr c, .asm_8d4cd dec [hl] - ld d, $28 + ld d, 40 call .Sprites_Sine ld hl, SPRITEANIMSTRUCT_YOFFSET @@ -492,8 +492,8 @@ DoAnimFrame: ld a, [hl] and a jr z, .asm_8d51c - ld d, a + ld d, a ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld a, [hl] @@ -759,11 +759,11 @@ DoAnimFrame: ld hl, SPRITEANIMSTRUCT_0D add hl, bc ld a, [hl] - add $2 + add 2 ld [hl], a xor $ff inc a - ld d, $20 + ld d, 32 call .Sprites_Sine ld hl, SPRITEANIMSTRUCT_YOFFSET @@ -777,13 +777,13 @@ DoAnimFrame: ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld a, [hl] - cp $14 + cp 20 jr nc, .asm_8d67f - add $2 + add 2 ld [hl], a xor $ff inc a - ld d, $20 + ld d, 32 call .Sprites_Sine ld hl, SPRITEANIMSTRUCT_YOFFSET @@ -799,7 +799,6 @@ DoAnimFrame: inc [hl] inc [hl] inc [hl] - ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld a, [hl] diff --git a/engine/gfx/sprites.asm b/engine/gfx/sprites.asm index c5a91a9b5..fd87f398b 100644 --- a/engine/gfx/sprites.asm +++ b/engine/gfx/sprites.asm @@ -135,16 +135,16 @@ _InitSpriteAnimStruct:: ; Back up the structure address to bc. ld c, l ld b, h -; Value [wSpriteAnimCount] is initially set to -1. Set it to -; the number of objects loaded into this array. + +; Increment [wSpriteAnimCount], skipping a 0 value. ld hl, wSpriteAnimCount inc [hl] ld a, [hl] and a - jr nz, .initialized + jr nz, .nonzero inc [hl] +.nonzero -.initialized ; Get row a of SpriteAnimSeqData, copy the pointer into de pop af ld e, a @@ -228,9 +228,9 @@ DeinitializeAllSprites: UpdateAnimFrame: call InitSpriteAnimBuffer ; init WRAM call GetSpriteAnimFrame ; read from a memory array - cp -3 + cp dowait_command jr z, .done - cp -4 + cp delanim_command jr z, .delete call GetFrameOAMPointer ; add byte to [wCurAnimVTile] diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 4de0fc3bc..36bdd8a8d 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -1141,7 +1141,7 @@ EvoStoneEffect: cp EVERSTONE jr z, .NoEffect - ld a, $1 + ld a, TRUE ld [wForceEvolution], a farcall EvolvePokemon diff --git a/engine/menus/intro_menu.asm b/engine/menus/intro_menu.asm index 31809be46..754a5ac86 100644 --- a/engine/menus/intro_menu.asm +++ b/engine/menus/intro_menu.asm @@ -959,6 +959,15 @@ Intro_PlacePlayerSprite: db 10 * 8 + 4, 9 * 8, 2 db 10 * 8 + 4, 10 * 8, 3 + + const_def + const TITLESCREENOPTION_MAIN_MENU + const TITLESCREENOPTION_DELETE_SAVE_DATA + const TITLESCREENOPTION_RESTART + const TITLESCREENOPTION_UNUSED + const TITLESCREENOPTION_RESET_CLOCK +NUM_TITLESCREENOPTIONS EQU const_value + IntroSequence: callfar Copyright_GameFreakPresents jr c, StartTitleScreen @@ -969,7 +978,7 @@ IntroSequence: StartTitleScreen: ldh a, [rSVBK] push af - ld a, BANK(wBGPals1) + ld a, BANK(wLYOverrides) ldh [rSVBK], a call .TitleScreen @@ -999,8 +1008,8 @@ StartTitleScreen: ld b, SCGB_DIPLOMA call GetSGBLayout call UpdateTimePals - ld a, [wIntroSceneFrameCounter] - cp $5 + ld a, [wTitleScreenSelectedOption] + cp NUM_TITLESCREENOPTIONS jr c, .ok xor a .ok @@ -1183,7 +1192,7 @@ TitleScreenMain: ld a, [hl] and D_LEFT + D_UP cp D_LEFT + D_UP - jr z, .clock_reset + jr z, .reset_clock ; Press Start or A to start the game. .check_start @@ -1193,14 +1202,14 @@ TitleScreenMain: ret .incave - ld a, 0 + ld a, TITLESCREENOPTION_MAIN_MENU jr .done .delete_save_data - ld a, 1 + ld a, TITLESCREENOPTION_DELETE_SAVE_DATA .done - ld [wIntroSceneFrameCounter], a + ld [wTitleScreenSelectedOption], a ; Return to the intro sequence. ld hl, wJumptableIndex @@ -1223,9 +1232,9 @@ TitleScreenMain: inc [hl] ret -.clock_reset - ld a, 4 - ld [wIntroSceneFrameCounter], a +.reset_clock + ld a, TITLESCREENOPTION_RESET_CLOCK + ld [wTitleScreenSelectedOption], a ; Return to the intro sequence. ld hl, wJumptableIndex @@ -1242,8 +1251,8 @@ TitleScreenEnd: and a ret nz - ld a, 2 - ld [wIntroSceneFrameCounter], a + ld a, TITLESCREENOPTION_RESTART + ld [wTitleScreenSelectedOption], a ; Back to the intro. ld hl, wJumptableIndex diff --git a/engine/movie/intro.asm b/engine/movie/intro.asm index b923f4862..c05d1202c 100644 --- a/engine/movie/intro.asm +++ b/engine/movie/intro.asm @@ -308,7 +308,7 @@ GameFreakLogoScene4: ld [wOBPals2 + 13], a pop af ldh [rSVBK], a - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -1508,7 +1508,7 @@ Intro_Scene24_ApplyPaletteFade: jr nz, .loop1 pop af ldh [rSVBK], a - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -1632,7 +1632,7 @@ CrystalIntro_UnownFade: pop af ldh [rSVBK], a - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -1710,7 +1710,7 @@ Intro_Scene20_AppearUnown: pop af ldh [rSVBK], a - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -1773,7 +1773,7 @@ endr pop af ldh [rSVBK], a - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -1886,7 +1886,7 @@ Intro_RustleGrass: dw IntroGrass2GFX Intro_SetCGBPalUpdate: - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -1903,7 +1903,7 @@ Intro_ClearBGPals: pop af ldh [rSVBK], a - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a call DelayFrame call DelayFrame diff --git a/engine/movie/title.asm b/engine/movie/title.asm index dce02804f..ad06343c9 100644 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -10,7 +10,7 @@ _TitleScreen: ; Reset timing variables ld hl, wJumptableIndex ld [hli], a ; wJumptableIndex - ld [hli], a ; wIntroSceneFrameCounter + ld [hli], a ; wTitleScreenSelectedOption ld [hli], a ; wTitleScreenTimer ld [hl], a ; wTitleScreenTimer + 1 @@ -74,7 +74,7 @@ _TitleScreen: ; 'CRYSTAL VERSION' hlbgcoord 5, 9 - ld bc, NAME_LENGTH ; length of version text + ld bc, 11 ; length of version text ld a, 1 call ByteFill @@ -85,7 +85,7 @@ _TitleScreen: call ByteFill ; Back to VRAM bank 0 - ld a, $0 + ld a, 0 ldh [rVBK], a ; Decompress logo @@ -108,14 +108,14 @@ _TitleScreen: hlcoord 0, 3 lb bc, 7, 20 ld d, $80 - ld e, $14 + ld e, 20 call DrawTitleGraphic ; Draw copyright text hlbgcoord 3, 0, vBGMap1 lb bc, 1, 13 ld d, $c - ld e, $10 + ld e, 16 call DrawTitleGraphic ; Initialize running Suicune? @@ -125,14 +125,12 @@ _TitleScreen: ; Initialize background crystal call InitializeBackground -; Save WRAM bank +; Update palette colors ldh a, [rSVBK] push af -; WRAM bank 5 ld a, BANK(wBGPals1) ldh [rSVBK], a -; Update palette colors ld hl, TitleScreenPalettes ld de, wBGPals1 ld bc, 16 palettes @@ -143,7 +141,6 @@ _TitleScreen: ld bc, 16 palettes call CopyBytes -; Restore WRAM bank pop af ldh [rSVBK], a @@ -201,7 +198,7 @@ _TitleScreen: ld a, -112 ldh [hWY], a - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ; Update BG Map 0 (bank 0) diff --git a/engine/movie/unused_title.asm b/engine/movie/unused_title.asm index c086cf566..615d92d36 100644 --- a/engine/movie/unused_title.asm +++ b/engine/movie/unused_title.asm @@ -88,7 +88,7 @@ UnusedTitleScreen: pop af ldh [rSVBK], a - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ld de, MUSIC_TITLE diff --git a/engine/overworld/init_map.asm b/engine/overworld/init_map.asm index d2d6145c7..68cb3b265 100644 --- a/engine/overworld/init_map.asm +++ b/engine/overworld/init_map.asm @@ -33,7 +33,7 @@ ReanchorBGMap_NoOAMUpdate:: call _OpenAndCloseMenu_HDMATransferTilemapAndAttrmap farcall LoadOW_BGPal7 farcall ApplyPals - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a xor a ldh [hBGMapMode], a diff --git a/engine/pokegear/radio.asm b/engine/pokegear/radio.asm index 9455170d5..803a7b036 100644 --- a/engine/pokegear/radio.asm +++ b/engine/pokegear/radio.asm @@ -246,7 +246,7 @@ endr .loop3 ; Choose one of the middle three Pokemon. call Random - and NUM_GRASSMON + maskbits NUM_GRASSMON cp 2 jr c, .loop3 cp 5 diff --git a/engine/pokemon/mon_menu.asm b/engine/pokemon/mon_menu.asm index c8d35a59f..fd51ae928 100644 --- a/engine/pokemon/mon_menu.asm +++ b/engine/pokemon/mon_menu.asm @@ -811,8 +811,8 @@ ChooseMoveToDelete: .ChooseMoveToDelete call SetUpMoveScreenBG - ld de, DeleteMoveScreenAttrs - call SetMenuAttributes + ld de, DeleteMoveScreen2DMenuData + call Load2DMenuData call SetUpMoveList ld hl, w2DMenuFlags1 set 6, [hl] @@ -848,12 +848,12 @@ ChooseMoveToDelete: pop af ret -DeleteMoveScreenAttrs: - db 3, 1 - db 3, 1 - db $40, $00 - dn 2, 0 - db D_UP | D_DOWN | A_BUTTON | B_BUTTON +DeleteMoveScreen2DMenuData: + db 3, 1 ; cursor start y, x + db 3, 1 ; rows, columns + db $40, $00 ; flags + dn 2, 0 ; cursor offset + db D_UP | D_DOWN | A_BUTTON | B_BUTTON ; accepted buttons ManagePokemonMoves: ld a, [wCurPartySpecies] @@ -878,8 +878,8 @@ MoveScreenLoop: ld [wPartyMenuCursor], a call SetUpMoveScreenBG call PlaceMoveScreenArrows - ld de, MoveScreenAttributes - call SetMenuAttributes + ld de, MoveScreen2DMenuData + call Load2DMenuData .loop call SetUpMoveList ld hl, w2DMenuFlags1 @@ -1077,12 +1077,12 @@ MoveScreenLoop: call ClearSprites jp ClearTilemap -MoveScreenAttributes: - db 3, 1 - db 3, 1 - db $40, $00 - dn 2, 0 - db D_UP | D_DOWN | D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON +MoveScreen2DMenuData: + db 3, 1 ; cursor start y, x + db 3, 1 ; rows, columns + db $40, $00 ; flags + dn 2, 0 ; cursor offsets + db D_UP | D_DOWN | D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON ; accepted buttons String_MoveWhere: db "Where?@" diff --git a/engine/pokemon/party_menu.asm b/engine/pokemon/party_menu.asm index c9f4dde31..fe470ed96 100644 --- a/engine/pokemon/party_menu.asm +++ b/engine/pokemon/party_menu.asm @@ -612,8 +612,8 @@ InitPartyMenuWithCancel: ; with cancel xor a ld [wSwitchMon], a - ld de, PartyMenuAttributes - call SetMenuAttributes + ld de, PartyMenu2DMenuData + call Load2DMenuData ld a, [wPartyCount] inc a ld [w2DMenuNumRows], a ; list length @@ -637,8 +637,8 @@ InitPartyMenuWithCancel: InitPartyMenuNoCancel: ; no cancel - ld de, PartyMenuAttributes - call SetMenuAttributes + ld de, PartyMenu2DMenuData + call Load2DMenuData ld a, [wPartyCount] ld [w2DMenuNumRows], a ; list length ld b, a @@ -656,20 +656,12 @@ InitPartyMenuNoCancel: ld [wMenuJoypadFilter], a ret -PartyMenuAttributes: -; cursor y -; cursor x -; num rows -; num cols -; bit 6: animate sprites bit 5: wrap around -; ? -; distance between items (hi: y, lo: x) -; allowed buttons (mask) - db 1, 0 - db 0, 1 - db $60, $00 - dn 2, 0 - db 0 +PartyMenu2DMenuData: + db 1, 0 ; cursor start y, x + db 0, 1 ; rows, columns + db $60, $00 ; flags + dn 2, 0 ; cursor offset + db 0 ; accepted buttons PartyMenuSelect: ; sets carry if exitted menu. diff --git a/home/menu.asm b/home/menu.asm index 3d026075c..cfa1cd444 100644 --- a/home/menu.asm +++ b/home/menu.asm @@ -1,20 +1,22 @@ -SetMenuAttributes:: +Load2DMenuData:: push hl push bc - ld hl, w2DMenuCursorInitY - ld b, $8 + ld hl, w2DMenuData + ld b, w2DMenuDataEnd - w2DMenuData .loop ld a, [de] inc de ld [hli], a dec b jr nz, .loop + + ; Reset menu state ld a, $1 - ld [hli], a - ld [hli], a + ld [hli], a ; wMenuCursorY + ld [hli], a ; wMenuCursorX xor a - ld [hli], a - ld [hli], a + ld [hli], a ; wCursorOffCharacter + ld [hli], a ; wCursorCurrentTile ld [hli], a pop bc pop hl diff --git a/home/palettes.asm b/home/palettes.asm index 5940a0efe..de742b732 100644 --- a/home/palettes.asm +++ b/home/palettes.asm @@ -99,7 +99,7 @@ DmgToCgbBGPals:: ld c, 8 call CopyPals ; request pal update - ld a, 1 + ld a, TRUE ldh [hCGBPalUpdate], a pop af @@ -147,7 +147,7 @@ DmgToCgbObjPals:: ld c, 8 call CopyPals ; request pal update - ld a, 1 + ld a, TRUE ldh [hCGBPalUpdate], a pop af @@ -182,7 +182,7 @@ DmgToCgbObjPal0:: ld b, a ld c, 1 call CopyPals - ld a, 1 + ld a, TRUE ldh [hCGBPalUpdate], a pop af @@ -219,7 +219,7 @@ DmgToCgbObjPal1:: ld b, a ld c, 1 call CopyPals - ld a, 1 + ld a, TRUE ldh [hCGBPalUpdate], a pop af @@ -319,7 +319,7 @@ ReloadSpritesNoPalettes:: call ByteFill pop af ldh [rSVBK], a - ld a, 1 + ld a, TRUE ldh [hCGBPalUpdate], a call DelayFrame ret diff --git a/home/text.asm b/home/text.asm index f4130e337..d9236a7a7 100644 --- a/home/text.asm +++ b/home/text.asm @@ -698,7 +698,7 @@ TextCommands:: dw TextCommand_PROMPT_BUTTON ; TX_PROMPT_BUTTON dw TextCommand_SCROLL ; TX_SCROLL dw TextCommand_START_ASM ; TX_START_ASM - dw TextCommand_NUM ; TX_NUM + dw TextCommand_DECIMAL ; TX_DECIMAL dw TextCommand_PAUSE ; TX_PAUSE dw TextCommand_SOUND ; TX_SOUND_DEX_FANFARE_50_79 dw TextCommand_DOTS ; TX_DOTS @@ -851,8 +851,8 @@ TextCommand_START_ASM:: ld [hl], a ret -TextCommand_NUM:: -; print a number +TextCommand_DECIMAL:: +; print a decimal number ld a, [hli] ld e, a ld a, [hli] diff --git a/home/tilemap.asm b/home/tilemap.asm index 4c9e63c87..6338cd892 100644 --- a/home/tilemap.asm +++ b/home/tilemap.asm @@ -197,7 +197,7 @@ ClearPalettes:: ldh [rSVBK], a ; Request palette update - ld a, 1 + ld a, TRUE ldh [hCGBPalUpdate], a ret diff --git a/hram.asm b/hram.asm index 00ac63748..c5dd27195 100644 --- a/hram.asm +++ b/hram.asm @@ -89,7 +89,7 @@ hPrintNumBuffer:: ds 10 NEXTU ; miscellaneous - ds 9 + ds 9 hMGStatusFlags:: db ENDU diff --git a/macros/scripts/text.asm b/macros/scripts/text.asm index 2622cee54..f45b7fd14 100644 --- a/macros/scripts/text.asm +++ b/macros/scripts/text.asm @@ -61,9 +61,9 @@ text_asm: MACRO db TX_START_ASM ENDM - const TX_NUM ; $09 + const TX_DECIMAL ; $09 text_decimal: MACRO - db TX_NUM + db TX_DECIMAL dw \1 ; address dn \2, \3 ; bytes, digits ENDM diff --git a/mobile/mobile_40.asm b/mobile/mobile_40.asm index 1b93c8985..4f603ab4c 100644 --- a/mobile/mobile_40.asm +++ b/mobile/mobile_40.asm @@ -409,7 +409,7 @@ Function1002dc: Function1002ed: farcall LoadOW_BGPal7 farcall ApplyPals - ld a, $01 + ld a, TRUE ldh [hCGBPalUpdate], a call DelayFrame ret @@ -1689,7 +1689,7 @@ Unknown_100b0a: popc -Function100b12: +Mobile_LoadBattleMenu: call Function100dd8 ret c ld hl, BattleMenuHeader @@ -1747,7 +1747,7 @@ Function100b7a: set 7, [hl] ret -MobileMoveSelectionScreen: +Mobile_MoveSelectionScreen: xor a ld [wMoveSwapBuffer], a farcall CheckPlayerHasUsableMoves @@ -1765,7 +1765,7 @@ MobileMoveSelectionScreen: .GetMoveSelection: xor a ldh [hBGMapMode], a - call Function100c74 + call .ListMoves call Function100c98 .master_loop farcall MoveInfoBox @@ -1860,7 +1860,7 @@ MobileMoveSelectionScreen: call SafeLoadTempTilemapToTilemap jp .GetMoveSelection -Function100c74: +.ListMoves: hlcoord 0, 8 ld b, 8 ld c, 8 @@ -1876,8 +1876,8 @@ Function100c74: ret Function100c98: - ld de, .attrs - call SetMenuAttributes + ld de, .data + call Load2DMenuData ld a, [wNumMoves] inc a ld [w2DMenuNumRows], a @@ -1886,12 +1886,12 @@ Function100c98: ld [wMenuCursorY], a ret -.attrs - db 10, 1 - db 255, 1 - db $a0, $00 - dn 2, 0 - db D_UP | D_DOWN | A_BUTTON | B_BUTTON +.data: + db 10, 1 ; cursor start y, x + db -1, 1 ; rows, columns + db $a0, $00 ; flags + dn 2, 0 ; cursor offsets + db D_UP | D_DOWN | A_BUTTON | B_BUTTON ; accepted buttons Mobile_PartyMenuSelect: call Function100dd8 @@ -2210,7 +2210,7 @@ Function100eca: Function100ed4: farcall ApplyPals - ld a, $01 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -5944,7 +5944,7 @@ Function1029cf: ld hl, wcd4b set 1, [hl] ld de, MenuData3_102a33 - call SetMenuAttributes + call Load2DMenuData ld a, [wcd4a] inc a ld [wcd4a], a @@ -5981,11 +5981,11 @@ String_102a26: db "@" MenuData3_102a33: - db 8, 11 - db 2, 1 - db $80, $00 - dn 2, 0 - db A_BUTTON + db 8, 11 ; cursor start y, x + db 2, 1 ; rows, columns + db $80, $00 ; flags + dn 2, 0 ; cursor offset + db A_BUTTON ; accepted buttons Function102a3b: ld a, [wcd30] @@ -6115,8 +6115,8 @@ Function102b4e: ld [wMonType], a ld a, [wMenuCursorY] push af - ld de, Unknown_102b73 - call SetMenuAttributes + ld de, MenuData_102b73 + call Load2DMenuData pop af ld [wMenuCursorY], a ld a, [wOTPartyCount] @@ -6130,32 +6130,32 @@ Function102b68: ; unreferenced call ByteFill ret -Unknown_102b73: - db 9, 6 - db 255, 1 - db $a0, $00 - dn 1, 0 - db D_UP | D_DOWN | A_BUTTON +MenuData_102b73: + db 9, 6 ; cursor start y, x + db -1, 1 ; rows, columns + db $a0, $00 ; flags + dn 1, 0 ; cursor offset + db D_UP | D_DOWN | A_BUTTON ; accepted buttons Function102b7b: xor a ld [wMonType], a ld a, [wMenuCursorY] push af - ld de, Unknown_102b94 - call SetMenuAttributes + ld de, MenuData_102b94 + call Load2DMenuData pop af ld [wMenuCursorY], a ld a, [wPartyCount] ld [w2DMenuNumRows], a ret -Unknown_102b94: - db 1, 6 - db 255, 1 - db $a0, $00 - dn 1, 0 - db D_UP | D_DOWN | A_BUTTON +MenuData_102b94: + db 1, 6 ; cursor start y, x + db 255, 1 ; rows, columns + db $a0, $00 ; flags + dn 1, 0 ; cursor offset + db D_UP | D_DOWN | A_BUTTON ; accepted buttons Function102b9c: ld a, [wcd4d] diff --git a/mobile/mobile_42.asm b/mobile/mobile_42.asm index e71f785dc..b6c5a3e3d 100644 --- a/mobile/mobile_42.asm +++ b/mobile/mobile_42.asm @@ -1450,7 +1450,7 @@ Function108b5a: jr nz, .loop pop af ldh [rSVBK], a - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret @@ -1474,7 +1474,7 @@ Function108b78: ld [hld], a pop af ldh [rSVBK], a - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret diff --git a/mobile/mobile_5b.asm b/mobile/mobile_5b.asm index 2598fc39e..2002facb5 100644 --- a/mobile/mobile_5b.asm +++ b/mobile/mobile_5b.asm @@ -650,7 +650,7 @@ Function16cbd1: ld a, $5 call FarCopyWRAM farcall ApplyPals - ld a, $1 + ld a, TRUE ldh [hCGBPalUpdate], a ret diff --git a/wram.asm b/wram.asm index 5d6c41688..bcc1240ac 100644 --- a/wram.asm +++ b/wram.asm @@ -1436,13 +1436,14 @@ wcf65:: db wcf66:: db NEXTU -; intro and title data +; intro data wIntroSceneFrameCounter:: db -UNION wIntroSceneTimer:: db + NEXTU +; title data +wTitleScreenSelectedOption:: db wTitleScreenTimer:: dw -ENDU NEXTU ; credits data