Improve situation in the battle psi window

Temporally broke the main menu psi window.
This commit is contained in:
Lorenzooone 2019-09-05 12:51:12 +02:00
parent 0d405412ce
commit 0f7438300f
2 changed files with 87 additions and 50 deletions

View File

@ -68,6 +68,24 @@ mov r3,6
.org 0x80BEAA6 :: bl beaa6_fix_sounds .org 0x80BEAA6 :: bl beaa6_fix_sounds
.org 0x80BEA88 :: bl bea88_fix_sounds .org 0x80BEA88 :: bl bea88_fix_sounds
//---------------------------------------------------------
// Main battle window hacks
//---------------------------------------------------------
.org 0x80DC22A :: bl dc22a_load_buffer_battle
//---------------------------------------------------------
// PSI battle window hacks
//---------------------------------------------------------
.org 0x80E0762 :: bl initWindow_buffer
.org 0x80E0776 :: bl print_window_with_buffer
.org 0x80E07C2 :: bl clearWindowTiles_buffer
.org 0x80E0892 :: bl initWindow_buffer
.org 0x80E08A6 :: bl print_window_with_buffer
.org 0x80E0A30 :: bl initWindow_buffer
.org 0x80E0A54 :: bl print_window_with_buffer
//--------------------------------------------------------- //---------------------------------------------------------
// BAC18 hacks (status window) // BAC18 hacks (status window)
//--------------------------------------------------------- //---------------------------------------------------------
@ -89,7 +107,16 @@ mov r3,6
.org 0x80BADCC :: b 0x80BADD8 .org 0x80BADCC :: b 0x80BADD8
//--------------------------------------------------------- //---------------------------------------------------------
// PSI window hacks // Normal PSI window hacks
//---------------------------------------------------------
.org 0x80B8C34 :: bl initWindow_buffer
.org 0x80B8C42 :: bl baec6_psi_window_print_buffer
.org 0x80B8C7E :: bl initWindow_buffer
.org 0x80B8C8C :: bl baec6_psi_window_print_buffer
//---------------------------------------------------------
// Class PSI window hacks
//--------------------------------------------------------- //---------------------------------------------------------
.org 0x80BAE1C :: bl print_window_with_buffer .org 0x80BAE1C :: bl print_window_with_buffer

View File

