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