ef_room_sunshine OK (#214)

* ef_room_sunshine OK

* format

* jenkins

* fourth time's the charm
This commit is contained in:
Prakxo
2024-09-24 21:05:32 +02:00
committed by GitHub
parent 946ee8e9c2
commit 35eba20abd
7 changed files with 173 additions and 32 deletions
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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
+5 -5
View File
@@ -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
+6 -6
View File
@@ -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
@@ -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;
#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Room_Sunshine/ef_room_sunshine/func_80965E38_jp.s")
sunshine->unk_174 = 0;
#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Room_Sunshine/ef_room_sunshine/func_80965EE0_jp.s")
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;
}
#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Room_Sunshine/ef_room_sunshine/func_80965FF0_jp.s")
actor->world.pos.y = mCoBG_GetBgY_OnlyCenter_FromWpos(actor->world.pos, 0.0f);
// 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
actor->scale.x = 1.0f;
actor->scale.y = 1.0f;
actor->scale.z = 1.0f;
#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Room_Sunshine/ef_room_sunshine/func_80966120_jp.s")
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;
}
}
#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Room_Sunshine/ef_room_sunshine/func_8096628C_jp.s")
f32 calc_scale_Ef_Room_Sunshine(s32 flag, s32 sec) {
// 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
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);
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);
CLOSE_DISPS(graph);
}
void Ef_Room_SunshineR_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);
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);
CLOSE_DISPS(graph);
}
@@ -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
+1 -1
View File
@@ -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