Outer Equip window buffering
Fixes sounds for Outer Equip window. Temporally breaks the Inner Equip windows.
This commit is contained in:
parent
a8a221ae2d
commit
7582652071
|
@ -18,6 +18,7 @@ $input_c_files =
|
||||||
"src/c/fileselect.c",
|
"src/c/fileselect.c",
|
||||||
"src/c/status.c",
|
"src/c/status.c",
|
||||||
"src/c/battle.c",
|
"src/c/battle.c",
|
||||||
|
"src/c/equip.c",
|
||||||
"src/c/psi.c"
|
"src/c/psi.c"
|
||||||
|
|
||||||
$base_c_address = 0x83755B8;
|
$base_c_address = 0x83755B8;
|
||||||
|
|
|
@ -0,0 +1,184 @@
|
||||||
|
#include "window.h"
|
||||||
|
#include "equip.h"
|
||||||
|
#include "number-selector.h"
|
||||||
|
#include "locs.h"
|
||||||
|
|
||||||
|
|
||||||
|
int equipReadInput(WINDOW* 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;
|
||||||
|
|
||||||
|
if(state.right && !window->hold)
|
||||||
|
currentCharacter += 1;
|
||||||
|
|
||||||
|
if(state.left && !window->hold)
|
||||||
|
currentCharacter -= 1;
|
||||||
|
|
||||||
|
if((state.left || state.right) && !window->hold)
|
||||||
|
{
|
||||||
|
window->unknown7 = 0;
|
||||||
|
if(state.left)
|
||||||
|
{
|
||||||
|
if(currentCharacter < 0)
|
||||||
|
currentCharacter = 3;
|
||||||
|
int foundChar = currentCharacter;
|
||||||
|
for(int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
if (foundChar < 0)
|
||||||
|
foundChar = 3;
|
||||||
|
if ((*pc_flags)[foundChar])
|
||||||
|
break;
|
||||||
|
|
||||||
|
foundChar--;
|
||||||
|
}
|
||||||
|
currentCharacter = foundChar;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(currentCharacter > 3)
|
||||||
|
currentCharacter = 0;
|
||||||
|
int foundChar = currentCharacter;
|
||||||
|
for(int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
if (foundChar > 3)
|
||||||
|
foundChar = 0;
|
||||||
|
if ((*pc_flags)[foundChar])
|
||||||
|
break;
|
||||||
|
|
||||||
|
foundChar++;
|
||||||
|
}
|
||||||
|
currentCharacter = foundChar;
|
||||||
|
}
|
||||||
|
(*active_window_party_member) = currentCharacter;
|
||||||
|
if(currentCharacter != previousCharacter)
|
||||||
|
{
|
||||||
|
equipPrint(window);
|
||||||
|
printed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(state_shadow.right || state_shadow.left)
|
||||||
|
{
|
||||||
|
if(state.right || state.left)
|
||||||
|
{
|
||||||
|
if(currentCharacter != previousCharacter)
|
||||||
|
m2_soundeffect(0x131);
|
||||||
|
}
|
||||||
|
window->hold = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
window->hold = false;
|
||||||
|
|
||||||
|
if(state.b || state.select)
|
||||||
|
{
|
||||||
|
if(!printed)
|
||||||
|
m2_soundeffect(0x12E);
|
||||||
|
window->counter = 0;
|
||||||
|
return ACTION_STEPOUT;
|
||||||
|
}
|
||||||
|
else if(state.a || state.l)
|
||||||
|
{
|
||||||
|
if(!printed)
|
||||||
|
m2_soundeffect(0x12D);
|
||||||
|
if((*pc_count) > 1)
|
||||||
|
{
|
||||||
|
unsigned short *arrangementBase = (*tilemap_pointer) + (((window->window_y - 1) << 5) + window->window_x + window->window_width - 4);
|
||||||
|
unsigned short topTile = ((*tile_offset) + 0x96) | (*palette_mask) | 0x800;
|
||||||
|
(*arrangementBase) = topTile;
|
||||||
|
(*(arrangementBase + 1)) = topTile;
|
||||||
|
(*(arrangementBase + 2)) = topTile;
|
||||||
|
(*(arrangementBase + 3)) = topTile;
|
||||||
|
}
|
||||||
|
|
||||||
|
window->counter = 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
window->counter++;
|
||||||
|
|
||||||
|
if (*pc_count > 1)
|
||||||
|
{
|
||||||
|
// We're doing a bit of simplification here.
|
||||||
|
// The Japanese version tries to highlight the arrow you pressed.
|
||||||
|
// It only shows for a couple frames and it looks weird, so we're
|
||||||
|
// just going to show the arrows and not bother with the direction indicator.
|
||||||
|
draw_window_arrows(window, window->counter < 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window->counter > 16)
|
||||||
|
window->counter = 0;
|
||||||
|
|
||||||
|
return ACTION_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void equipPrint(WINDOW* window) //Prints equipment
|
||||||
|
{
|
||||||
|
m2_hpwindow_up(*active_window_party_member);
|
||||||
|
|
||||||
|
// Draw window header
|
||||||
|
map_tile(0xB3, window->window_x, window->window_y - 1);
|
||||||
|
clear_name_header(window);
|
||||||
|
copy_name_header(window, *active_window_party_member);
|
||||||
|
|
||||||
|
PC *character_data = &(m2_ness_data[*active_window_party_member]);
|
||||||
|
byte *nothing = m2_strlookup((int*)0x8B17EE4, (byte*)0x8B17424, 0x2A);
|
||||||
|
byte *item;
|
||||||
|
|
||||||
|
//Clear the previous equipment
|
||||||
|
print_blankstr_buffer(window->window_x + 6, 1, 0xC, (int*)(OVERWORLD_BUFFER - 0x2000));
|
||||||
|
print_blankstr_buffer(window->window_x + 6, 3, 0xC, (int*)(OVERWORLD_BUFFER - 0x2000));
|
||||||
|
print_blankstr_buffer(window->window_x + 6, 5, 0xC, (int*)(OVERWORLD_BUFFER - 0x2000));
|
||||||
|
print_blankstr_buffer(window->window_x + 6, 7, 0xC, (int*)(OVERWORLD_BUFFER - 0x2000));
|
||||||
|
|
||||||
|
//Clear the previous numbers
|
||||||
|
print_blankstr_buffer(7, 0xB, 0x8, (int*)(OVERWORLD_BUFFER - 0x2000));
|
||||||
|
print_blankstr_buffer(7, 0xD, 0x8, (int*)(OVERWORLD_BUFFER - 0x2000));
|
||||||
|
|
||||||
|
//Reprint the ":"s
|
||||||
|
|
||||||
|
print_character_with_callback(decode_character(0x6A), ((window->window_x + 6) << 3), (0x1 << 3), 0, 0xF, (int*)(OVERWORLD_BUFFER - 0x2000), &get_tile_number_with_offset, *tilemap_pointer, 32, 0xC);
|
||||||
|
print_character_with_callback(decode_character(0x6A), ((window->window_x + 6) << 3), (0x3 << 3), 0, 0xF, (int*)(OVERWORLD_BUFFER - 0x2000), &get_tile_number_with_offset, *tilemap_pointer, 32, 0xC);
|
||||||
|
print_character_with_callback(decode_character(0x6A), ((window->window_x + 6) << 3), (0x5 << 3), 0, 0xF, (int*)(OVERWORLD_BUFFER - 0x2000), &get_tile_number_with_offset, *tilemap_pointer, 32, 0xC);
|
||||||
|
print_character_with_callback(decode_character(0x6A), ((window->window_x + 6) << 3), (0x7 << 3), 0, 0xF, (int*)(OVERWORLD_BUFFER - 0x2000), &get_tile_number_with_offset, *tilemap_pointer, 32, 0xC);
|
||||||
|
|
||||||
|
//Print the equipment
|
||||||
|
if(character_data->equipment[0] == 0) //Weapon
|
||||||
|
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]);
|
||||||
|
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));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
item = m2_strlookup((int*)0x8B1AF94, (byte*)0x8B1A694, character_data->equipment[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));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
item = m2_strlookup((int*)0x8B1AF94, (byte*)0x8B1A694, character_data->equipment[2]);
|
||||||
|
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));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
item = m2_strlookup((int*)0x8B1AF94, (byte*)0x8B1A694, character_data->equipment[3]);
|
||||||
|
map_special_character(0x1DE,(window->window_x + 7), 0x7); //Print the E
|
||||||
|
printstr_buffer(window, item, 8, 3, false);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
#ifndef HEADER_EQUIP_INCLUDED
|
||||||
|
#define HEADER_EQUIP_INCLUDED
|
||||||
|
|
||||||
|
#include "vwf.h"
|
||||||
|
|
||||||
|
void equipPrint(WINDOW* window);
|
||||||
|
int equipReadInput(WINDOW* window);
|
||||||
|
|
||||||
|
#endif
|
|
@ -29,6 +29,7 @@
|
||||||
byte decode_character(byte chr);
|
byte decode_character(byte chr);
|
||||||
byte encode_ascii(char chr);
|
byte encode_ascii(char chr);
|
||||||
int get_tile_number(int x, int y);
|
int get_tile_number(int x, int y);
|
||||||
|
int get_tile_number_with_offset(int x, int y);
|
||||||
int ascii_strlen(char *str);
|
int ascii_strlen(char *str);
|
||||||
int wrapper_count_pixels_to_tiles(byte *str, int length);
|
int wrapper_count_pixels_to_tiles(byte *str, int length);
|
||||||
int count_pixels_to_tiles(byte *str, int length, int startingPos);
|
int count_pixels_to_tiles(byte *str, int length, int startingPos);
|
||||||
|
|
|
@ -62,6 +62,7 @@ mov r3,6
|
||||||
//.org 0x80B8A3C :: bl print_window_with_buffer
|
//.org 0x80B8A3C :: bl print_window_with_buffer
|
||||||
.org 0x80B8890 :: bl print_window_with_buffer :: bl b8894_printCashWindowAndStore //Main window + Cash Window out of Status menu
|
.org 0x80B8890 :: bl print_window_with_buffer :: bl b8894_printCashWindowAndStore //Main window + Cash Window out of Status menu
|
||||||
.org 0x80B8664 :: bl print_window_with_buffer :: bl b8894_printCashWindowAndStore //Main window + Cash Window out of PSI menu
|
.org 0x80B8664 :: bl print_window_with_buffer :: bl b8894_printCashWindowAndStore //Main window + Cash Window out of PSI menu
|
||||||
|
.org 0x80B8740 :: bl print_window_with_buffer :: bl b8894_printCashWindowAndStore //Main window + Cash Window out of Equip menu
|
||||||
.org 0x80B831A :: bl initWindow_buffer
|
.org 0x80B831A :: bl initWindow_buffer
|
||||||
.org 0x80B8320 :: bl b8320_statusWindowTextStore
|
.org 0x80B8320 :: bl b8320_statusWindowTextStore
|
||||||
|
|
||||||
|
@ -166,7 +167,26 @@ mov r3,6
|
||||||
// Equip window generic hacks
|
// Equip window generic hacks
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
|
|
||||||
|
.org 0x80B8066 :: bl printstr_hlight_buffer
|
||||||
.org 0x80B8074 :: mov r3,#0x12
|
.org 0x80B8074 :: mov r3,#0x12
|
||||||
|
.org 0x80B80A6 :: mov r3,#0x0D
|
||||||
|
.org 0x80B8092 :: bl initWindow_buffer
|
||||||
|
.org 0x80B8098 :: bl print_window_with_buffer
|
||||||
|
.org 0x80B80BE :: bl initWindow_buffer
|
||||||
|
.org 0x80B80C4 :: bl print_window_with_buffer
|
||||||
|
.org 0x80B80EA :: mov r2,#6 :: mov r3,#0 :: bl printstr_buffer //Offense Number
|
||||||
|
.org 0x80B8112 :: mov r2,#6 :: mov r3,#1 :: bl printstr_buffer //Defense Number
|
||||||
|
.org 0x80B8138 :: bl initWindow_buffer
|
||||||
|
.org 0x80B813E :: bl print_window_with_buffer
|
||||||
|
.org 0x80B814A :: bl equipPrint
|
||||||
|
.org 0x80B81A2 :: bl initWindow_buffer
|
||||||
|
.org 0x80B81A8 :: bl print_window_with_buffer
|
||||||
|
.org 0x80B81BC :: bl equipPrint
|
||||||
|
.org 0x80B81CC :: bl store_pixels_overworld
|
||||||
|
.org 0x80BAFE6 :: mov r2,#6 :: mov r3,#0 :: bl printstr_buffer //Offense Number
|
||||||
|
.org 0x80BB00C :: mov r2,#6
|
||||||
|
.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
|
||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
// BAEF8 hacks (equip window)
|
// BAEF8 hacks (equip window)
|
||||||
|
|
|
@ -2442,7 +2442,7 @@ push {lr}
|
||||||
ldr r1,=#m2_active_window_pc
|
ldr r1,=#m2_active_window_pc
|
||||||
ldrb r1,[r1,#0]
|
ldrb r1,[r1,#0]
|
||||||
push {r1} //Stores the active_window_pc
|
push {r1} //Stores the active_window_pc
|
||||||
bl 0x80C4EB0 //Input management function
|
bl equipReadInput //Input management function
|
||||||
pop {r1}
|
pop {r1}
|
||||||
cmp r0,#0 //Has an action happened? (Are we entering/exiting the menu?)
|
cmp r0,#0 //Has an action happened? (Are we entering/exiting the menu?)
|
||||||
beq @@check_character_change
|
beq @@check_character_change
|
||||||
|
@ -2526,6 +2526,17 @@ bx r0
|
||||||
|
|
||||||
.pool
|
.pool
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
//Prints defense number and then sotres the buffer
|
||||||
|
bb1aa_printstr_store:
|
||||||
|
push {lr}
|
||||||
|
mov r3,#0
|
||||||
|
push {r3}
|
||||||
|
mov r3,#1
|
||||||
|
bl printstr_buffer
|
||||||
|
bl store_pixels_overworld
|
||||||
|
pop {r3}
|
||||||
|
pop {pc}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
//Set things up so the numbers for Offense and Defense for the innermost equipment window is only printed when needed
|
//Set things up so the numbers for Offense and Defense for the innermost equipment window is only printed when needed
|
||||||
|
|
|
@ -266,7 +266,7 @@
|
||||||
"OffsetLocation": 11632508,
|
"OffsetLocation": 11632508,
|
||||||
"OldPointer": 11630256,
|
"OldPointer": 11630256,
|
||||||
"Old": " ぶき :[01 FF] ボディ:[01 FF] うで :[01 FF] そのた:[00 FF]",
|
"Old": " ぶき :[01 FF] ボディ:[01 FF] うで :[01 FF] そのた:[00 FF]",
|
||||||
"New": "[5F FF 08]Weapon:[01 FF][5F FF 08]Body:[01 FF][5F FF 08]Arms:[01 FF][5F FF 08]Other:[00 FF]"
|
"New": "[5F FF 0E]Weapon[01 FF][5F FF 1A]Body[01 FF][5F FF 17]Arms[01 FF][5F FF 17]Other[00 FF]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Index": 38,
|
"Index": 38,
|
||||||
|
@ -301,14 +301,14 @@
|
||||||
"OffsetLocation": 11632528,
|
"OffsetLocation": 11632528,
|
||||||
"OldPointer": 11630302,
|
"OldPointer": 11630302,
|
||||||
"Old": "(なし) [00 FF]",
|
"Old": "(なし) [00 FF]",
|
||||||
"New": "(None)[00 FF]"
|
"New": "(Nothing)[00 FF]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Index": 43,
|
"Index": 43,
|
||||||
"OffsetLocation": 11632532,
|
"OffsetLocation": 11632532,
|
||||||
"OldPointer": 11630314,
|
"OldPointer": 11630314,
|
||||||
"Old": " オフェンス:[01 FF]ディフェンス:[00 FF]",
|
"Old": " オフェンス:[01 FF]ディフェンス:[00 FF]",
|
||||||
"New": "[5F FF 08]Offense:[01 FF][5F FF 08]Defense:[00 FF]"
|
"New": "Offense:[01 FF]Defense:[00 FF]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Index": 44,
|
"Index": 44,
|
||||||
|
|
Loading…
Reference in New Issue