mirror of
https://github.com/leoetlino/project-restoration
synced 2025-10-06 00:32:43 +02:00
Update common_data.h and main.cpp (#174)
* Update common_data.h and main.cpp Some more decomp'd things like the RespawnData. Increased assert size due to the fact that sub13s[8] contains respawn data. Created RespawnData struct. Found some BitFields that indicate counters for items. Found bitfiled for sword and shield. Include enums for sword and shield. * Keep naming convention. * Remove extra value in sub13s. Update raw to u32. Collect Register didn't change in main? * Remove old BitField.
This commit is contained in:
@@ -9,6 +9,19 @@
|
||||
|
||||
namespace game {
|
||||
|
||||
enum class SwordType : u16 {
|
||||
NoSword = 0,
|
||||
KokiriSword = 1,
|
||||
RazorSword = 2,
|
||||
GildedSword = 3,
|
||||
};
|
||||
|
||||
enum class ShieldType : u16 {
|
||||
NoShield = 0,
|
||||
HeroShield = 1,
|
||||
MirrorShield = 2,
|
||||
};
|
||||
|
||||
struct __attribute__((packed)) __attribute__((aligned(2))) PlayerData {
|
||||
u32 field_11C;
|
||||
u8 gap_120[2];
|
||||
@@ -54,10 +67,10 @@ union FormEquipmentData {
|
||||
struct EquipmentData {
|
||||
FormEquipmentData data[4];
|
||||
char field_14;
|
||||
char anonymous_24;
|
||||
char anonymous_25;
|
||||
char anonymous_26;
|
||||
char anonymous_27;
|
||||
ItemId item_on_y_readonly;
|
||||
ItemId item_on_x_readonly;
|
||||
ItemId item_on_i_readonly;
|
||||
ItemId item_on_ii_readonly;
|
||||
char field_19;
|
||||
char field_1A;
|
||||
char field_1B;
|
||||
@@ -73,7 +86,13 @@ struct EquipmentData {
|
||||
char field_25;
|
||||
char field_26;
|
||||
char field_27;
|
||||
u16 anonymous_28;
|
||||
union SwordShield {
|
||||
u16 raw;
|
||||
|
||||
BitField<0, 4, SwordType> sword;
|
||||
BitField<4, 8, ShieldType> shield;
|
||||
};
|
||||
SwordShield sword_shield;
|
||||
};
|
||||
|
||||
struct InventoryData {
|
||||
@@ -83,7 +102,14 @@ struct InventoryData {
|
||||
u8 field_48[24];
|
||||
u8 field_60[24];
|
||||
int non_equip_register;
|
||||
int collect_register;
|
||||
union CollectRegister {
|
||||
u32 raw;
|
||||
|
||||
BitField<4, 1, int> bombers_notebook;
|
||||
// TODO: Lots of different counts in here.
|
||||
BitField<28, 4, int> heart_container_pieces;
|
||||
};
|
||||
CollectRegister collect_register;
|
||||
char anonymous_33[1];
|
||||
char anonymous_34[3];
|
||||
u8 gap200[6];
|
||||
@@ -106,6 +132,7 @@ struct SaveData {
|
||||
MaskId mask;
|
||||
bool has_completed_intro;
|
||||
char unused;
|
||||
// Possible cutscene ID?
|
||||
char anonymous_0;
|
||||
bool is_night;
|
||||
/// Number of extra time units to add per game tick (0 normally; -1 with ISoT)
|
||||
@@ -162,7 +189,13 @@ struct SaveData {
|
||||
int anonymous_57;
|
||||
int anonymous_58;
|
||||
u8 gap11EC[36];
|
||||
int anonymous_59;
|
||||
union SkulltulaRegister {
|
||||
u32 raw;
|
||||
|
||||
BitField<0, 16, int> swamp_count;
|
||||
BitField<16, 16, int> ocean_count;
|
||||
};
|
||||
SkulltulaRegister skulltulas_collected;
|
||||
int anonymous_60;
|
||||
u8 gap1218[4];
|
||||
int anonymous_61;
|
||||
@@ -475,19 +508,24 @@ struct CommonDataSub12 {
|
||||
int field_14;
|
||||
};
|
||||
|
||||
struct CommonDataSub13 {
|
||||
u32 field_C;
|
||||
u32 field_10;
|
||||
u32 field_14;
|
||||
u16 field_18;
|
||||
u16 field_1A;
|
||||
u16 field_1C;
|
||||
char field_1E;
|
||||
char field_1F;
|
||||
u32 field_20;
|
||||
u32 field_24;
|
||||
u32 field_28;
|
||||
struct RespawnData {
|
||||
Vec3 pos;
|
||||
s16 yaw;
|
||||
s16 player_params;
|
||||
s16 entrance_index;
|
||||
u8 room_index;
|
||||
s8 data;
|
||||
u32 temp_swch_flags_maybe;
|
||||
u8 field_1;
|
||||
// Swaps to zero when an item can be used, 255 otherwise.
|
||||
u8 btn_y_can_use_item;
|
||||
u8 btn_x_can_use_item;
|
||||
u8 btn_i_can_use_item;
|
||||
//u32 stored_mask_id_maybe;
|
||||
u32 temp_collect_flags_maybe;
|
||||
};
|
||||
static_assert(sizeof(RespawnData) == 0x20);
|
||||
|
||||
|
||||
enum class UsableButton : u8 {
|
||||
B = 0,
|
||||
@@ -571,7 +609,7 @@ struct CommonData {
|
||||
int setup;
|
||||
int setup2;
|
||||
int field_13624;
|
||||
CommonDataSub13 sub13s[8];
|
||||
RespawnData sub13s[8];
|
||||
u32 field_13728;
|
||||
int field_1372C;
|
||||
char field_13730;
|
||||
|
@@ -167,7 +167,7 @@ RST_HOOK void UiScheduleTriggerHook() {
|
||||
const bool select = gctx->pad_state.input.new_buttons.IsSet(game::pad::Button::Select);
|
||||
if (!zr && select)
|
||||
game::ui::OpenScreen(game::ui::ScreenType::Items);
|
||||
if (!zr && start && game::GetCommonData().save.inventory.collect_register & 0x40000)
|
||||
if (!zr && start && game::GetCommonData().save.inventory.collect_register.bombers_notebook)
|
||||
game::ui::OpenScreen(game::ui::ScreenType::Schedule);
|
||||
if (zr && start)
|
||||
game::ui::OpenScreen(game::ui::ScreenType::Quest);
|
||||
|
Reference in New Issue
Block a user