mirror of
https://github.com/GearsProgress/Poke_Transporter_GB.git
synced 2026-08-23 09:14:24 -05:00
Improve movement data storage
Instead of each macro being a ternary (which can't be constant folded), the values are now stored sequentially. Additionally, I use byte instead of int and made the tables static -1300 bytes.
This commit is contained in:
@@ -182,7 +182,7 @@ void textbox_var::insert_text(const u16 *charset, u8 mg_array[], bool should_set
|
||||
|
||||
// MOVEMENT VAR
|
||||
|
||||
void movement_var::set_movement(const int nMovement[], unsigned int nSize)
|
||||
void movement_var::set_movement(const byte nMovement[], unsigned int nSize)
|
||||
{
|
||||
movement = nMovement;
|
||||
size = nSize;
|
||||
@@ -196,9 +196,12 @@ void movement_var::set_start()
|
||||
void movement_var::insert_movement(u8 mg_array[])
|
||||
{
|
||||
set_start();
|
||||
// movement data is { hoenn, frlg, hoenn, frlg, ...}
|
||||
int offset = curr_GBA_rom.is_hoenn() ? 0 : 1;
|
||||
|
||||
for (unsigned int parser = 0; parser < size; parser++)
|
||||
{
|
||||
mg_array[*curr_loc_ptr] = movement[parser];
|
||||
mg_array[*curr_loc_ptr] = movement[parser * 2 + offset];
|
||||
(*curr_loc_ptr)++;
|
||||
}
|
||||
mg_array[*curr_loc_ptr] = 0xFE; // End list
|
||||
@@ -283,4 +286,4 @@ void music_var::insert_music_data(u8 mg_array[], u8 blockCount, u8 priority, u8
|
||||
mg_array[(*curr_loc_ptr)++] = trackPointers[i] >> 16;
|
||||
mg_array[(*curr_loc_ptr)++] = trackPointers[i] >> 24;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user