Complete equip printing (Still need inner window input management for sounds and small arrow for numbers)

This commit is contained in:
Lorenzooone 2019-09-16 03:31:07 +02:00
parent aacde3764f
commit 6505b6bc0d
8 changed files with 448 additions and 59 deletions

View File

@ -4,13 +4,13 @@
#include "locs.h"
int equipReadInput(WINDOW* window)
int equipReadInput(WINDOW* window) //Returns the character whose window we're going in, ACTION_NONE if nothing happens or ACTION_STEPOUT if going out og this window
{
unsigned short previousCharacter = *active_window_party_member;
int currentCharacter = previousCharacter;
PAD_STATE state = *pad_state;
PAD_STATE state_shadow = *pad_state_shadow;
bool printed = false;
bool printed = false; //Used to avoid sound issues. If we printed, we don't make sounds
if(state.right && !window->hold)
currentCharacter += 1;
@ -54,7 +54,7 @@ int equipReadInput(WINDOW* window)
currentCharacter = foundChar;
}
(*active_window_party_member) = currentCharacter;
if(currentCharacter != previousCharacter)
if(currentCharacter != previousCharacter) //Print only if needed
{
equipPrint(window);
printed = true;
@ -115,6 +115,250 @@ int equipReadInput(WINDOW* window)
return ACTION_NONE;
}
void equippablePrint(WINDOW* window) //Prints equippable items (The innermost equip window)
{
unsigned short savedValue = 0;
byte* freeSpace = free_strings_pointers[3];
byte *none = m2_strlookup((int*)0x8B17EE4, (byte*)0x8B17424, 0x2C);
PC *character_data = &(m2_ness_data[*active_window_party_member]);
unsigned short* something = (unsigned short*)0x3005224;
unsigned short* something2 = (unsigned short*)0x300522C;
for(int i = 0; i < 7; i++)
freeSpace[i] = 0;
freeSpace[7] = 0xFF;
int* headerAddress = (int*)(((int)vram) + ((*something2) << 0xE) + ((*tile_offset) << 5));
map_tile(0xB3, window->window_x, window->window_y - 1);
unsigned short val = *something;
if(!window->vwf_skip)
clear_window_header(headerAddress, 8, 0x10, 0x11);
unsigned short* lastUsed = print_equip_header(*something, (unsigned short*)((*tilemap_pointer) + (((window->window_y - 1) << 5) + window->window_x + 1)), headerAddress, window);
window->vwf_skip = true;
if(window->cursor_x > 6) //Mode which prints only 5 items in M12. Used if one has more than 8 items of an equippable kind.
{
clearWindowTiles_buffer(window);
short counter = 0;
while(counter < 5)
{
int value = (window->cursor_x_base * 5) + counter;
byte equippables;
if(value <= 0xD)
equippables = *(window->number_text_area + 4 + value);
else
equippables = 0xFF;
if(equippables == 0xFF)
{
freeSpace[counter] = 0xFD;
printstr_buffer(window, none, 1, counter, false);
break;
}
else
{
byte *item = m2_strlookup((int*)0x8B1AF94, (byte*)0x8B1A694, character_data->goods[equippables - 1]);
byte x = 1;
if(m2_isequipped(equippables))
{
map_special_character(0x1DE,(window->window_x + 1), (counter << 1) + 1); //Print the E
x++;
}
printstr_buffer(window, item, x, counter, false);
freeSpace[counter] = equippables;
counter++;
}
}
byte* str = NULL;
switch(val)
{
case 3:
str = &m12_other_str9; //->Weapons
break;
case 4:
str = &m12_other_str10; //->Body
break;
case 5:
str = &m12_other_str11; //->Arms
break;
case 6:
str = &m12_other_str12; //->Other
break;
default:
break;
}
if(str != NULL)
savedValue = printstr_buffer(window, str, 1, 6, false); //Prints the string, savedValue is used to understand where to print "(X)"
int tmp = m2_div(window->cursor_x, 5);
str = NULL;
if(tmp <= window->cursor_x_base)
str = m2_strlookup((int*)0x8B17EE4, (byte*)0x8B17424, 0x8C);
else
str = m2_strlookup((int*)0x8B17EE4, (byte*)0x8B17424, 0x8D + window->cursor_x_base);
printstr_buffer(window, str, savedValue, 6, false); //Prints "(X)"
freeSpace[5] = 0;
freeSpace[6] = 0xFE;
freeSpace[7] = 0xFF;
}
else //Prints up to 7 equippable items. It's the same as the above cycle, without the cursor_x_base stuff.
{
short counter = 0;
while(counter < 7)
{
byte equippables = *(window->number_text_area + 4 + counter);
if(equippables == 0xFF)
{
freeSpace[counter] = 0xFD;
freeSpace[counter + 1] = 0xFF; //Different from the cycle above
printstr_buffer(window, none, 1, counter, false);
break;
}
else
{
byte *item = m2_strlookup((int*)0x8B1AF94, (byte*)0x8B1A694, character_data->goods[equippables - 1]);
byte x = 1;
if(m2_isequipped(equippables))
{
map_special_character(0x1DE,(window->window_x + 1), (counter << 1) + 1); //Print the E
x++;
}
printstr_buffer(window, item, x, counter, false);
freeSpace[counter] = equippables;
counter++;
}
}
}
window->loaded_code = 0;
}
int equippableReadInput(WINDOW* window) //Manages input in equipment-choice innermost window. Returns the equippable item the cursor is on or ACTION_STEPOUT
{
byte* freeSpace = free_strings_pointers[3];
PC *character_data = &(m2_ness_data[*active_window_party_member]);
bool printed = (window->loaded_code == 1);
// Get weird sign height value
unsigned short height = window->window_height;
unsigned int height_sign_bit = height >> 15;
unsigned int weird_value = (((height + height_sign_bit) << 15) >> 16);
// Clear cursor tiles
map_tile(0x1FF, window->window_x, window->window_y + window->cursor_y * 2);
map_tile(0x1FF, window->window_x, window->window_y + window->cursor_y * 2 + 1);
if(window->loaded_code == 1) //We're printing
equippablePrint(window);
PAD_STATE state = *pad_state;
PAD_STATE state_shadow = *pad_state_shadow;
unsigned short possibleEquippablesCount = window->cursor_x;
short previousY = window->cursor_y;
short currentY = window->cursor_y;
int counter = 0;
//Loads the total amount of items
if(possibleEquippablesCount > 6)
counter = 7;
else if(weird_value > 0)
while(counter < weird_value && freeSpace[counter] != 0xFF)
counter++;
if(state.up)
{
currentY--;
if(currentY < 0)
{
if(window->hold)
currentY = 0;
else
currentY = counter - 1;
}
else
while(freeSpace[currentY] == 0)
currentY--;
}
if(state.down)
{
currentY++;
if(currentY >= counter)
{
if(window->hold)
currentY = counter - 1;
else
currentY = 0;
}
else
while(freeSpace[currentY] == 0)
currentY++;
}
if(state_shadow.up || state_shadow.down)
{
window->counter = 0;
if(previousY != currentY)
m2_soundeffect(0x12F);
window->hold = true;
window->cursor_y = currentY;
}
else
window->hold = false;
if(state.b || state.select)
{
window->counter = 0;
m2_soundeffect(0x12E);
return ACTION_STEPOUT;
}
if((state.a || state.l) && !printed) //Avoid sound issues when going into the window
{
window->counter = 0xFFFF;
m2_soundeffect(0x12D);
if(freeSpace[window->cursor_y] == 0xFE)
{
window->counter = 0;
window->cursor_x_base++;
if(m2_div(window->cursor_x, 5) < window->cursor_x_base)
window->cursor_x_base = 0;
return 0xFE; //Change window counter
}
if(window->cursor_y + 1 < counter)
return freeSpace[window->cursor_y]; //Equipment
return 0xFD; //None
}
if (window->counter != 0xFFFF)
{
window->counter++;
// Draw cursor for current item
map_special_character((window->counter <= 7) ? 0x99 : 0x9A,
window->window_x,
window->window_y + window->cursor_y * 2);
if (window->counter > 0x10)
window->counter = 0;
}
if(window->cursor_y + 1 < counter)
return freeSpace[window->cursor_y];
return 0xFD; //None
}
void equipPrint(WINDOW* window) //Prints equipment
{
m2_hpwindow_up(*active_window_party_member);
@ -150,34 +394,34 @@ void equipPrint(WINDOW* window) //Prints equipment
print_string_in_buffer(nothing, (((window->window_x + 7)) << 3) - 2, (0x1) << 3, (int*)(OVERWORLD_BUFFER - 0x2000));
else
{
item = m2_strlookup((int*)0x8B1AF94, (byte*)0x8B1A694, character_data->equipment[0]);
item = m2_strlookup((int*)0x8B1AF94, (byte*)0x8B1A694, character_data->goods[character_data->equipment[0] - 1]);
map_special_character(0x1DE,(window->window_x + 7), 0x1); //Print the E
printstr_buffer(window, item, 8, 0, false);
}
if(character_data->equipment[1] == 0) //Body
print_string_in_buffer(nothing, (((window->window_x + 7)) << 3) - 2, (0x2) << 3, (int*)(OVERWORLD_BUFFER - 0x2000));
print_string_in_buffer(nothing, (((window->window_x + 7)) << 3) - 2, (0x3) << 3, (int*)(OVERWORLD_BUFFER - 0x2000));
else
{
item = m2_strlookup((int*)0x8B1AF94, (byte*)0x8B1A694, character_data->equipment[1]);
item = m2_strlookup((int*)0x8B1AF94, (byte*)0x8B1A694, character_data->goods[character_data->equipment[1] - 1]);
map_special_character(0x1DE,(window->window_x + 7), 0x3); //Print the E
printstr_buffer(window, item, 8, 1, false);
}
if(character_data->equipment[2] == 0) //Arms
print_string_in_buffer(nothing, (((window->window_x + 6)) << 3) - 2, (0x3) << 3, (int*)(OVERWORLD_BUFFER - 0x2000));
print_string_in_buffer(nothing, (((window->window_x + 7)) << 3) - 2, (0x5) << 3, (int*)(OVERWORLD_BUFFER - 0x2000));
else
{
item = m2_strlookup((int*)0x8B1AF94, (byte*)0x8B1A694, character_data->equipment[2]);
item = m2_strlookup((int*)0x8B1AF94, (byte*)0x8B1A694, character_data->goods[character_data->equipment[2] - 1]);
map_special_character(0x1DE,(window->window_x + 7), 0x5); //Print the E
printstr_buffer(window, item, 8, 2, false);
}
if(character_data->equipment[3] == 0) //Other
print_string_in_buffer(nothing, (((window->window_x + 7)) << 3) - 2, (0x4) << 3, (int*)(OVERWORLD_BUFFER - 0x2000));
print_string_in_buffer(nothing, (((window->window_x + 7)) << 3) - 2, (0x7) << 3, (int*)(OVERWORLD_BUFFER - 0x2000));
else
{
item = m2_strlookup((int*)0x8B1AF94, (byte*)0x8B1A694, character_data->equipment[3]);
item = m2_strlookup((int*)0x8B1AF94, (byte*)0x8B1A694, character_data->goods[character_data->equipment[3] - 1]);
map_special_character(0x1DE,(window->window_x + 7), 0x7); //Print the E
printstr_buffer(window, item, 8, 3, false);
}

View File

@ -6,4 +6,10 @@
void equipPrint(WINDOW* window);
int equipReadInput(WINDOW* window);
extern byte m12_other_str9;
extern byte m12_other_str10;
extern byte m12_other_str11;
extern byte m12_other_str12;
#endif

View File

@ -28,7 +28,6 @@ void setup_User_Dead(byte *String, int *index, byte user, byte target, byte item
void setup_Both_Dead(byte *String, int *index, byte user, byte target, byte item);
void give_print(byte item, byte target, byte source, WINDOW *window, byte *str);
extern bool m2_isequipped(int item_index);
extern void m2_soundeffect(int index);
extern int m2_div(int dividend, int divisor);
extern int m2_sub_a334c(int value);

View File

@ -181,6 +181,23 @@ void print_special_character(int tile, int x, int y)
cpufastset(&vram[(sourceTileIndex + 32) * 8], &vram[(destTileIndex + 32) * 8], 8);
}
// Prints a special tile. Pixels are copied to the VWF buffer. Prints in the buffer
// x, y in pixels
void print_special_character_buffer(int tile, int x, int y, int *dest)
{
// Special graphics must be tile-aligned
x >>= 3;
y >>= 3;
unsigned short sourceTileIndex = tile + *tile_offset;
unsigned short destTileIndex = get_tile_number(x, y) + *tile_offset;
(*tilemap_pointer)[x + (y * 32)] = destTileIndex | *palette_mask;
(*tilemap_pointer)[x + ((y + 1) * 32)] = (destTileIndex + 32) | *palette_mask;
cpufastset(&dest[sourceTileIndex * 8], &dest[destTileIndex * 8], 8);
cpufastset(&dest[(sourceTileIndex + 32) * 8], &dest[(destTileIndex + 32) * 8], 8);
}
// Maps a special character to the given tile coordinates. Only the tilemap is changed.
// x, y in tiles
void map_special_character(unsigned short tile, int x, int y)
@ -398,9 +415,21 @@ unsigned short* print_equip_header(int type, unsigned short *tilemap, unsigned i
// Print (X)
if (window->cursor_x > 6)
{
int buffer[8 * 3];
int mask = WINDOW_HEADER_BG;
for(int i = 0; i < (width & 7); i++) //Saves only the important pixels and deletes the rest in the buffer
mask = (mask << 4) | 0xF;
int *destOffset = dest + (((startX + width) & ~7) + (startY * 32));
for(int i = 0; i < 8; i++)
buffer[i] = destOffset[i] & mask;
for(int i = 0; i < 8 * 2; i++)
buffer[8 + i] = WINDOW_HEADER_BG;
int base = window->cursor_x_base;
str = m2_strlookup(m2_misc_offsets, m2_misc_strings, base + 0x8C);
width += print_window_header_string(dest, str, startX + width, startY);
width += print_window_header_string(buffer, str, width & 7, 0);
for(int i = 0; i < 8 * 3; i++) //Restore the vram
destOffset[i] = buffer[i];
}
// Update tilemap
@ -1160,14 +1189,14 @@ byte print_character_formatted_buffer(byte chr, int x, int y, int font, int fore
// 0x64 to 0x6C (inclusive) is YOU WON
if ((chr >= YOUWON_START) && (chr <= YOUWON_END))
{
print_special_character(chr + 0xF0, x, y);
print_special_character_buffer(chr + 0xF0, x, y, dest);
return 8;
}
// 0x6D is an arrow ->
else if (chr == ARROW)
if (chr == ARROW)
{
print_special_character(ARROW + 0x30, x, y);
print_special_character_buffer(ARROW + 0x30, x, y, dest);
return 8;
}
@ -1240,7 +1269,7 @@ int print_string_in_buffer(byte *str, int x, int y, int *dest)
return (charCount & 0xFFFF) | (totalWidth << 16);
}
void printstr_buffer(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight)
int printstr_buffer(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight)
{
int tmpOffset = window->text_offset;
int tmpOffset2 = window->text_offset2;
@ -1266,7 +1295,7 @@ void printstr_buffer(WINDOW* window, byte* str, unsigned short x, unsigned short
window->delay = 0;
output = print_character_with_codes(window, (int*)(OVERWORLD_BUFFER - ((*tile_offset) * 32)));
}
int retValue = window->text_x + (window->pixel_x == 0 ? 0 : 1);
window->text_start = tmpTextStart;
window->text_offset = tmpOffset;
window->text_offset2 = tmpOffset2;
@ -1274,6 +1303,7 @@ void printstr_buffer(WINDOW* window, byte* str, unsigned short x, unsigned short
window->text_y = tmpText_y;
window->delay_between_prints = tmpDelayPrints;
(*palette_mask) = tmpPaletteMsk;
return retValue;
}
unsigned short printstr_hlight_buffer(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight)

View File

@ -103,7 +103,7 @@ int setNumber_getLength(int value, byte *str, int maxLength);
int print_string_in_buffer(byte *str, int x, int y, int *dest);
void printCashWindow();
WINDOW* getWindow(int index);
void printstr_buffer(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight);
int printstr_buffer(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight);
unsigned short printstr_hlight_buffer(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight);
unsigned short printstr_hlight_pixels_buffer(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight);
@ -124,6 +124,7 @@ extern byte *m2_script_readability;
extern int overworld_buffer;
extern PC m2_ness_data[];
extern bool m2_isequipped(int item_index);
extern void cpufastset(void *source, void *dest, int mode);
extern byte* m2_strlookup(int *offset_table, byte *strings, int index);
extern void m2_formatnumber(int value, byte* strDest, int length);

View File

@ -170,7 +170,7 @@ mov r3,6
.org 0x80B8066 :: bl printstr_hlight_buffer
.org 0x80B8074 :: mov r3,#0x12
.org 0x80B80A6 :: mov r3,#0x0D
.org 0x80B8092 :: bl initWindow_buffer
.org 0x80B8092 :: bl initWindow_buffer //Initialize equipment window
.org 0x80B8098 :: bl print_window_with_buffer
.org 0x80B80BE :: bl initWindow_buffer
.org 0x80B80C4 :: bl print_window_with_buffer
@ -183,43 +183,124 @@ mov r3,6
.org 0x80B81A8 :: bl print_window_with_buffer
.org 0x80B81BC :: bl equipPrint
.org 0x80B81CC :: bl store_pixels_overworld
.org 0x80BAF96 :: bl initWindow_buffer //Go to inner window from outer window
.org 0x80BAF9C :: bl baf9c_print_window_store_buffer
.org 0x80BAFE6 :: mov r2,#6 :: mov r3,#0 :: bl printstr_buffer //Offense Number
.org 0x80BB00C :: mov r2,#6
.org 0x80BB17C :: bl equippableReadInput
.org 0x80BB198 :: mov r2,#9 :: mov r3,#0 :: bl printstr_buffer //Offense Number
.org 0x80BB1A6 :: mov r2,#9 :: mov r3,#1 :: bl bb1aa_printstr_store //Defense Number
.org 0x80BB05E :: bl initWindow_buffer
.org 0x80BB066 :: bl print_window_with_buffer
.org 0x80BB08A :: bl printstr_buffer
.org 0x80BB0A8 :: bl initWindow_buffer
.org 0x80BB24C :: bl initWindow_buffer //Go back to outer window - Also does going back to inner (not innermost) window from weapons - not touched equipment
.org 0x80BB254 :: bl print_window_with_buffer
.org 0x80BB2C2 :: bl initWindow_buffer
.org 0x80BB2CA :: bl print_window_with_buffer
.org 0x80BB2E0 :: bl initWindow_buffer
.org 0x80BB2E8 :: bl print_window_with_buffer
.org 0x80BB2F6 :: bl equipPrint
.org 0x80BB33C :: mov r2,#6
.org 0x80BB340 :: bl printstr_buffer
.org 0x80BB36C :: mov r2,#6
.org 0x80BB370 :: bl printstr_buffer
.org 0x80BB3FC :: bl initWindow_buffer //Go back to inner (not innermost) window from weapons - removed equipment
.org 0x80BB404 :: bl print_window_with_buffer
.org 0x80BB41A :: bl initWindow_buffer
.org 0x80BB422 :: bl print_window_with_buffer
.org 0x80BB430 :: bl equipPrint
.org 0x80BB476 :: mov r2,#6
.org 0x80BB47A :: bl printstr_buffer
.org 0x80BB4A6 :: mov r2,#6
.org 0x80BB4AA :: bl printstr_buffer
.org 0x80BB532 :: bl initWindow_buffer //Go back to inner (not innermost) window from weapons - equipped a weapon
.org 0x80BB53A :: bl print_window_with_buffer
.org 0x80BB550 :: bl initWindow_buffer
.org 0x80BB558 :: bl print_window_with_buffer
.org 0x80BB566 :: bl equipPrint
.org 0x80BB5AC :: mov r2,#6
.org 0x80BB5B0 :: bl printstr_buffer
.org 0x80BB5DC :: mov r2,#6
.org 0x80BB5E0 :: bl printstr_buffer
.org 0x80BB9E4 :: bl initWindow_buffer //Go back to inner (not innermost) window from defensive equipment - not touched equipment
.org 0x80BB9EC :: bl print_window_with_buffer
.org 0x80BBA02 :: bl initWindow_buffer
.org 0x80BBA0A :: bl print_window_with_buffer
.org 0x80BBA18 :: bl equipPrint
.org 0x80BBA5E :: mov r2,#6
.org 0x80BBA62 :: bl printstr_buffer
.org 0x80BBA8E :: mov r2,#6
.org 0x80BBA92 :: bl printstr_buffer
.org 0x80BBB2C :: bl initWindow_buffer //Go back to inner (not innermost) window from defensive equipment - removed equipment
.org 0x80BBB34 :: bl print_window_with_buffer
.org 0x80BBB4A :: bl initWindow_buffer
.org 0x80BBB52 :: bl print_window_with_buffer
.org 0x80BBB60 :: bl equipPrint
.org 0x80BBBA6 :: mov r2,#6
.org 0x80BBBAA :: bl printstr_buffer
.org 0x80BBBD6 :: mov r2,#6
.org 0x80BBBDA :: bl printstr_buffer
.org 0x80BBC8A :: bl initWindow_buffer //Go back to inner (not innermost) window from defensive equipment - equipped something
.org 0x80BBC92 :: bl print_window_with_buffer
.org 0x80BBCA8 :: bl initWindow_buffer
.org 0x80BBCB0 :: bl print_window_with_buffer
.org 0x80BBCBE :: bl equipPrint
.org 0x80BBD04 :: mov r2,#6
.org 0x80BBD08 :: bl printstr_buffer
.org 0x80BBD34 :: mov r2,#6
.org 0x80BBD38 :: bl printstr_buffer
//When first entering the innermost menu
.org 0x80BB6E0 :: mov r2,#0xA :: mov r3,#0 :: bl printstr_buffer //Change second offense number's position - Weapon
.org 0x80BB710 :: mov r2,#0xA :: mov r3,#1 :: bl bb1aa_printstr_store //Change second defense number's position - Weapon
.org 0x80BB820 :: mov r2,#0xA :: mov r3,#1 :: bl printstr_buffer //Change second defense number's position - Body
.org 0x80BB950 :: mov r2,#0xA :: mov r3,#1 :: bl printstr_buffer //Change second defense number's position - Arms
.org 0x80BBE8E :: mov r2,#0xA :: mov r3,#1 :: bl printstr_buffer //Change second defense number's position - Other
.org 0x80BBEBE :: mov r2,#0xA :: mov r3,#0 :: bl bb1aa_printstr_store //Change second offense number's position - Other
//When changing selection in the innermost menu
.org 0x80BBDF0 :: mov r2,#0xA :: mov r3,#1 :: bl printstr_buffer //Change second defense number's position - Defensive Equipment
.org 0x80BBE20 :: mov r2,#0xA :: mov r3,#0 :: bl bb1aa_printstr_store //Change second offense number's position - Defensive Equipment
//---------------------------------------------------------
// BAEF8 hacks (equip window)
//---------------------------------------------------------
// Erase offense change
.macro erase_offense
mov r0,0xC
.macro erase_offense_buffer
mov r0,0xB
mov r1,0xB
mov r2,4
bl print_blankstr
bl bb21c_print_blankstr_buffer
.endmacro
.macro erase_defense
mov r0,0xC
.macro erase_defense_buffer
mov r0,0xB
mov r1,0xD
mov r2,4
bl print_blankstr
bl bb21c_print_blankstr_buffer
.endmacro
.org 0x80BB216 :: erase_offense
.org 0x80BB38C :: erase_offense
.org 0x80BB4C6 :: erase_offense
.org 0x80BB5FC :: erase_offense
.org 0x80BBAAE :: erase_offense
.org 0x80BBBF6 :: erase_offense
.org 0x80BBD54 :: erase_offense
.macro erase_defense_buffer_store
mov r0,0xB
mov r1,0xD
mov r2,4
bl bb21c_print_blankstr_buffer_store
.endmacro
.org 0x80BB216 :: erase_offense_buffer
.org 0x80BB38C :: erase_offense_buffer
.org 0x80BB4C6 :: erase_offense_buffer
.org 0x80BB5FC :: erase_offense_buffer
.org 0x80BBAAE :: erase_offense_buffer
.org 0x80BBBF6 :: erase_offense_buffer
.org 0x80BBD54 :: erase_offense_buffer
// Erase defense change
.org 0x80BB226 :: erase_defense
.org 0x80BBABE :: erase_defense
.org 0x80BBC06 :: erase_defense
.org 0x80BBD64 :: erase_defense
.org 0x80BB226 :: erase_defense_buffer
.org 0x80BBABE :: erase_defense_buffer_store
.org 0x80BBC06 :: erase_defense_buffer_store
.org 0x80BBD64 :: erase_defense_buffer_store
// Erase offense/defense after changing equipment
.org 0x80BB3E2 :: bl baef8_reequip_erase

View File

@ -258,11 +258,11 @@ push {r0-r3}
mov r0,8
mov r1,0xB
mov r2,8
bl print_blankstr
bl bb21c_print_blankstr_buffer
mov r0,8
mov r1,0xD
mov r2,8
bl print_blankstr
bl bb21c_print_blankstr_buffer
pop {r0-r3}
// Clobbered code
@ -279,11 +279,11 @@ push {r0-r3}
mov r0,8
mov r1,0xB
mov r2,8
bl print_blankstr
bl bb21c_print_blankstr_buffer
mov r0,8
mov r1,0xD
mov r2,8
bl print_blankstr
bl bb21c_print_blankstr_buffer
pop {r0-r3}
// Clobbered code
@ -309,7 +309,7 @@ push {r0-r3,lr}
mov r0,5
mov r1,0xF
mov r2,0x14
bl print_blankstr
bl bb21c_print_blankstr_buffer
pop {r0-r3,pc}
//==============================================================================
@ -448,7 +448,7 @@ beq @@next
// If flag 0x10 is set, clear the PSI window
ldr r0,[r5,0x1C] // PSI window
ldr r1,=#0x2012000
ldr r1,=#overworld_buffer - 0x2000
bl clear_window_buffer
@@next:
@ -462,14 +462,16 @@ pop {pc}
// Clear offense/defense when re-equipping (or un-equipping) something
baef8_reequip_erase:
push {r0-r3,lr}
mov r0,8
mov r0,7
mov r1,0xB
mov r2,4
bl print_blankstr
mov r0,8
ldr r3,=#overworld_buffer - 0x2000
bl print_blankstr_buffer
mov r0,7
mov r1,0xD
mov r2,4
bl print_blankstr
ldr r3,=#overworld_buffer - 0x2000
bl print_blankstr_buffer
// Clobbered code
pop {r0-r3}
@ -706,7 +708,7 @@ ldrh r0,[r0]
cmp r0,0
beq @@next
ldr r0,=#0x3005230
ldr r1,=#0x2012000
ldr r1,=#overworld_buffer - 0x2000
ldr r0,[r0,0x1C]
bl clear_window_buffer
@ -2016,6 +2018,14 @@ bx r0 //Jump to the next useful piece of code
.pool
//==============================================================================
//Calls print_window_with_buffer and then stores the buffer
baf9c_print_window_store_buffer:
push {lr}
bl print_window_with_buffer
bl store_pixels_overworld
pop {pc}
//==============================================================================
//Fixes issue with sounds when going from the PSI window to the inner PSI window
b8d40_psi_going_inner_window:
@ -2253,7 +2263,7 @@ orr r2,r1
strb r2,[r4,#0x3]
mov r3,r0
mov r0,r4
ldr r1,=#0x2012000
ldr r1,=#overworld_buffer - 0x2000
mov r4,r3
bl clear_window_buffer
mov r0,r4
@ -2529,13 +2539,31 @@ bx r0
//==============================================================================
//Prints defense number and then sotres the buffer
bb1aa_printstr_store:
push {lr}
push {r4,lr}
mov r4,r3
mov r3,#0
push {r3}
mov r3,#1
mov r3,r4
bl printstr_buffer
bl store_pixels_overworld
pop {r3}
pop {r4,pc}
//==============================================================================
//Prints blankstr in the buffer
bb21c_print_blankstr_buffer:
push {lr}
ldr r3,=#overworld_buffer - 0x2000
bl print_blankstr_buffer
pop {pc}
//==============================================================================
//Prints blankstr in the buffer and stores it
bb21c_print_blankstr_buffer_store:
push {lr}
ldr r3,=#overworld_buffer - 0x2000
bl print_blankstr_buffer
bl store_pixels_overworld
pop {pc}
//==============================================================================
@ -2549,7 +2577,7 @@ ldsh r2,[r0,r2] //Window's Y cursor
add r1,r1,r2
ldrb r1,[r1,#0] //Selected item
push {r1}
bl 0x80C5500 //Input management function - returns the currently selected item
bl equippableReadInput //Input management function - returns the currently selected item
pop {r1}
cmp r1,r0 //Has the currently selected item changed?
bne @@refresh
@ -2655,14 +2683,14 @@ bx r0
//Clears the rightmost part of the Offense/Defense window for the innermost equipment menu
clear_offense_defense_inner_equip:
push {lr}
mov r0,0xD
mov r0,0xC
mov r1,0xB
mov r2,0x3
bl print_blankstr
mov r0,0xD
bl bb21c_print_blankstr_buffer
mov r0,0xC
mov r1,0xD
mov r2,0x3
bl print_blankstr
bl bb21c_print_blankstr_buffer
pop {pc}
.pool

View File

@ -273,28 +273,28 @@
"OffsetLocation": 11632512,
"OldPointer": 11630284,
"Old": "ぶき[00 FF]",
"New": "Weapon[00 FF]"
"New": "[5F FF 0E]Weapon[00 FF]"
},
{
"Index": 39,
"OffsetLocation": 11632516,
"OldPointer": 11630288,
"Old": "ボディ[00 FF]",
"New": "Body[00 FF]"
"New": "[5F FF 1A]Body[00 FF]"
},
{
"Index": 40,
"OffsetLocation": 11632520,
"OldPointer": 11630293,
"Old": "うで[00 FF]",
"New": "Arms[00 FF]"
"New": "[5F FF 17]Arms[00 FF]"
},
{
"Index": 41,
"OffsetLocation": 11632524,
"OldPointer": 11630297,
"Old": "そのた[00 FF]",
"New": "Other[00 FF]"
"New": "[5F FF 17]Other[00 FF]"
},
{
"Index": 42,