Updates customcodes.parse to use new pixel X location

This commit is contained in:
jeffman 2017-03-09 13:16:09 -05:00
parent fc8963d836
commit 1b46ca8904
1 changed files with 10 additions and 18 deletions

View File

@ -12,28 +12,21 @@ m2_customcodes:
.parse:
push {r1-r6,lr}
mov r6,#0
ldr r3,=#m2_custom_wram
add r3,r3,#4
push {r1-r5,lr}
mov r3,#0
mov r4,r0
// Get the window number
mov r0,r2
//bl m2_vwf.get_window_number
//--------------------------------
// 60 FF XX: Add XX pixels to the renderer
cmp r4,#0x60
bne +
mov r6,#3
mov r3,#3
// Get the current X offset
ldrb r4,[r3,r0]
ldrh r4,[r2,#2]
// Get the current X tile
mov r5,#0x2A
ldrb r5,[r2,r5]
ldrh r5,[r2,#0x2A]
lsl r5,r5,#3
add r4,r4,r5 // Current X location (in pixels)
@ -46,12 +39,11 @@ add r4,r4,r5 // New X location
.store_x:
lsl r5,r4,#29
lsr r5,r5,#29
strb r5,[r3,r0]
strh r5,[r2,#2]
// Store the X tile of the new location
lsr r4,r4,#3
mov r5,#0x2A
strb r4,[r2,r5]
strh r4,[r2,#0x2A]
b .parse_end
+
@ -60,7 +52,7 @@ b .parse_end
// 5F FF XX: Set the X value of the renderer
cmp r4,#0x5F
bne +
mov r6,#3
mov r3,#3
// Get the new X value
ldrb r4,[r1,#2]
@ -71,5 +63,5 @@ b .store_x
//--------------------------------
.parse_end:
mov r0,r6
pop {r1-r6,pc}
mov r0,r3
pop {r1-r5,pc}