Complete PSI window in battle
This commit is contained in:
parent
f3808c4e85
commit
fe145bf79e
|
@ -3,19 +3,20 @@
|
|||
#include "number-selector.h"
|
||||
#include "locs.h"
|
||||
|
||||
//Prints enemy target window
|
||||
void printTargetOfAttack(short a, short target)
|
||||
{
|
||||
WINDOW *window = getWindow(3);
|
||||
m2_setupwindow(window, 0x9, 0x3, 0x14, 0x2);
|
||||
initWindow_buffer(window, NULL, 0);
|
||||
printstr_buffer(window, &m12_battle_commands_str11, 0, 0, false);
|
||||
printstr_buffer(window, &m12_battle_commands_str11, 0, 0, false); //To
|
||||
if(target != -1)
|
||||
{
|
||||
printstr_hlight_buffer(window, &m12_battle_commands_str14, 8, 0, 0);
|
||||
printstr_hlight_buffer(window, &m12_battle_commands_str14, 8, 0, false);// " "
|
||||
short *pointer = (short*)(0x20248E0 + 0x83E);
|
||||
byte *pointer2 = (byte*)(0x20248E0);
|
||||
byte *pointer2 = (byte*)(pointer);
|
||||
short value = *pointer;
|
||||
m2_setupBattleName((a * value) + target + 1);
|
||||
m2_setupbattlename((a * value) + target + 1);
|
||||
byte* str = ((*((byte**)0x3005220)) + 0x4C0);
|
||||
printstr_buffer(window, str, 2, 0, false);
|
||||
if(a != 0)
|
||||
|
@ -30,8 +31,63 @@ void printTargetOfAttack(short a, short target)
|
|||
else
|
||||
{
|
||||
if(a == 0) //a is the row here
|
||||
printstr_buffer(window, &m12_battle_commands_str12, 2, 0, false);
|
||||
printstr_buffer(window, &m12_battle_commands_str12, 2, 0, false); //the Front Row
|
||||
else
|
||||
printstr_buffer(window, &m12_battle_commands_str13, 2, 0, false);
|
||||
printstr_buffer(window, &m12_battle_commands_str13, 2, 0, false); //the Back Row
|
||||
}
|
||||
}
|
||||
|
||||
//Only implements up to Goods right now
|
||||
void printBattleMenu(byte validXs, byte validYs, byte highlighted)
|
||||
{
|
||||
unsigned short* drawValue = (unsigned short*)0x2025122;
|
||||
byte *str;
|
||||
WINDOW* window = getWindow(0);
|
||||
if(validXs & 1)
|
||||
{
|
||||
if(validYs & 1)
|
||||
{
|
||||
print_blankstr_buffer(2,1,5,(int*)(OVERWORLD_BUFFER - 0x2000));
|
||||
if((*drawValue) == 2)
|
||||
{
|
||||
print_blankstr_buffer(7,1,5,(int*)(OVERWORLD_BUFFER - 0x2000));
|
||||
str = &m12_battle_commands_str10; //Do Nothing
|
||||
}
|
||||
else if((*drawValue) == 1)
|
||||
str = &m12_battle_commands_str6; //Shoot
|
||||
else
|
||||
str = &m12_battle_commands_str0; //Bash
|
||||
printstr_hlight_buffer(window, str, 1, 0, highlighted & 1);
|
||||
}
|
||||
|
||||
if(validYs & 2)
|
||||
{
|
||||
print_blankstr_buffer(2,3,5,(int*)(OVERWORLD_BUFFER - 0x2000));
|
||||
if((*active_window_party_member) != 2)
|
||||
printstr_hlight_buffer(window, &m12_battle_commands_str3, 1, 1, highlighted & 2); //PSI
|
||||
else
|
||||
printstr_hlight_buffer(window, &m12_battle_commands_str7, 1, 1, highlighted & 2); //Spy
|
||||
}
|
||||
}
|
||||
|
||||
if(validXs & 2)
|
||||
{
|
||||
if(validYs & 1)
|
||||
{
|
||||
if((*drawValue) != 2)
|
||||
{
|
||||
print_blankstr_buffer(7,1,5,(int*)(OVERWORLD_BUFFER - 0x2000));
|
||||
printstr_hlight_buffer(window, &m12_battle_commands_str1, 6, 0, highlighted & 4); //Goods
|
||||
}
|
||||
}
|
||||
|
||||
if(validYs & 2)
|
||||
{
|
||||
print_blankstr_buffer(7,3,5,(int*)(OVERWORLD_BUFFER - 0x2000));
|
||||
if((*drawValue) != 2)
|
||||
{
|
||||
printstr_hlight_buffer(window, &m12_battle_commands_str4, 6, 1, highlighted & 8); //Defend
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,7 +4,15 @@
|
|||
#include "vwf.h"
|
||||
|
||||
void printTargetOfAttack(short a, short target);
|
||||
void printBattleMenu(byte validXs, byte validYs, byte highlighted);
|
||||
|
||||
extern byte m12_battle_commands_str0;
|
||||
extern byte m12_battle_commands_str1;
|
||||
extern byte m12_battle_commands_str3;
|
||||
extern byte m12_battle_commands_str4;
|
||||
extern byte m12_battle_commands_str6;
|
||||
extern byte m12_battle_commands_str7;
|
||||
extern byte m12_battle_commands_str10;
|
||||
extern byte m12_battle_commands_str11;
|
||||
extern byte m12_battle_commands_str12;
|
||||
extern byte m12_battle_commands_str13;
|
||||
|
|
|
@ -19,4 +19,4 @@ int __attribute__((naked)) m2_setupwindow(WINDOW* window, short window_x, short
|
|||
int __attribute__((naked)) m2_clearwindowtiles(WINDOW* window) {}
|
||||
int __attribute__((naked)) customcodes_parse_generic(int code, char* parserAddress, WINDOW* window, int* dest) {}
|
||||
void __attribute__((naked)) m2_printstr(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight) {}
|
||||
void __attribute__((naked)) m2_setupBattleName(short value) {}
|
||||
void __attribute__((naked)) m2_setupbattlename(short value) {}
|
|
@ -138,4 +138,4 @@ extern int customcodes_parse_generic(int code, char* parserAddress, WINDOW* wind
|
|||
extern void m2_sub_d3c50();
|
||||
extern void m2_sub_d6844();
|
||||
extern int m2_setupwindow(WINDOW* window, short window_x, short window_y, short window_width, short window_height);
|
||||
extern void m2_setupBattleName(short value);
|
||||
extern void m2_setupbattlename(short value);
|
||||
|
|
|
@ -95,6 +95,7 @@ mov r3,6
|
|||
.org 0x80C24CC :: bl printstr_hlight_buffer
|
||||
.org 0x80C2500 :: bl printstr_hlight_buffer
|
||||
.org 0x80C2518 :: bl printstr_hlight_buffer
|
||||
.org 0x80E08D8 :: bl e06ec_redraw_bash_psi_goods_defend
|
||||
|
||||
//---------------------------------------------------------
|
||||
// BAC18 hacks (status window)
|
||||
|
@ -1640,7 +1641,7 @@ m2_coord_table_file:
|
|||
.definelabel m2_hpwindow_up ,0x80D3F0C
|
||||
.definelabel m2_curhpwindow_down ,0x80D41D8
|
||||
.definelabel m2_sub_d6844 ,0x80D6844
|
||||
.definelabel m2_setupBattleName ,0x80DCD00
|
||||
.definelabel m2_setupbattlename ,0x80DCD00
|
||||
.definelabel m2_stat_symb_checker ,0x8B0EDA4
|
||||
.definelabel m2_div ,0x80F49D8
|
||||
.definelabel m2_remainder ,0x80F4A70
|
||||
|
|
|
@ -724,25 +724,10 @@ pop {pc}
|
|||
e06ec_redraw_psi:
|
||||
push {r0-r3,lr}
|
||||
|
||||
// Clear old tiles
|
||||
mov r0,2
|
||||
mov r1,3
|
||||
mov r2,1
|
||||
ldr r3,=#overworld_buffer - 0x2000
|
||||
bl print_blankstr_buffer
|
||||
|
||||
// Render PSI string
|
||||
add sp,-4
|
||||
ldr r0,=0x80DC1EC // address of PSI string pointer
|
||||
ldr r1,[r0] // PSI string pointer
|
||||
ldr r0,=0x3005230
|
||||
ldr r0,[r0] // window pointer
|
||||
mov r2,1 // highlight
|
||||
str r2,[sp]
|
||||
mov r2,1
|
||||
mov r3,1
|
||||
bl printstr_hlight_buffer // render string
|
||||
add sp,4
|
||||
mov r0,#1
|
||||
mov r1,#2
|
||||
mov r2,#2
|
||||
bl printBattleMenu
|
||||
|
||||
// Clobbered code
|
||||
pop {r0-r3}
|
||||
|
@ -754,52 +739,10 @@ pop {pc}
|
|||
// Redraw Bash/Do Nothing and PSI commands when exiting PSI ally target subwindow
|
||||
e06ec_redraw_bash_psi:
|
||||
push {r0-r3,lr}
|
||||
add sp,-4
|
||||
|
||||
// Clear old tiles
|
||||
mov r0,2
|
||||
mov r1,1
|
||||
mov r2,1
|
||||
ldr r3,=#overworld_buffer - 0x2000
|
||||
bl print_blankstr_buffer
|
||||
mov r0,2
|
||||
mov r1,3
|
||||
mov r2,1
|
||||
ldr r3,=#overworld_buffer - 0x2000
|
||||
bl print_blankstr_buffer
|
||||
|
||||
// We need to figure out whether to draw Bash or Do Nothing
|
||||
// If [0x2025122] == 2, draw Do Nothing; else, draw Bash
|
||||
// We'll never draw Shoot because Jeff doesn't use PSI
|
||||
ldr r0,=0x2025122
|
||||
ldrh r0,[r0]
|
||||
cmp r0,2
|
||||
beq @@donothing
|
||||
ldr r0,=0x80DBFB0
|
||||
b @@next
|
||||
@@donothing:
|
||||
ldr r0,=0x80DC108
|
||||
@@next:
|
||||
ldr r1,[r0]
|
||||
ldr r0,=0x3005230
|
||||
ldr r0,[r0] // window pointer
|
||||
mov r2,0 // no highlight
|
||||
str r2,[sp]
|
||||
mov r2,1
|
||||
mov r3,0
|
||||
bl printstr_hlight_buffer // render string
|
||||
|
||||
// Render PSI string
|
||||
ldr r0,=0x80DC1EC // address of PSI string pointer
|
||||
ldr r1,[r0] // PSI string pointer
|
||||
ldr r0,=0x3005230
|
||||
ldr r0,[r0] // window pointer
|
||||
mov r2,1 // highlight
|
||||
str r2,[sp]
|
||||
mov r2,1
|
||||
mov r3,1
|
||||
bl printstr_hlight_buffer // render string
|
||||
add sp,4
|
||||
mov r0,#1
|
||||
mov r1,#3
|
||||
mov r2,#2
|
||||
bl printBattleMenu
|
||||
|
||||
// Clobbered code
|
||||
pop {r0-r3}
|
||||
|
@ -807,12 +750,59 @@ bl 0x80BD7F8 // restore tilemaps
|
|||
pop {pc}
|
||||
.pool
|
||||
|
||||
//==============================================================================
|
||||
// Redraw Bash/Do Nothing, PSI commands, Goods and Defend when choosing enemy target
|
||||
e06ec_redraw_bash_psi_goods_defend:
|
||||
push {lr}
|
||||
push {r0-r3}
|
||||
ldr r2,=#0x8B204E4 //Is this an offensive PSI which needs a target? If so, redraw the background window
|
||||
ldr r1,=#0x8B2A9B0
|
||||
ldr r0,[r6,#0x1C]
|
||||
ldr r0,[r0,#0x10]
|
||||
ldrh r3,[r0,#2]
|
||||
lsl r3,r3,#4
|
||||
add r0,r3,r1
|
||||
ldrh r3,[r0,#4]
|
||||
lsl r0,r3,#1
|
||||
add r0,r0,r3
|
||||
lsl r0,r0,#2
|
||||
add r3,r0,r2
|
||||
ldrb r0,[r3,#1]
|
||||
cmp r0,#1
|
||||
beq @@keep
|
||||
cmp r0,#3
|
||||
bne @@notOffensive //Otherwise, do not do it
|
||||
@@keep:
|
||||
ldrb r0,[r3]
|
||||
cmp r0,#0
|
||||
bne @@notOffensive
|
||||
|
||||
mov r0,#3
|
||||
mov r1,#3
|
||||
mov r2,#2
|
||||
bl printBattleMenu
|
||||
|
||||
@@notOffensive:
|
||||
|
||||
pop {r0-r3}
|
||||
|
||||
bl 0x80C2480 //Prints the target
|
||||
pop {pc}
|
||||
.pool
|
||||
|
||||
//==============================================================================
|
||||
//Calls the funcion which loads the targets in and then stores the buffer
|
||||
ba8ac_load_targets_print:
|
||||
push {lr}
|
||||
ldr r2,=#0x20248AC
|
||||
ldrh r2,[r2,#0]
|
||||
push {r2}
|
||||
bl 0x80BAA80
|
||||
pop {r2}
|
||||
cmp r2,#0
|
||||
bne @@end //Store the buffer to vram only if the target window was printed.
|
||||
bl store_pixels_overworld
|
||||
@@end:
|
||||
pop {pc}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue