Fix multi-PC Goods window; add m2-goods.asm

Moved the BF858 code to a new file because it was getting too long. Added
a clear before each printstr to erase the previous contents.
This commit is contained in:
jeffman 2018-11-27 23:17:16 -05:00
parent fcfbeb2b7a
commit 3308a5756f
2 changed files with 52 additions and 35 deletions

50
m2-goods.asm Normal file
View File

@ -0,0 +1,50 @@
bf858_goods:
push {lr}
// Only render on button press
ldr r0,=0x3002504 // for some reason 3002500 is already cleared when opening the window,
// but 3002504 seems to be a copy of what it used to be?
ldrb r0,[r0]
cmp r0,0
beq @@bf858_goods_end
lsl r2,r5,15
lsr r0,r2,31
mov r2,11
mul r0,r2
add r0,r0,1 // r2 = X tile, 1 or 12 depending on the column
lsr r1,r5,17 // r3 = Y tile
lsl r1,r1,1
mov r2,11
mov r3,r7
push {r0-r1}
bl print_blankstr_window
pop {r0-r1}
mov r2,r0
lsr r3,r1,1
// Check for equip
ldrh r0,[r7,0x3C]
add r0,r8
add r0,1
lsl r0,r0,0x18
lsr r0,r0,0x18
push {r2,r3}
bl 0x80BC670
pop {r2,r3}
lsl r0,r0,0x18
lsr r0,r0,0x18
cmp r0,1
bne @@noequip
add r2,r2,1
@@noequip:
add sp,-4 // Need to push a 0 for the call to m2_printstr
mov r0,0
str r0,[sp]
mov r0,r7 // Window pointer
mov r1,r4 // String pointer
bl 0x80C9634 // m2_printstr
add sp,4
@@bf858_goods_end:
pop {pc}
.pool

View File

@ -108,42 +108,8 @@ b 0x80BADD8
.org 0x80BFB10 :: b 0x80BFB34
.org 0x80BFB34
// Only render on button press
ldr r0,=0x3002504 // for some reason 3002500 is already cleared when opening the window,
// but 3002504 seems to be a copy of what it used to be?
ldrb r0,[r0]
cmp r0,0
beq 0x80BFB84
// Check for equip
ldrh r0,[r7,0x3C]
add r0,r8
add r0,1
lsl r0,r0,0x18
lsr r0,r0,0x18
bl 0x80BC670
mov r3,0
lsl r0,r0,0x18
lsr r0,r0,0x18
cmp r0,1
bne @@noequip
mov r3,1
@@noequip:
lsl r2,r5,15
lsr r2,r2,31
mov r0,11
mul r2,r0
add r2,1
add r2,r2,r3 // r2 = X tile, 1 or 12 depending on the column (+1 if equipped)
lsr r3,r5,17 // r3 = Y tile
add sp,-4 // Need to push a 0 for the call to m2_printstr
mov r0,0
str r0,[sp]
mov r0,r7 // Window pointer
mov r1,r4 // String pointer
bl 0x80C9634 // m2_printstr
add sp,4
bl bf858_goods
b 0x80BFB84 // Skip the remaining nonsense
.pool
// Skip the blank tile drawing after item names
.org 0x80BFBDA :: b 0x80BFBFA
@ -707,5 +673,6 @@ m2_enemy_attributes:
.include "m2-formatting.asm"
.include "m2-customcodes.asm"
.include "m2-compiled.asm"
.include "m2-goods.asm"
.close