Working on Goods windows (not finished)

This commit is contained in:
jeffman 2015-03-23 17:43:19 -04:00
parent c59838b37d
commit db37e18c44
2 changed files with 163 additions and 15 deletions

View File

@ -38,16 +38,25 @@ org $80C9116; push {lr}; bl m2_vwf.status; b $80C9144
// Goods entry
org $80BFB3E; bl m2_vwf.goods; b $80BFB78 // unfocused
org $80BF0E2; bl m2_vwf.goods2; b $80BF11A // focused
org $80BFB98; b $80BFBCC // skip drawing equip symbol
org $80BF134; b $80BF15E
org $80C0162; bl m2_vwf.goods2; b $80C0192 // giving item
org $80B999C; bl m2_vwf.goods_highlight
// Goods -- skip drawing equip symbols
org $80BFB98; b $80BFBCC
org $80BF134; b $80BF15E
org $80C01B2; b $80C01DC
// Goods -- dirty flags
org $80BF91E; bl m2_vwf.goods_dirty1
org $80BF8FA; bl m2_vwf.goods_dirty2
org $80BF8FC; bl m2_vwf.goods_dirty2
org $80B8540; bl m2_vwf.goods_dirty3
org $80BFC0E; bl m2_vwf.goods_clean
org $80C01F2; bl m2_vwf.goods_clean
org $80BF054; bl m2_vwf.goods_dirty4
org $80BFF34; bl m2_vwf.goods_dirty1
org $80BFF12; bl m2_vwf.goods_dirty2
org $80C00D4; bl m2_vwf.goods_dirty5
org $80BA688; bl m2_vwf.goods_redraw // pressing B from Give window
// Menu select entry
org $80B7FC6; bl m2_vwf.print_string_relative

View File

@ -80,6 +80,8 @@ pop {r1-r3,pc}
// [r5 + 0x28]: window height
// [r5 + 0x2A]: relative text X
// [r5 + 0x2C]: relative text Y
// [r5 + 0x34]: cursor X
// [r5 + 0x36]: cursor Y
// r1: address of char to print
// r2: address of map entry
//==============================================================================
@ -1543,7 +1545,7 @@ pop {pc}
.goods2:
print "m2vwf.goods2: $",pc
push {lr}
push {r5,lr}
//--------------------------------
// Check if the item is equipped
@ -1626,26 +1628,20 @@ pop {r6,r7}
//--------------------------------
.goods2_skip:
// Advance r4 and r6
// Advance r6
sub r1,r0,#1
asr r0,r0,#3
add r1,r0,#1
//ldr r2,=#0xFFFF0000
-
cmp r1,#0
beq +
//lsl r0,r4,#0x10
//add r0,r0,r2
//lsr r4,r0,#0x10
add r6,r6,#2
sub r1,r1,#1
b -
+
pop {pc}
pop {r5,pc}
//==============================================================================
@ -1776,7 +1772,7 @@ pop {r1,pc}
.goods_dirty2:
print "m2vwf.goods_dirty2: $",pc
push {lr}
push {r0,lr}
// Set the dirty flag
mov r0,r7
@ -1788,9 +1784,9 @@ mov r0,r7
bl .clear_window
// Clobbered code
mov r0,r4
pop {r0}
add r0,#0x1
mov r1,r9
pop {pc}
@ -1843,6 +1839,149 @@ mov r8,r6
pop {r1,pc}
//==============================================================================
// void goods_dirty5()
//==============================================================================
.goods_dirty5:
print "m2vwf.goods_dirty5: $",pc
push {r0,lr}
// Check the dirty flag
bl .get_dirty_flag
cmp r0,#0
bne +
// It's dirty, so erase the window
pop {r0}
bl $80CA834
pop {pc}
+
pop {r0,pc}
//==============================================================================
// void goods_redraw()
//==============================================================================
.goods_redraw:
print "m2vwf.goods_redraw: $",pc
push {r0-r7,lr}
//--------------------------------
// Set the dirty flag
ldr r0,=#0x3005240
ldr r0,[r0,#0]
ldr r2,=#m2_custom_wram
add r2,#0x14
mov r4,#0
strb r4,[r2,r0]
//--------------------------------
// Clear window
ldr r0,=#0x3005240
ldr r0,[r0,#0]
mov r5,r0
bl .clear_window
//================================
// Redraw each item text
//================================
ldr r6,=#0x8B1AF94
ldr r7,=#0x8B1A694
// Get inventory pointer
ldr r0,=#0x3005264
ldrb r1,[r0,#0] // get character number
mov r0,#0x6C
mul r1,r0
ldr r0,=#0x3001D54
add r1,r0,r1 // inventory pointer
// Read the item number
ldrh r2,[r1,#0]
// Get the item address
mov r0,r6
mov r1,r7
bl $80BE260
mov r2,r0
// Set the X and Y
mov r3,#0x22
ldrh r0,[r5,r3] // text area X
add r0,#1
mov r3,#0x24
ldrh r1,[r5,r3] // text area Y
// Draw
bl .print_string
////--------------------------------
//// Redraw the goods window
//ldr r0,=#0x3005264
//ldrb r1,[r0,#0] // get character number
//mov r0,#0x6C
//mul r1,r0
//ldr r0,=#0x3001D54
//add r1,r0,r1 // inventory pointer
//mov r5,r1
//ldr r0,=#0x3005240
//ldr r0,[r0,#0] // get Goods window address
//mov r4,r0
//mov r2,#8
//strb r2,[r0,#1] // need to set this flag for some reason
//bl $80BEB6C
//
////--------------------------------
//// Redraw the highlighted item
//
//// Get the item index from the cursor coords
//add r4,#0x34
//ldrh r1,[r4,#0] // X
//add r6,r1,#0
//cmp r1,#0xB
//bne +
//mov r1,#1
//+
//ldrh r0,[r4,#2] // Y
//mov r7,r0
//lsl r0,r0,#1
//add r0,r0,r1 // item index
//
//// Get the item number
//lsl r2,r0,#1
//ldrh r2,[r5,r2] // item number
//
//// Get the item's text address
//ldr r0,=#0x8B1AF94
//ldr r1,=#0x8B1A694
//bl $80BE260 // r0 = address
//
//// Draw the text
//add sp,#-4
//mov r1,#1
//str r1,[sp,#0]
//mov r1,r0
//sub r4,#0x34
//mov r0,r4
//mov r2,r6
//mov r3,r7
//bl $80C9634
//add sp,#4
//--------------------------------
// Clobbered code
pop {r0-r7}
bl $80C8BE4
pop {pc}
//==============================================================================
// void get_coords(TILEMAP* map)
// In: