diff options
| author | Prakxo <87568477+Prakxo@users.noreply.github.com> | 2024-09-24 21:05:32 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-24 12:05:32 -0700 |
| commit | 35eba20abdd3f810a2f878edea37890858ffccc2 (patch) | |
| tree | 5a1706325f2724bff070661aceec9c169af7ce68 | |
| parent | 946ee8e9c28a04c7b0a485c9b49543677112d5ec (diff) | |
ef_room_sunshine OK (#214)
* ef_room_sunshine OK
* format
* jenkins
* fourth time's the charm
| -rw-r--r-- | include/m_collision_bg.h | 2 | ||||
| -rw-r--r-- | linker_scripts/jp/symbol_addrs_code.txt | 2 | ||||
| -rw-r--r-- | linker_scripts/jp/symbol_addrs_overlays.txt | 10 | ||||
| -rw-r--r-- | linker_scripts/jp/undefined_syms.ld | 12 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_Room_Sunshine/ef_room_sunshine.c | 175 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_Room_Sunshine/ef_room_sunshine.h | 2 | ||||
| -rw-r--r-- | yamls/jp/overlays.yaml | 2 |
7 files changed, 173 insertions, 32 deletions
diff --git a/include/m_collision_bg.h b/include/m_collision_bg.h index f02ba47..91f0209 100644 --- a/include/m_collision_bg.h +++ b/include/m_collision_bg.h @@ -231,7 +231,7 @@ f32 mCoBG_GetShadowBgY_AngleS_FromWpos(s_xyz*, xyz_t,f32); // void func_80071728_jp(); // void func_8007175C_jp(); f32 mCoBG_GetBgY_AngleS_FromWpos(s_xyz* angleToGround, xyz_t wpos, f32 offsetY); -// void func_80071A08_jp(); +f32 mCoBG_GetBgY_OnlyCenter_FromWpos(xyz_t arg0, f32 arg1); // void func_80071AB8_jp(); f32 mCoBG_GetBgY_OnlyCenter_FromWpos2(xyz_t arg0, f32 arg1); void mCoBG_GetBgNorm_FromWpos(xyz_t*, xyz_t); diff --git a/linker_scripts/jp/symbol_addrs_code.txt b/linker_scripts/jp/symbol_addrs_code.txt index bd3b389..4841f94 100644 --- a/linker_scripts/jp/symbol_addrs_code.txt +++ b/linker_scripts/jp/symbol_addrs_code.txt @@ -768,7 +768,7 @@ func_80071604_jp = 0x80071604; // type:func func_80071728_jp = 0x80071728; // type:func func_8007175C_jp = 0x8007175C; // type:func mCoBG_GetBgY_AngleS_FromWpos = 0x80071884; // type:func -func_80071A08_jp = 0x80071A08; // type:func +mCoBG_GetBgY_OnlyCenter_FromWpos = 0x80071A08; // type:func func_80071AB8_jp = 0x80071AB8; // type:func mCoBG_GetBgY_OnlyCenter_FromWpos2 = 0x80071B78; // type:func mCoBG_GetBgNorm_FromWpos = 0x80071C1C; // type:func diff --git a/linker_scripts/jp/symbol_addrs_overlays.txt b/linker_scripts/jp/symbol_addrs_overlays.txt index 310fbe2..d7b0779 100644 --- a/linker_scripts/jp/symbol_addrs_overlays.txt +++ b/linker_scripts/jp/symbol_addrs_overlays.txt @@ -8521,12 +8521,12 @@ B_80965C20_jp = 0x80965C20; // // .text Ef_Room_Sunshine_actor_ct = 0x80965C90; // type:func -func_80965E38_jp = 0x80965E38; // type:func -func_80965EE0_jp = 0x80965EE0; // type:func -func_80965FF0_jp = 0x80965FF0; // type:func +calc_scale_Ef_Room_Sunshine = 0x80965E38; // type:func +calc_alpha_Ef_Room_Sunshine = 0x80965EE0; // type:func +Ef_Room_SunshineL_actor_move = 0x80965FF0; // type:func Ef_Room_SunshineR_actor_move = 0x80966088; // type:func -func_80966120_jp = 0x80966120; // type:func -func_8096628C_jp = 0x8096628C; // type:func +setup_mode_Ef_Room_Sunshine = 0x80966120; // type:func +Ef_Room_SunshineL_actor_draw = 0x8096628C; // type:func Ef_Room_SunshineR_actor_draw = 0x80966370; // type:func // .data diff --git a/linker_scripts/jp/undefined_syms.ld b/linker_scripts/jp/undefined_syms.ld index d18f37b..e733637 100644 --- a/linker_scripts/jp/undefined_syms.ld +++ b/linker_scripts/jp/undefined_syms.ld @@ -1129,12 +1129,12 @@ D_600D878 = 0x0600D878; // ovl_Room_Sunshine -D_6000140 = 0x06000140; -D_6000160 = 0x06000160; -D_6000180 = 0x06000180; -D_60001A0 = 0x060001A0; -D_6000208 = 0x06000208; -D_6000220 = 0x06000220; +light_shine01_mode = 0x06000140; +light_shineL01_vtx = 0x06000160; +light_shineR01_vtx = 0x06000180; +light_floor01_mode = 0x060001A0; +light_floorL01_vtx = 0x06000208; +light_floorR01_vtx = 0x06000220; // ovl_Room_Sunshine_Posthouse diff --git a/src/overlays/actors/ovl_Room_Sunshine/ef_room_sunshine.c b/src/overlays/actors/ovl_Room_Sunshine/ef_room_sunshine.c index 9087a57..4b69eb3 100644 --- a/src/overlays/actors/ovl_Room_Sunshine/ef_room_sunshine.c +++ b/src/overlays/actors/ovl_Room_Sunshine/ef_room_sunshine.c @@ -3,12 +3,21 @@ #include "m_actor_dlftbls.h" #include "m_object.h" #include "overlays/gamestates/ovl_play/m_play.h" +#include "m_time.h" -void Ef_Room_Sunshine_actor_ct(Actor* thisx, Game_Play* game_play); -void Ef_Room_SunshineR_actor_move(Actor* thisx, Game_Play* game_play); -void Ef_Room_SunshineR_actor_draw(Actor* thisx, Game_Play* game_play); +void Ef_Room_Sunshine_actor_ct(Actor* actor, Game_Play* game_play); +void Ef_Room_SunshineR_actor_move(Actor* actor, Game_Play* game_play); +void Ef_Room_SunshineR_actor_draw(Actor* actor, Game_Play* play); +void Ef_Room_SunshineL_actor_move(Actor* actor, Game_Play* game_play); +void Ef_Room_SunshineL_actor_draw(Actor* actor, Game_Play* play); + +extern Gfx light_floor01_mode[]; +extern Vtx light_floorL01_vtx[]; +extern Vtx light_floorR01_vtx[]; +extern Gfx light_shine01_mode[]; +extern Vtx light_shineL01_vtx[]; +extern Vtx light_shineR01_vtx[]; -#if 0 ActorProfile Room_Sunshine_Profile = { /* */ ACTOR_ROOM_SUNSHINE, /* */ ACTOR_PART_6, @@ -22,24 +31,156 @@ ActorProfile Room_Sunshine_Profile = { /* */ Ef_Room_SunshineR_actor_draw, /* */ NULL, }; -#endif -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Room_Sunshine/ef_room_sunshine/Ef_Room_Sunshine_actor_ct.s") +void Ef_Room_Sunshine_actor_ct(Actor* actor, UNUSED Game_Play* play) { + Room_Sunshine* sunshine = (Room_Sunshine*)actor; + + sunshine->unk_174 = 0; + + if (actor->params == 0) { + actor->update = Ef_Room_SunshineL_actor_move; + actor->draw = Ef_Room_SunshineL_actor_draw; + } else { + actor->world.pos.x -= 1.0f; + } + + actor->world.pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos(actor->world.pos, 0.0f); + + actor->scale.x = 1.0f; + actor->scale.y = 1.0f; + actor->scale.z = 1.0f; + + switch (actor->params) { + case 2: + actor->update = Ef_Room_SunshineL_actor_move; + actor->draw = Ef_Room_SunshineL_actor_draw; + actor->world.pos.x += 5.0f; + actor->world.pos.y = 1.0f + mCoBG_GetBgY_OnlyCenter_FromWpos(actor->world.pos, 0.0f); + actor->world.pos.x -= 6.0f; + break; + case 3: + actor->world.pos.x -= 5.0f; + actor->world.pos.y = 1.0f + mCoBG_GetBgY_OnlyCenter_FromWpos(actor->world.pos, 0.0f); + actor->world.pos.x += 6.0f; + break; + } +} + +f32 calc_scale_Ef_Room_Sunshine(s32 flag, s32 sec) { + + if (flag == 0) { + return 1.5f * sin_s((sec << 14) / (f32)mTM_TIME_TO_SEC(8, 0, 0)); + } else { + return 1.5f * sin_s((sec << 14) / (f32)mTM_TIME_TO_SEC(4, 0, 0)); + } +} + +u8 calc_alpha_Ef_Room_Sunshine(void) { + f32 ret; + s32 sec; + + if (common_data.time.nowSec < mTM_TIME_TO_SEC(4, 0, 0)) { + ret = 120.0f * ((mTM_TIME_TO_SEC(4, 0, 0) - common_data.time.nowSec) / (f32)mTM_TIME_TO_SEC(4, 0, 0)); + + } else if (common_data.time.nowSec < mTM_TIME_TO_SEC(20, 0, 0)) { + sec = (common_data.time.nowSec - mTM_TIME_TO_SEC(12, 0, 0)) >= 0 + ? (common_data.time.nowSec - mTM_TIME_TO_SEC(12, 0, 0)) + : -(common_data.time.nowSec - mTM_TIME_TO_SEC(12, 0, 0)); + + ret = 255.0f * ((mTM_TIME_TO_SEC(8, 0, 0) - sec) / (f32)mTM_TIME_TO_SEC(8, 0, 0)); + } else { + ret = 120.0f * ((mTM_TIME_TO_SEC(4, 0, 0) - (mTM_TIME_TO_SEC(24, 0, 0) - common_data.time.nowSec)) / + (f32)mTM_TIME_TO_SEC(4, 0, 0)); + } + + if ((common_data.weather == SUMMER) || (common_data.weather == FALL)) { + ret *= 0.6f; + } + + return (s32)ret; +} + +void Ef_Room_SunshineL_actor_move(Actor* actor, UNUSED Game_Play* play) { + if (common_data.time.nowSec < mTM_TIME_TO_SEC(4, 0, 0)) { + actor->scale.x = calc_scale_Ef_Room_Sunshine(1, common_data.time.nowSec); + } else if (common_data.time.nowSec >= mTM_TIME_TO_SEC(12, 0, 0) && + common_data.time.nowSec < mTM_TIME_TO_SEC(20, 0, 0)) { + actor->scale.x = calc_scale_Ef_Room_Sunshine(0, common_data.time.nowSec - mTM_TIME_TO_SEC(12, 0, 0)); + } else { + actor->scale.x = 0.0f; + } +} + +void Ef_Room_SunshineR_actor_move(Actor* actor, UNUSED Game_Play* play) { + if (common_data.time.nowSec >= mTM_TIME_TO_SEC(4, 0, 0) && common_data.time.nowSec < mTM_TIME_TO_SEC(12, 0, 0)) { + actor->scale.x = calc_scale_Ef_Room_Sunshine(0, mTM_TIME_TO_SEC(12, 0, 0) - common_data.time.nowSec); + } else if (common_data.time.nowSec >= mTM_TIME_TO_SEC(20, 0, 0)) { + actor->scale.x = calc_scale_Ef_Room_Sunshine(1, mTM_TIME_TO_SEC(24, 0, 0) - common_data.time.nowSec); + } else { + actor->scale.x = 0.0f; + } +} + +void setup_mode_Ef_Room_Sunshine(Actor* actor, Game_Play* play) { + OPEN_DISPS(play->state.gfxCtx); + Matrix_translate(actor->world.pos.x, actor->world.pos.y, actor->world.pos.z, 0); + Matrix_scale(actor->scale.x, actor->scale.y, actor->scale.z, 1); + + gDPPipeSync(POLY_XLU_DISP++); + + gSPMatrix(POLY_XLU_DISP++, _Matrix_to_Mtx_new(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + { + u8* color; + s32 alpha; + + if (common_data.time.nowSec >= mTM_TIME_TO_SEC(4, 0, 0) && + common_data.time.nowSec < mTM_TIME_TO_SEC(20, 0, 0)) { + color = play->kankyo.baseLight.sunColorWindow; + } else { + color = play->kankyo.baseLight.moonColorWindow; + } + + alpha = calc_alpha_Ef_Room_Sunshine() * mKK_windowlight_alpha_get(); + + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, color[0], color[1], color[2], (u8)alpha); + } + CLOSE_DISPS(play->state.gfxCtx); +} + +void Ef_Room_SunshineL_actor_draw(Actor* actor, Game_Play* play) { + GraphicsContext* graph; + + if ((mKK_windowlight_alpha_get() < 0.0001f) || (actor->scale.x == 0.0f)) { + return; + } + graph = play->state.gfxCtx; + setup_mode_Ef_Room_Sunshine(actor, play); + + OPEN_DISPS(graph); -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Room_Sunshine/ef_room_sunshine/func_80965E38_jp.s") + gSPDisplayList(POLY_XLU_DISP++, light_floor01_mode); + gSPDisplayList(POLY_XLU_DISP++, light_floorL01_vtx); + gSPDisplayList(POLY_XLU_DISP++, light_shine01_mode); + gSPDisplayList(POLY_XLU_DISP++, light_shineL01_vtx); -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Room_Sunshine/ef_room_sunshine/func_80965EE0_jp.s") + CLOSE_DISPS(graph); +} -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Room_Sunshine/ef_room_sunshine/func_80965FF0_jp.s") +void Ef_Room_SunshineR_actor_draw(Actor* actor, Game_Play* play) { + GraphicsContext* graph; -// clang-format off -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Room_Sunshine/ef_room_sunshine/Ef_Room_SunshineR_actor_move.s") -// clang-format on + if ((mKK_windowlight_alpha_get() < 0.0001f) || (actor->scale.x == 0.0f)) { + return; + } + graph = play->state.gfxCtx; + setup_mode_Ef_Room_Sunshine(actor, play); -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Room_Sunshine/ef_room_sunshine/func_80966120_jp.s") + OPEN_DISPS(graph); -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Room_Sunshine/ef_room_sunshine/func_8096628C_jp.s") + gSPDisplayList(POLY_XLU_DISP++, light_floor01_mode); + gSPDisplayList(POLY_XLU_DISP++, light_floorR01_vtx); + gSPDisplayList(POLY_XLU_DISP++, light_shine01_mode); + gSPDisplayList(POLY_XLU_DISP++, light_shineR01_vtx); -// clang-format off -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Room_Sunshine/ef_room_sunshine/Ef_Room_SunshineR_actor_draw.s") -// clang-format on + CLOSE_DISPS(graph); +} diff --git a/src/overlays/actors/ovl_Room_Sunshine/ef_room_sunshine.h b/src/overlays/actors/ovl_Room_Sunshine/ef_room_sunshine.h index d6c21b0..79b3074 100644 --- a/src/overlays/actors/ovl_Room_Sunshine/ef_room_sunshine.h +++ b/src/overlays/actors/ovl_Room_Sunshine/ef_room_sunshine.h @@ -12,7 +12,7 @@ typedef void (*Room_SunshineActionFunc)(struct Room_Sunshine*, struct Game_Play* typedef struct Room_Sunshine { /* 0x000 */ Actor actor; - /* 0x174 */ UNK_TYPE1 unk_174[0x4]; + /* 0x174 */ u8 unk_174; } Room_Sunshine; // size = 0x178 #endif diff --git a/yamls/jp/overlays.yaml b/yamls/jp/overlays.yaml index da3146a..9df0856 100644 --- a/yamls/jp/overlays.yaml +++ b/yamls/jp/overlays.yaml @@ -1638,7 +1638,7 @@ bss_size: 0x0 subsegments: - [0x85A8E0, c, overlays/actors/ovl_Room_Sunshine/ef_room_sunshine] - - [0x85B0B0, data, overlays/actors/ovl_Room_Sunshine/ef_room_sunshine] + - [0x85B0B0, .data, overlays/actors/ovl_Room_Sunshine/ef_room_sunshine] - [0x85B0E0, .rodata, overlays/actors/ovl_Room_Sunshine/ef_room_sunshine] - name: ovl_Room_Sunshine_reloc type: code |
