diff options
| -rw-r--r-- | include/m_common_data.h | 3 | ||||
| -rw-r--r-- | include/m_field_info.h | 2 | ||||
| -rw-r--r-- | include/m_kankyo.h | 5 | ||||
| -rw-r--r-- | include/m_lights.h | 4 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_Lamp_Light/ef_lamp_light.c | 119 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_Lamp_Light/ef_lamp_light.h | 5 | ||||
| -rw-r--r-- | yamls/jp/overlays.yaml | 2 |
7 files changed, 123 insertions, 17 deletions
diff --git a/include/m_common_data.h b/include/m_common_data.h index c1f797c..0f58d81 100644 --- a/include/m_common_data.h +++ b/include/m_common_data.h @@ -234,7 +234,8 @@ typedef struct CommonData { /* 0x104AA */ u16 last_field_id; /* 0x104AC */ UNK_TYPE1 unk_104AC[0x1]; /* 0x104AD */ u8 unk_104AD; - /* 0x104AE */ UNK_TYPE1 unk_104AE[0x2]; + /* 0x104AE */ u8 unk_104AE; + /* 0x104AF */ UNK_TYPE1 unk_104AF[0x1]; /* 0x104B0 */ UNK_TYPE1 unk_104B0[0xE8]; /* 0x10598 */ mQst_not_saved_c quest; /* 0x105A0 */ u32 scene_from_title_demo; diff --git a/include/m_field_info.h b/include/m_field_info.h index 52deaa6..556ede8 100644 --- a/include/m_field_info.h +++ b/include/m_field_info.h @@ -10,7 +10,7 @@ struct Game_Play; // void func_80087C30_jp(); // void func_80087C40_jp(); // void func_80087C64_jp(); -// void mFI_GetFieldId(); +s32 mFI_GetFieldId(void); // void func_80087C9C_jp(); // void func_80087D30_jp(); // void func_80087DC8_jp(); diff --git a/include/m_kankyo.h b/include/m_kankyo.h index 8fc91a3..a10a24e 100644 --- a/include/m_kankyo.h +++ b/include/m_kankyo.h @@ -6,6 +6,7 @@ struct Actor; struct Global_light; +struct Lights; typedef void (*Kankyo_unk_C0)(struct Actor*); @@ -15,7 +16,9 @@ typedef struct Kankyo { /* 0x03 */ s8 unk_03; /* 0x04 */ s8 unk_04; /* 0x05 */ UNK_TYPE1 unk_05[0x3]; - /* 0x08 */ UNK_TYPE1 unk_08[0xA6]; + /* 0x08 */ UNK_TYPE1 unk_08[0x14]; + /* 0x1C */ struct Lights* unk_1C; + /* 0x2C */ UNK_TYPE1 unk_20[0x8E]; /* 0xAE */ u8 unk_AE; /* 0xAF */ u8 unk_AF; /* 0xB0 */ u8 unk_B0; diff --git a/include/m_lights.h b/include/m_lights.h index 95e5a3c..5fbeef4 100644 --- a/include/m_lights.h +++ b/include/m_lights.h @@ -33,8 +33,8 @@ typedef union { typedef struct Lights { /* 0x00 */ u8 type; - /* 0x04 */ LightParams lights; -} Lights; // size = 0x10 + /* 0x02 */ LightParams lights; +} Lights; // size = 0xE typedef struct LightNode { /* 0x0 */ Lights* info; diff --git a/src/overlays/actors/ovl_Lamp_Light/ef_lamp_light.c b/src/overlays/actors/ovl_Lamp_Light/ef_lamp_light.c index 81ddf08..8f9da28 100644 --- a/src/overlays/actors/ovl_Lamp_Light/ef_lamp_light.c +++ b/src/overlays/actors/ovl_Lamp_Light/ef_lamp_light.c @@ -2,13 +2,19 @@ #include "m_lib.h" #include "m_actor_dlftbls.h" #include "m_object.h" +#include "m_field_info.h" #include "overlays/gamestates/ovl_play/m_play.h" +#define THIS ((Lamp_Light*)thisx) + void Ef_Lamp_Light_actor_ct(Actor* thisx, Game_Play* game_play); void Ef_Lamp_Light_actor_dt(Actor* thisx, Game_Play* game_play); +s32 eLL_get_light_sw_other_room(void); +s32 eLL_get_light_sw_player_room(Lamp_Light* this UNUSED); +s32 eLL_get_light_sw_start_demo(void); +void eLL_ctrl_light_sw(Lamp_Light* this); void Ef_Lamp_Light_actor_move(Actor* thisx, Game_Play* game_play); -#if 0 ActorProfile Lamp_Light_Profile = { /* */ ACTOR_LAMP_LIGHT, /* */ ACTOR_PART_6, @@ -19,21 +25,114 @@ ActorProfile Lamp_Light_Profile = { /* */ Ef_Lamp_Light_actor_ct, /* */ Ef_Lamp_Light_actor_dt, /* */ Ef_Lamp_Light_actor_move, - /* */ (ActorFunc)none_proc1, + /* */ (void*)none_proc1, /* */ NULL, }; -#endif +static s16 add_data_off[4] = { 2, 2, 1, 0 }; +static s16 add_data_on[4] = { 0x10, 0x10, 8, 0 }; +static s16* add_data[2] = { add_data_off, add_data_on }; +static s16 cmp_data_off[4] = { 0, 0, 0, 0 }; +static s16 cmp_data_on[4] = { 0xC8, 0xC8, 0x96, 0 }; +static s16* cmp_data[2] = { cmp_data_off, cmp_data_on }; + +void Ef_Lamp_Light_actor_ct(Actor* thisx, Game_Play* game_play) { + s32 pad UNUSED; + Lamp_Light* this = (Lamp_Light*)thisx; + + game_play->kankyo.unk_1C = &this->unk_178; + Light_diffuse_ct(&this->unk_178, 0, 0x50, 0, 0, 0, 0); + this->unk_188 = Global_light_list_new(game_play, &game_play->glight, &this->unk_178); +} + +void Ef_Lamp_Light_actor_dt(Actor* thisx, Game_Play* game_play) { + Lamp_Light* this = (Lamp_Light*)thisx; + + game_play->kankyo.unk_1C = NULL; + Global_light_list_delete(&game_play->glight, this->unk_188); +} + +s32 eLL_get_light_sw_other_room(void) { + s32 var_v1; + s32 temp_v0; + + temp_v0 = common_data.time.nowSec; + var_v1 = 0; + if ((temp_v0 < 0x5460) || (temp_v0 >= 0xFD20)) { + var_v1 = 1; + } + return var_v1; +} + +s32 eLL_get_light_sw_player_room(Lamp_Light* this UNUSED) { + s32 var_v1; + s32 temp_v0; + + temp_v0 = common_data.time.nowSec; + var_v1 = ((temp_v0 >= 0xFD20) && (temp_v0 < 0x14370)) ? 1 : 0; + return var_v1; +} + +s32 eLL_get_light_sw_start_demo(void) { + s32 var_v1; + + var_v1 = 1; + if (common_data.unk_104AE == 1) { + var_v1 = 0; + } + return var_v1; +} + +void eLL_ctrl_light_sw(Lamp_Light* this) { + s32 var_v1 = 0; + + switch (common_data.unk_10001) { + case 2: + case 3: + switch (mFI_GetFieldId()) { + case 0x6000: + case 0x6001: + case 0x6002: + case 0x6003: + var_v1 = eLL_get_light_sw_player_room(this); + break; -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Lamp_Light/ef_lamp_light/Ef_Lamp_Light_actor_ct.s") + case 0x5000: + case 0x5001: + var_v1 = eLL_get_light_sw_start_demo(); + break; -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Lamp_Light/ef_lamp_light/Ef_Lamp_Light_actor_dt.s") + default: + var_v1 = eLL_get_light_sw_other_room(); + break; + } + break; -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Lamp_Light/ef_lamp_light/func_80967644_jp.s") + case 1: + var_v1 = eLL_get_light_sw_player_room(this); + break; + } -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Lamp_Light/ef_lamp_light/func_80967678_jp.s") + this->unk_174 = var_v1; +} -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Lamp_Light/ef_lamp_light/func_809676BC_jp.s") +void Ef_Lamp_Light_actor_move(Actor* thisx, Game_Play* game_play UNUSED) { + Lamp_Light* this = (Lamp_Light*)thisx; + s16* var_s1; + s16* var_s2; + s32 temp_v1; + s32 i; + s16 sp3A; + u8* var_s0; -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Lamp_Light/ef_lamp_light/func_809676E4_jp.s") + eLL_ctrl_light_sw(this); + var_s0 = this->unk_178.lights.diffuse.color; + temp_v1 = this->unk_174; + var_s1 = add_data[temp_v1]; + var_s2 = cmp_data[temp_v1]; -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Lamp_Light/ef_lamp_light/Ef_Lamp_Light_actor_move.s") + for (i = 0; i < 3; i++, var_s1++, var_s2++, var_s0++) { + sp3A = *var_s0; + chase_s(&sp3A, *var_s2, *var_s1); + *var_s0 = sp3A; + } +} diff --git a/src/overlays/actors/ovl_Lamp_Light/ef_lamp_light.h b/src/overlays/actors/ovl_Lamp_Light/ef_lamp_light.h index 4b10b98..03f233a 100644 --- a/src/overlays/actors/ovl_Lamp_Light/ef_lamp_light.h +++ b/src/overlays/actors/ovl_Lamp_Light/ef_lamp_light.h @@ -4,6 +4,7 @@ #include "ultra64.h" #include "m_actor.h" #include "unk.h" +#include "m_lights.h" struct Game_Play; struct Lamp_Light; @@ -12,7 +13,9 @@ typedef void (*Lamp_LightActionFunc)(struct Lamp_Light*, struct Game_Play*); typedef struct Lamp_Light { /* 0x000 */ Actor actor; - /* 0x174 */ UNK_TYPE1 unk_174[0x18]; + /* 0x174 */ s32 unk_174; + /* 0x178 */ Lights unk_178; + /* 0x188 */ LightNode* unk_188; } Lamp_Light; // size = 0x18C #endif diff --git a/yamls/jp/overlays.yaml b/yamls/jp/overlays.yaml index 8eec066..631fe30 100644 --- a/yamls/jp/overlays.yaml +++ b/yamls/jp/overlays.yaml @@ -1684,7 +1684,7 @@ bss_size: 0x0 subsegments: - [0x85C200, c, overlays/actors/ovl_Lamp_Light/ef_lamp_light] - - [0x85C4B0, data, overlays/actors/ovl_Lamp_Light/ef_lamp_light] + - [0x85C4B0, .data, overlays/actors/ovl_Lamp_Light/ef_lamp_light] - name: ovl_Lamp_Light_reloc type: code start: 0x85C510 |
