diff --git a/include/common_structs.h b/include/common_structs.h index 844512d262..26bfdd3403 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -939,7 +939,9 @@ typedef struct PartnerAnimations { typedef struct Shadow { /* 0x00 */ s32 flags; - /* 0x04 */ char unk_04[12]; + /* 0x04 */ char unk_04[2]; + /* 0x06 */ u8 unk_06; + /* 0x07 */ char unk_07[9]; /* 0x10 */ struct Vec3f position; /* 0x1C */ struct Vec3f scale; /* 0x28 */ char unk_28[80]; diff --git a/src/code_102610_len_2330.c b/src/code_102610_len_2330.c index 79b804e965..3bb67ba3cf 100644 --- a/src/code_102610_len_2330.c +++ b/src/code_102610_len_2330.c @@ -1,22 +1,35 @@ #include "common.h" -INCLUDE_ASM(s32, "code_102610_len_2330", create_shadow_callback); -// Needs rodata support -/*void create_shadow_callback(Shadow* shadow) { +void create_shadow_callback(Shadow* shadow) { shadow->scale.x = 0.1f; shadow->scale.y = 0.1f; shadow->scale.z = 0.1f; -}*/ +} -INCLUDE_ASM(s32, "code_102610_len_2330", func_802E0DB0); +//TODO: make sure this is the right struct for this. +s32 func_802E0DB0(Shadow* shadow) { + + if (((shadow->unk_06 & 4) != 0) && (gPlayerStatus.flags & 2) != 0) { + return 1; + } + return 0; +} INCLUDE_ASM(s32, "code_102610_len_2330", func_802E0DE0); INCLUDE_ASM(s32, "code_102610_len_2330", func_802E10F4); -INCLUDE_ASM(s32, "code_102610_len_2330", func_802E114C); +void func_802E114C(void) { -INCLUDE_ASM(s32, "code_102610_len_2330", func_802E117C); + func_80027088(1); + disable_player_input(); + gPlayerStatusPtr->currentSpeed = 0.0f; +} + +void func_802E117C(void) { + func_80027088(0); + enable_player_input(); +} void save_game_at_player_position(void) { GameStatus* gameStatus = GAME_STATUS; @@ -27,17 +40,67 @@ void save_game_at_player_position(void) { fio_save_game(gameStatus->saveSlot); } -INCLUDE_ASM(s32, "code_102610_len_2330", func_802E1204); +extern s32 D_802EB390; +extern s32 D_802EB394; +extern PrintContext* D_802EB398; +extern PrintContext* D_802EB39C; +extern s32 D_802E99DC; -INCLUDE_ASM(s32, "code_102610_len_2330", func_802E1270); +void func_802E1204(s32 arg0) { -INCLUDE_ASM(s32, "code_102610_len_2330", func_802E1298); + if (get_global_flag(0xF8405BDF) == 0) { + s32 *temp = &D_802EB390; + *temp = 0; + load_string(0x1D0000, temp); + set_global_flag(0xF8405BDF); + return; + } -INCLUDE_ASM(s32, "code_102610_len_2330", func_802E12F8); + func_8010FD68(arg0); + func_8010FD68(arg0); +} -INCLUDE_ASM(s32, "code_102610_len_2330", func_802E1328); +void func_802E1270(void) { + s32* temp = &D_802EB390; -INCLUDE_ASM(s32, "code_102610_len_2330", func_802E1350); + if (*temp != 0) { + func_8010FD68(); + } +} + +void func_802E1298(void) { + s32* temp1 = &D_802EB390; + s32* temp2 = &D_802EB394; + *temp1 = 0; + *temp2 = 0; + D_802EB39C = load_string(0x1D0004, temp2); + D_802EB398 = load_string(0x1E000A, temp1); +} + +void func_802E12F8(void) { + load_message_to_printer(0x1D0005, D_802EB39C); + play_sound(0x10); +} + +void func_802E1328(void) { + s32* temp = &D_802EB394; + + if (*temp != 0) { + func_8010FD68(); + } +} + +void func_802E1350(s32 arg0) { + s32* temp = &D_802EB390; + if (*temp != 0) { + if (D_802EB398->unk_4E8 == 1) { + func_8010FBC0(arg0, &D_802E99DC); + } else { + func_8010FD68(); + } + close_message(D_802EB39C); + } +} INCLUDE_ASM(s32, "code_102610_len_2330", func_802E13B8); diff --git a/undefined_syms.txt b/undefined_syms.txt index 6f335270e1..efdb8d85e1 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -19,6 +19,12 @@ D_8010EBB0 = 0x8010EBB0; D_8010F250 = 0x8010F250; D_80159D50 = 0x80159D50; +D_802EB390 = 0x802EB390; +D_802EB394 = 0x802EB394; +D_802EB398 = 0x802EB398; +D_802EB39C = 0x802EB39C; +D_802E99DC = 0x802E99DC; + gWorldMapVars = 0x802DBCA8; gBattleMapVars = 0x802DBCE8;