@ -377,6 +377,15 @@ bl m2_soundeffect
@@end: @@end:
pop {pc} pop {pc}
//==============================================================================
// Loads the buffer up in battle
dc22a_load_buffer_battle:
push {lr}
mov r9,r0
ldr r3,[r5,#0]
bl load_pixels_overworld
pop {pc}
//============================================================================== //==============================================================================
// Calls m2_soundeffect only if we're out of the main menu // Calls m2_soundeffect only if we're out of the main menu
bea88_fix_sounds: bea88_fix_sounds:
@ -696,7 +705,8 @@ push {r0-r3,lr}
mov r0,2 mov r0,2
mov r1,3 mov r1,3
mov r2,1 mov r2,1
bl print_blankstr ldr r3,=#overworld_buffer - 0x2000
bl print_blankstr_buffer
// Render PSI string // Render PSI string
add sp,-4 add sp,-4
@ -707,8 +717,8 @@ ldr r0,[r0] // window pointer
mov r2,1 // highlight mov r2,1 // highlight
str r2,[sp] str r2,[sp]
mov r2,1 mov r2,1
mov r3,1 mov r3,2
bl 0x80C96F0 // render string bl printstr_hlight_buffer // render string
add sp,4 add sp,4
// Clobbered code // Clobbered code
@ -727,11 +737,13 @@ add sp,-4
mov r0,2 mov r0,2
mov r1,1 mov r1,1
mov r2,1 mov r2,1
bl print_blankstr ldr r3,=#overworld_buffer - 0x2000
bl print_blankstr_buffer
mov r0,2 mov r0,2
mov r1,3 mov r1,3
mov r2,1 mov r2,1
bl print_blankstr ldr r3,=#overworld_buffer - 0x2000
bl print_blankstr_buffer
// We need to figure out whether to draw Bash or Do Nothing // We need to figure out whether to draw Bash or Do Nothing
// If [0x2025122] == 2, draw Do Nothing; else, draw Bash // If [0x2025122] == 2, draw Do Nothing; else, draw Bash
@ -752,7 +764,7 @@ mov r2,0 // no highlight
str r2,[sp] str r2,[sp]
mov r2,1 mov r2,1
mov r3,0 mov r3,0
bl 0x80C96F0 // render string bl printstr_hlight_buffer // render string
// Render PSI string // Render PSI string
ldr r0,=0x80DC1EC // address of PSI string pointer ldr r0,=0x80DC1EC // address of PSI string pointer
@ -762,8 +774,8 @@ ldr r0,[r0] // window pointer
mov r2,1 // highlight mov r2,1 // highlight
str r2,[sp] str r2,[sp]
mov r2,1 mov r2,1
mov r3,1 mov r3,2
bl 0x80C96F0 // render string bl printstr_hlight_buffer // render string
add sp,4 add sp,4
// Clobbered code // Clobbered code
@ -1768,7 +1780,6 @@ add r0,#0xA
bx r0 bx r0
@@goToInner: @@goToInner:
bl load_pixels_overworld_psi_window
ldr r0,[r4,#0x1C] //Stores false in vwf_skip, which means the window will be printed ldr r0,[r4,#0x1C] //Stores false in vwf_skip, which means the window will be printed
mov r2,#0 mov r2,#0
strb r2,[r0,#3] strb r2,[r0,#3]
@ -1894,7 +1905,6 @@ strb r2,[r0,#3]
b @@end //Goes to the end of the routine b @@end //Goes to the end of the routine
@@goToInner: @@goToInner:
bl load_pixels_overworld_psi_window
lsl r0,r0,0x10 //Properly stores the output into r4 and, since we're going into the inner window, sets vwf_skip to false lsl r0,r0,0x10 //Properly stores the output into r4 and, since we're going into the inner window, sets vwf_skip to false
asr r4,r0,0x10 asr r4,r0,0x10
ldr r0,[r5,#0x20] ldr r0,[r5,#0x20]
@ -1996,37 +2006,37 @@ pop {pc}
//It sets things up to make it so the target window is only printed once //It sets things up to make it so the target window is only printed once
b8db4_psi_inner_window: b8db4_psi_inner_window:
push {lr} push {lr}
ldrb r1,[r0,#3] ldrb r1,[r0,#3]
push {r1} push {r1}
ldrh r1,[r0,#0x36] //Stores the cursor's Y of the window ldrh r1,[r0,#0x36] //Stores the cursor's Y of the window
push {r1} push {r1}
ldrh r1,[r0,#0x34] //Stores the cursor's X of the window ldrh r1,[r0,#0x34] //Stores the cursor's X of the window
push {r1} push {r1}
bl PSITargetWindowInput //Input management, target printing and header printing function. Now the function takes the cursor's Y and X as arguments too in the stack bl PSITargetWindowInput //Input management, target printing and header printing function. Now the function takes the cursor's Y and X as arguments too in the stack
pop {r2} pop {r2}
ldr r3,[r4,0x24] //Target window ldr r3,[r4,0x24] //Target window
ldrh r1,[r3,#0x34] //Stores the cursor's X of the window ldrh r1,[r3,#0x34] //Stores the cursor's X of the window
cmp r1,r2 cmp r1,r2
bne @@store_buffer_first bne @@store_buffer_first
pop {r2} pop {r2}
ldrh r1,[r3,#0x36] //Stores the cursor's Y of the window ldrh r1,[r3,#0x36] //Stores the cursor's Y of the window
cmp r1,r2 cmp r1,r2
bne @@store_buffer_second bne @@store_buffer_second
pop {r2} pop {r2}
mov r1,#1 mov r1,#1
and r1,r2 and r1,r2
cmp r1,#1 cmp r1,#1
beq @@continue beq @@continue
b @@store_buffer b @@store_buffer
@@store_buffer_first: @@store_buffer_first:
pop {r2} pop {r2}
@@store_buffer_second: @@store_buffer_second:
pop {r2} pop {r2}
@@store_buffer: @@store_buffer:
cmp r0,#0 cmp r0,#0
bne @@continue bne @@continue
bl store_pixels_overworld_psi_window bl store_pixels_overworld_psi_window
@@continue: @@continue:
cmp r0,#0 cmp r0,#0
@ -2045,37 +2055,37 @@ pop {pc}
//It sets things up to make it so the target window is only printed once //It sets things up to make it so the target window is only printed once
e0854_psi_inner_window_battle: e0854_psi_inner_window_battle:
push {lr} push {lr}
ldrb r1,[r0,#3] ldrb r1,[r0,#3]
push {r1} push {r1}
ldrh r1,[r0,#0x36] //Stores the cursor's Y of the window ldrh r1,[r0,#0x36] //Stores the cursor's Y of the window
push {r1} push {r1}
ldrh r1,[r0,#0x34] //Stores the cursor's X of the window ldrh r1,[r0,#0x34] //Stores the cursor's X of the window
push {r1} push {r1}
bl PSITargetWindowInput //Input management, target printing and header printing function. Now the function takes the cursor's Y and X as arguments too in the stack bl PSITargetWindowInput //Input management, target printing and header printing function. Now the function takes the cursor's Y and X as arguments too in the stack
pop {r2} pop {r2}
ldr r3,[r4,0x24] //Target window ldr r3,[r4,0x24] //Target window
ldrh r1,[r3,#0x34] //Stores the cursor's X of the window ldrh r1,[r3,#0x34] //Stores the cursor's X of the window
cmp r1,r2 cmp r1,r2
bne @@store_buffer_first bne @@store_buffer_first
pop {r2} pop {r2}
ldrh r1,[r3,#0x36] //Stores the cursor's Y of the window ldrh r1,[r3,#0x36] //Stores the cursor's Y of the window
cmp r1,r2 cmp r1,r2
bne @@store_buffer_second bne @@store_buffer_second
pop {r2} pop {r2}
mov r1,#1 mov r1,#1
and r1,r2 and r1,r2
cmp r1,#1 cmp r1,#1
beq @@continue beq @@continue
b @@store_buffer b @@store_buffer
@@store_buffer_first: @@store_buffer_first:
pop {r2} pop {r2}
@@store_buffer_second: @@store_buffer_second:
pop {r2} pop {r2}
@@store_buffer: @@store_buffer:
cmp r0,#0 cmp r0,#0
bne @@continue bne @@continue
bl store_pixels_overworld_psi_window bl store_pixels_overworld_psi_window
@@continue: @@continue:
cmp r0,#0 cmp r0,#0
@ -2253,7 +2263,7 @@ pop {pc}
b8c2a_set_proper_wvf_skip_and_window_type: b8c2a_set_proper_wvf_skip_and_window_type:
push {lr} push {lr}
strb r1,[r0,#1] strb r1,[r0,#1]
bl m2_initwindow bl initWindow_buffer
pop {pc} pop {pc}