From 22615cecc5b878ff92f882f34dd0f21e7d0489b9 Mon Sep 17 00:00:00 2001 From: Rangi Date: Fri, 17 Apr 2020 10:52:59 -0400 Subject: [PATCH] More miscellaneous fixes (see #709) --- Makefile | 12 +++--- engine/events/diploma.asm | 2 +- engine/events/print_unown.asm | 6 +-- engine/events/print_unown_2.asm | 2 +- engine/menus/init_gender.asm | 4 +- engine/menus/intro_menu.asm | 2 +- engine/menus/options_menu.asm | 64 +++++++++++++++++++----------- engine/movie/credits.asm | 2 +- engine/overworld/map_setup.asm | 4 +- mobile/mobile_45_sprite_engine.asm | 4 +- wram.asm | 3 +- 11 files changed, 60 insertions(+), 45 deletions(-) diff --git a/Makefile b/Makefile index 4746d399e..e3671d582 100644 --- a/Makefile +++ b/Makefile @@ -93,16 +93,16 @@ endif pokecrystal.gbc: $(crystal_obj) pokecrystal.link - $(RGBLINK) -n pokecrystal.sym -m pokecrystal.map -l pokecrystal.link -o $@ $(crystal_obj) - $(RGBFIX) -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@ + $(RGBLINK) -n pokecrystal.sym -m pokecrystal.map -l pokecrystal.link -p 0 -o $@ $(crystal_obj) + $(RGBFIX) -Cjv -t PM_CRYSTAL -i BYTE -k 01 -l 0x33 -m 0x10 -r 3 -p 0 $@ pokecrystal11.gbc: $(crystal11_obj) pokecrystal.link - $(RGBLINK) -n pokecrystal11.sym -m pokecrystal11.map -l pokecrystal.link -o $@ $(crystal11_obj) - $(RGBFIX) -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -n 1 -p 0 -r 3 -t PM_CRYSTAL $@ + $(RGBLINK) -n pokecrystal11.sym -m pokecrystal11.map -l pokecrystal.link -p 0 -o $@ $(crystal11_obj) + $(RGBFIX) -Cjv -t PM_CRYSTAL -i BYTE -n 1 -k 01 -l 0x33 -m 0x10 -r 3 -p 0 $@ pokecrystal-au.gbc: $(crystal_au_obj) pokecrystal.link - $(RGBLINK) -n pokecrystal-au.sym -m pokecrystal-au.map -l pokecrystal.link -o $@ $(crystal_au_obj) - $(RGBFIX) -Cjv -i BYTU -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@ + $(RGBLINK) -n pokecrystal-au.sym -m pokecrystal-au.map -l pokecrystal.link -p 0 -o $@ $(crystal_au_obj) + $(RGBFIX) -Cjv -t PM_CRYSTAL -i BYTU -k 01 -l 0x33 -m 0x10 -r 3 -p 0 $@ # For files that the compressor can't match, there will be a .lz file suffixed with the md5 hash of the correct uncompressed file. diff --git a/engine/events/diploma.asm b/engine/events/diploma.asm index 7cb982de5..f0008b7fd 100644 --- a/engine/events/diploma.asm +++ b/engine/events/diploma.asm @@ -52,7 +52,7 @@ PlaceDiplomaOnScreen: PrintDiplomaPage2: hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT - ld a, $7f + ld a, " " call ByteFill ld hl, DiplomaPage2Tilemap decoord 0, 0 diff --git a/engine/events/print_unown.asm b/engine/events/print_unown.asm index f90d225fb..484ea3792 100644 --- a/engine/events/print_unown.asm +++ b/engine/events/print_unown.asm @@ -112,7 +112,7 @@ _UnownPrinter: ld a, [hl] and a jr nz, .wrap_around_left - ld [hl], 26 + 1 + ld [hl], NUM_UNOWN + 1 .wrap_around_left dec [hl] jr .return @@ -120,7 +120,7 @@ _UnownPrinter: .press_right ld hl, wJumptableIndex ld a, [hl] - cp 26 + cp NUM_UNOWN jr c, .wrap_around_right ld [hl], -1 .wrap_around_right @@ -132,7 +132,7 @@ _UnownPrinter: .UpdateUnownFrontpic: ld a, [wJumptableIndex] - cp 26 + cp NUM_UNOWN jr z, .vacant inc a ld [wUnownLetter], a diff --git a/engine/events/print_unown_2.asm b/engine/events/print_unown_2.asm index 5dc7b1b94..8751c2434 100644 --- a/engine/events/print_unown_2.asm +++ b/engine/events/print_unown_2.asm @@ -1,7 +1,7 @@ RotateUnownFrontpic: ; something to do with Unown printer push de - xor a ; sScratch + xor a ; BANK(sScratch) call GetSRAMBank ld hl, sScratch ld bc, 0 diff --git a/engine/menus/init_gender.asm b/engine/menus/init_gender.asm index e0e857fb4..4bf8cc2f0 100644 --- a/engine/menus/init_gender.asm +++ b/engine/menus/init_gender.asm @@ -59,9 +59,9 @@ AreYouABoyOrAreYouAGirlText: InitGenderScreen: ld a, $10 ld [wMusicFade], a - ld a, MUSIC_NONE + ld a, LOW(MUSIC_NONE) ld [wMusicFadeID], a - ld a, $0 + ld a, HIGH(MUSIC_NONE) ld [wMusicFadeID + 1], a ld c, 8 call DelayFrames diff --git a/engine/menus/intro_menu.asm b/engine/menus/intro_menu.asm index f3f74d4c5..c2b9f9f09 100644 --- a/engine/menus/intro_menu.asm +++ b/engine/menus/intro_menu.asm @@ -1206,7 +1206,7 @@ TitleScreenMain: inc [hl] ; Fade out the title screen music - xor a + xor a ; MUSIC_NONE ld [wMusicFadeID], a ld [wMusicFadeID + 1], a ld hl, wMusicFade diff --git a/engine/menus/options_menu.asm b/engine/menus/options_menu.asm index 9a6b0fdc7..07f71be26 100644 --- a/engine/menus/options_menu.asm +++ b/engine/menus/options_menu.asm @@ -1,21 +1,34 @@ +; GetOptionPointer.Pointers indexes + const_def + const OPT_TEXT_SPEED ; 0 + const OPT_BATTLE_SCENE ; 1 + const OPT_BATTLE_STYLE ; 2 + const OPT_SOUND ; 3 + const OPT_PRINT ; 4 + const OPT_MENU_ACCOUNT ; 5 + const OPT_FRAME ; 6 + const OPT_CANCEL ; 7 +NUM_OPTIONS EQU const_value ; 8 + _OptionsMenu: ld hl, hInMenu ld a, [hl] push af - ld [hl], $1 + ld [hl], TRUE call ClearBGPalettes hlcoord 0, 0 - ld b, 16 - ld c, 18 + ld b, SCREEN_HEIGHT - 2 + ld c, SCREEN_WIDTH - 2 call Textbox hlcoord 2, 2 ld de, StringOptions call PlaceString xor a ld [wJumptableIndex], a - ld c, $6 ; number of items on the menu minus 1 (for cancel) -.print_text_loop ; this next will display the settings of each option when the menu is opened +; display the settings of each option when the menu is opened + ld c, NUM_OPTIONS - 2 ; omit frame type, the last option +.print_text_loop push bc xor a ldh [hJoyLast], a @@ -25,8 +38,8 @@ _OptionsMenu: inc [hl] dec c jr nz, .print_text_loop + call UpdateFrame ; display the frame type - call UpdateFrame xor a ld [wJumptableIndex], a inc a @@ -78,8 +91,8 @@ StringOptions: db "CANCEL@" GetOptionPointer: - ld a, [wJumptableIndex] ; load the cursor position to a - ld e, a ; copy it to de + ld a, [wJumptableIndex] + ld e, a ld d, 0 ld hl, .Pointers add hl, de @@ -87,9 +100,10 @@ GetOptionPointer: ld a, [hli] ld h, [hl] ld l, a - jp hl ; jump to the code of the current highlighted item + jp hl .Pointers: +; entries correspond to OPT_* constants dw Options_TextSpeed dw Options_BattleScene dw Options_BattleStyle @@ -346,7 +360,7 @@ Options_Print: ld [wGBPrinterBrightness], a .NonePressed: - ld b, $0 + ld b, 0 ld hl, .Strings add hl, bc add hl, bc @@ -500,17 +514,17 @@ OptionsControl: ret .DownPressed: - ld a, [hl] ; load the cursor position to a - cp $7 ; maximum number of items in option menu - jr nz, .CheckFive - ld [hl], $0 + ld a, [hl] + cp OPT_CANCEL ; maximum option index + jr nz, .CheckMenuAccount + ld [hl], OPT_TEXT_SPEED ; first option scf ret -.CheckFive: ; I have no idea why this exists... - cp $5 +.CheckMenuAccount: ; I have no idea why this exists... + cp OPT_MENU_ACCOUNT jr nz, .Increase - ld [hl], $5 + ld [hl], OPT_MENU_ACCOUNT .Increase: inc [hl] @@ -519,16 +533,18 @@ OptionsControl: .UpPressed: ld a, [hl] - cp $6 - jr nz, .NotSix - ld [hl], $5 ; Another thing where I'm not sure why it exists + +; Another thing where I'm not sure why it exists + cp OPT_FRAME + jr nz, .NotFrame + ld [hl], OPT_MENU_ACCOUNT scf ret -.NotSix: - and a +.NotFrame: + and a ; OPT_TEXT_SPEED, minimum option index jr nz, .Decrease - ld [hl], $8 ; number of option items +1 + ld [hl], NUM_OPTIONS ; decrements to OPT_CANCEL, maximum option index .Decrease: dec [hl] @@ -538,7 +554,7 @@ OptionsControl: Options_UpdateCursorPosition: hlcoord 1, 1 ld de, SCREEN_WIDTH - ld c, $10 + ld c, SCREEN_HEIGHT - 2 .loop ld [hl], " " add hl, de diff --git a/engine/movie/credits.asm b/engine/movie/credits.asm index 78985c146..a494d3681 100644 --- a/engine/movie/credits.asm +++ b/engine/movie/credits.asm @@ -85,7 +85,7 @@ Credits:: xor a ldh [hBGMapMode], a ld [wCreditsPos], a - ld [wCreditsUnusedCD21], a + ld [wCreditsPos + 1], a ld [wCreditsTimer], a .execution_loop diff --git a/engine/overworld/map_setup.asm b/engine/overworld/map_setup.asm index 1c84f049a..300f911b1 100644 --- a/engine/overworld/map_setup.asm +++ b/engine/overworld/map_setup.asm @@ -226,9 +226,9 @@ ApplyMapPalettes: ret FadeMapMusicAndPalettes: - ld e, 0 + ld e, LOW(MUSIC_NONE) ld a, [wMusicFadeID] - ld d, 0 + ld d, HIGH(MUSIC_NONE) ld a, [wMusicFadeID + 1] ld a, $4 ld [wMusicFade], a diff --git a/mobile/mobile_45_sprite_engine.asm b/mobile/mobile_45_sprite_engine.asm index b666683e2..d8f2d8b39 100644 --- a/mobile/mobile_45_sprite_engine.asm +++ b/mobile/mobile_45_sprite_engine.asm @@ -704,9 +704,9 @@ Function1163c0: .asm_11642a ld a, $8 ld [wMusicFade], a - ld a, $0 + ld a, LOW(MUSIC_NONE) ld [wMusicFadeID], a - ld a, $0 + ld a, HIGH(MUSIC_NONE) ld [wMusicFadeID + 1], a .asm_116439 diff --git a/wram.asm b/wram.asm index ce41613db..6274cb02d 100644 --- a/wram.asm +++ b/wram.asm @@ -1176,8 +1176,7 @@ wBGMapBufferEnd:: NEXTU ; cd20 ; credits -wCreditsPos:: db -wCreditsUnusedCD21:: db +wCreditsPos:: dw wCreditsTimer:: db NEXTU ; cd20