Sync more with pokeyellow

This commit is contained in:
Rangi 2020-11-05 13:23:57 -05:00
parent 379a563c43
commit 2db54ecb9b
4 changed files with 21 additions and 16 deletions

View file

@ -27,7 +27,7 @@ AddItemToInventory_::
ld a, [hli] ld a, [hli]
and a and a
jr z, .addNewItem jr z, .addNewItem
.loop .notAtEndOfInventory
ld a, [hli] ld a, [hli]
ld b, a ; b = ID of current item in table ld b, a ; b = ID of current item in table
ld a, [wcf91] ; a = ID of item being added ld a, [wcf91] ; a = ID of item being added
@ -36,7 +36,7 @@ AddItemToInventory_::
inc hl inc hl
ld a, [hl] ld a, [hl]
cp $ff ; is it the end of the table? cp $ff ; is it the end of the table?
jr nz, .loop jr nz, .notAtEndOfInventory
.addNewItem ; add an item not yet in the inventory .addNewItem ; add an item not yet in the inventory
pop hl pop hl
ld a, d ld a, d
@ -73,7 +73,7 @@ AddItemToInventory_::
; if so, store 99 in the current slot and store the rest in a new slot ; if so, store 99 in the current slot and store the rest in a new slot
ld a, 99 ld a, 99
ld [hli], a ld [hli], a
jp .loop jp .notAtEndOfInventory
.increaseItemQuantityFailed .increaseItemQuantityFailed
pop hl pop hl
and a and a

View file

@ -1,15 +1,16 @@
PrintWaitingText:: PrintWaitingText::
hlcoord 3, 10 hlcoord 3, 10
ld b, $1 ld b, 1
ld c, $b ld c, 11
ld a, [wIsInBattle] ld a, [wIsInBattle]
and a and a
jr z, .asm_4c17 jr z, .trade
; battle
call TextBoxBorder call TextBoxBorder
jr .asm_4c1a jr .border_done
.asm_4c17 .trade
call CableClub_TextBoxBorder call CableClub_TextBoxBorder
.asm_4c1a .border_done
hlcoord 4, 11 hlcoord 4, 11
ld de, WaitingText ld de, WaitingText
call PlaceString call PlaceString

View file

@ -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:: DivideBCDPredef::
DivideBCDPredef2:: DivideBCDPredef2::
DivideBCDPredef3:: DivideBCDPredef3:: ; only used function
DivideBCDPredef4:: DivideBCDPredef4::
call GetPredefRegisters call GetPredefRegisters
@ -40,6 +43,7 @@ DivideBCD::
and $f0 and $f0
ldh [hDivideBCDDivisor+2], a ldh [hDivideBCDDivisor+2], a
jr .mulBy10Loop jr .mulBy10Loop
.next .next
push de push de
push de push de
@ -151,8 +155,8 @@ DivideBCD_getNextDigit:
pop bc pop bc
ret c ret c
inc b inc b
ld de, hMoney+2 ; since SubBCD works starting from the least significant digit ld de, hMoney + 2 ; since SubBCD works starting from the least significant digit
ld hl, hDivideBCDDivisor+2 ld hl, hDivideBCDDivisor + 2
push bc push bc
call SubBCD call SubBCD
pop bc pop bc

View file

@ -7,9 +7,9 @@ ReadJoypad::
ld c, 0 ld c, 0
ldh [rJOYP], a ldh [rJOYP], a
REPT 6 REPT 6
ldh a, [rJOYP] ldh a, [rJOYP]
ENDR ENDR
cpl cpl
and %1111 and %1111
swap a swap a
@ -17,9 +17,9 @@ ReadJoypad::
ld a, 1 << 4 ; select button keys ld a, 1 << 4 ; select button keys
ldh [rJOYP], a ldh [rJOYP], a
REPT 10 REPT 10
ldh a, [rJOYP] ldh a, [rJOYP]
ENDR ENDR
cpl cpl
and %1111 and %1111
or b or b