From eb13b2bd7701246c0ee4ff42831ef9241cd1ef58 Mon Sep 17 00:00:00 2001 From: xCrystal Date: Thu, 4 Apr 2024 12:21:02 +0200 Subject: [PATCH] Use halt more efficiently in 2DMenus, Board Menu, and text printing (#2) (#11) --- engine/board/menu.asm | 3 ++- engine/board/spaces.asm | 1 + engine/menus/menu.asm | 5 +++-- home/print_text.asm | 4 +++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/engine/board/menu.asm b/engine/board/menu.asm index bf13ec252..ef20f9fc4 100755 --- a/engine/board/menu.asm +++ b/engine/board/menu.asm @@ -214,6 +214,7 @@ ApplyBoardMenuSpritePalette: ret GetBoardMenuSelection: + call DelayFrame call JoyTextDelay call GetMenuJoypad bit A_BUTTON_F, a @@ -272,7 +273,7 @@ DEF DIE_MAX_NUMBER EQU 6 ld a, 1 ld [wDieRoll], a call HDMATransferTilemapAndAttrmap_Menu ; - call CloseText ; closetext + call CloseText ; closetext .rotate_die_loop call IsSFXPlaying diff --git a/engine/board/spaces.asm b/engine/board/spaces.asm index d709702bf..048d5b8bc 100755 --- a/engine/board/spaces.asm +++ b/engine/board/spaces.asm @@ -218,6 +218,7 @@ endr PromptPlayerToChooseBranchDirection: ; sample a dpad press or SELECT button + call DelayFrame ld hl, wTempSpaceBranchStruct call GetJoypad ldh a, [hJoyPressed] diff --git a/engine/menus/menu.asm b/engine/menus/menu.asm index dde83721d..2cbdec707 100644 --- a/engine/menus/menu.asm +++ b/engine/menus/menu.asm @@ -233,7 +233,7 @@ MenuJoypadLoop: .loop call Move2DMenuCursor call .BGMap_OAM - call Do2DMenuJoypad + call Do2DMenuJoypad.loop jr nc, .done call _2DMenuInterpretJoypad jr c, .done @@ -262,13 +262,14 @@ MenuJoypadLoop: ret Do2DMenuJoypad: + call DelayFrame .loop call UpdateTimeSensitivePals call Menu_WasButtonPressed ret c ld a, [w2DMenuFlags1] bit 7, a - jr z, .loop + jr z, Do2DMenuJoypad and a ret diff --git a/home/print_text.asm b/home/print_text.asm index 007413d03..b6fa5efa7 100644 --- a/home/print_text.asm +++ b/home/print_text.asm @@ -70,7 +70,9 @@ PrintLetterDelay:: .wait ldh a, [hTextDelayFrames] and a - jr nz, .checkjoypad + jr z, .end + call DelayFrame + jr .checkjoypad .end pop af