From 2db54ecb9b2ec41dd40318395f69814af64f6f7b Mon Sep 17 00:00:00 2001 From: Rangi Date: Thu, 5 Nov 2020 13:23:57 -0500 Subject: [PATCH] Sync more with pokeyellow --- engine/items/inventory.asm | 6 +++--- engine/link/print_waiting_text.asm | 13 +++++++------ engine/math/bcd.asm | 10 +++++++--- home/joypad.asm | 8 ++++---- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/engine/items/inventory.asm b/engine/items/inventory.asm index bf433175..ec1cfd0f 100644 --- a/engine/items/inventory.asm +++ b/engine/items/inventory.asm @@ -27,7 +27,7 @@ AddItemToInventory_:: ld a, [hli] and a jr z, .addNewItem -.loop +.notAtEndOfInventory ld a, [hli] ld b, a ; b = ID of current item in table ld a, [wcf91] ; a = ID of item being added @@ -36,7 +36,7 @@ AddItemToInventory_:: inc hl ld a, [hl] cp $ff ; is it the end of the table? - jr nz, .loop + jr nz, .notAtEndOfInventory .addNewItem ; add an item not yet in the inventory pop hl ld a, d @@ -73,7 +73,7 @@ AddItemToInventory_:: ; if so, store 99 in the current slot and store the rest in a new slot ld a, 99 ld [hli], a - jp .loop + jp .notAtEndOfInventory .increaseItemQuantityFailed pop hl and a diff --git a/engine/link/print_waiting_text.asm b/engine/link/print_waiting_text.asm index d74d635f..1a16e2f2 100644 --- a/engine/link/print_waiting_text.asm +++ b/engine/link/print_waiting_text.asm @@ -1,15 +1,16 @@ PrintWaitingText:: hlcoord 3, 10 - ld b, $1 - ld c, $b + ld b, 1 + ld c, 11 ld a, [wIsInBattle] and a - jr z, .asm_4c17 + jr z, .trade +; battle call TextBoxBorder - jr .asm_4c1a -.asm_4c17 + jr .border_done +.trade call CableClub_TextBoxBorder -.asm_4c1a +.border_done hlcoord 4, 11 ld de, WaitingText call PlaceString diff --git a/engine/math/bcd.asm b/engine/math/bcd.asm index 1e5aedc9..92bf6f17 100644 --- a/engine/math/bcd.asm +++ b/engine/math/bcd.asm @@ -1,6 +1,9 @@ +; divide hMoney by hDivideBCDDivisor +; return output in hDivideBCDQuotient (same as hDivideBCDDivisor) +; used only to halve player money upon losing a fight DivideBCDPredef:: DivideBCDPredef2:: -DivideBCDPredef3:: +DivideBCDPredef3:: ; only used function DivideBCDPredef4:: call GetPredefRegisters @@ -40,6 +43,7 @@ DivideBCD:: and $f0 ldh [hDivideBCDDivisor+2], a jr .mulBy10Loop + .next push de push de @@ -151,8 +155,8 @@ DivideBCD_getNextDigit: pop bc ret c inc b - ld de, hMoney+2 ; since SubBCD works starting from the least significant digit - ld hl, hDivideBCDDivisor+2 + ld de, hMoney + 2 ; since SubBCD works starting from the least significant digit + ld hl, hDivideBCDDivisor + 2 push bc call SubBCD pop bc diff --git a/home/joypad.asm b/home/joypad.asm index 51a77fcc..9bc8663e 100644 --- a/home/joypad.asm +++ b/home/joypad.asm @@ -7,9 +7,9 @@ ReadJoypad:: ld c, 0 ldh [rJOYP], a - REPT 6 +REPT 6 ldh a, [rJOYP] - ENDR +ENDR cpl and %1111 swap a @@ -17,9 +17,9 @@ ReadJoypad:: ld a, 1 << 4 ; select button keys ldh [rJOYP], a - REPT 10 +REPT 10 ldh a, [rJOYP] - ENDR +ENDR cpl and %1111 or b