summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaide <34639600+Kelebek1@users.noreply.github.com>2022-03-29 18:56:20 +0100
committerGitHub <noreply@github.com>2022-03-29 18:56:20 +0100
commit72265fac927658187cbb3c7a3a184677bf5f28fa (patch)
tree31f0ceb5b2ce571b5942cc4de2f570eb22ebf600
parent6132d950e36f9b8638e1d44b8339ed7d1aa027bc (diff)
Obj_Entotu (#745)
* Obj_Entotu * Time macro * PR * Merge
-rw-r--r--assets/xml/overlays/ovl_Obj_Entotu.xml7
-rw-r--r--include/macros.h5
-rw-r--r--spec3
-rw-r--r--src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.c148
-rw-r--r--src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.h6
-rw-r--r--undefined_syms.txt5
6 files changed, 151 insertions, 23 deletions
diff --git a/assets/xml/overlays/ovl_Obj_Entotu.xml b/assets/xml/overlays/ovl_Obj_Entotu.xml
new file mode 100644
index 000000000..e6e6c64cf
--- /dev/null
+++ b/assets/xml/overlays/ovl_Obj_Entotu.xml
@@ -0,0 +1,7 @@
+<Root>
+ <File Name="ovl_Obj_Entotu" BaseAddress="0x80A34700" RangeStart="0x0D10" RangeEnd="0x0D80">
+ <Array Name="ovl_Obj_Entotu_Vtx_000D10" Count="7" Offset="0xD10">
+ <Vtx/>
+ </Array>
+ </File>
+</Root>
diff --git a/include/macros.h b/include/macros.h
index 64f084efe..5e9c062c9 100644
--- a/include/macros.h
+++ b/include/macros.h
@@ -49,14 +49,13 @@
#define CURRENT_DAY (((void)0, gSaveContext.save.day) % 5)
-#define TIME_TO_MINUTES(time) (s32)((time) * ((24 * 60) / 0x10000))
#define CLOCK_TIME(hr, min) (s32)(((hr) * 60 + (min)) * 0x10000 / (24 * 60))
#define CLOCK_TIME_MINUTE (CLOCK_TIME(0, 1))
-#define TIME_TO_MINUTES_F(time) ((time) * ((24.0f * 60.0f) / 0x10000))
+#define TIME_TO_MINUTES_F(time) ((time) * ((24.0f * 60.0f) / 0x10000)) // 0.021972656f
#define CLOCK_TIME_F(hr, min) (((hr) * 60.0f + (min)) * (0x10000 / (24.0f * 60.0f)))
-#define TIME_TO_MINUTES_ALT_F(time) ((time) / (24.0f * 60.0f / 0x10000))
+#define TIME_TO_MINUTES_ALT_F(time) ((time) / (0x10000 / (24.0f * 60.0f)))
#define CLOCK_TIME_ALT_F(hr, min) (((hr) * 60.0f + (min)) / (24.0f * 60.0f / 0x10000))
#define SLOT(item) gItemSlots[item]
diff --git a/spec b/spec
index 397064c1c..515ff2e31 100644
--- a/spec
+++ b/spec
@@ -2712,8 +2712,7 @@ beginseg
name "ovl_Obj_Entotu"
compress
include "build/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.o"
- include "build/data/ovl_Obj_Entotu/ovl_Obj_Entotu.data.o"
- include "build/data/ovl_Obj_Entotu/ovl_Obj_Entotu.reloc.o"
+ include "build/src/overlays/actors/ovl_Obj_Entotu/ovl_Obj_Entotu_reloc.o"
endseg
beginseg
diff --git a/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.c b/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.c
index 72f0a8015..8ed237927 100644
--- a/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.c
+++ b/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.c
@@ -5,6 +5,7 @@
*/
#include "z_obj_entotu.h"
+#include "objects/object_f53_obj/object_f53_obj.h"
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20)
@@ -15,7 +16,6 @@ void ObjEntotu_Destroy(Actor* thisx, GlobalContext* globalCtx);
void ObjEntotu_Update(Actor* thisx, GlobalContext* globalCtx);
void ObjEntotu_Draw(Actor* thisx, GlobalContext* globalCtx);
-#if 0
const ActorInit Obj_Entotu_InitVars = {
ACTOR_OBJ_ENTOTU,
ACTORCAT_PROP,
@@ -28,23 +28,147 @@ const ActorInit Obj_Entotu_InitVars = {
(ActorFunc)ObjEntotu_Draw,
};
-#endif
+#include "overlays/ovl_Obj_Entotu/ovl_Obj_Entotu.c"
-extern UNK_TYPE D_06000158;
-extern UNK_TYPE D_06001C00;
+s32 func_80A34700(s16 minutes) {
+ s32 ret = 0;
+ s16 time = TIME_TO_MINUTES_F(gSaveContext.save.time);
+ s32 hours = time / 60;
+ s32 currMinutes = time % 60;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Entotu/func_80A34700.s")
+ if (hours >= 16) {
+ if ((hours == 16) && (currMinutes < minutes)) {
+ return 0;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Entotu/func_80A349C0.s")
+ if (hours >= 20) {
+ return 0;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Entotu/func_80A34A44.s")
+ if ((hours == 19) && (minutes < currMinutes)) {
+ return 0;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Entotu/func_80A34B28.s")
+ ret = 3;
+ } else if (hours >= 11) {
+ if ((hours == 11) && (currMinutes < minutes)) {
+ return 0;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Entotu/ObjEntotu_Init.s")
+ if (hours >= 14) {
+ return 0;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Entotu/ObjEntotu_Destroy.s")
+ if ((hours == 13) && (minutes < currMinutes)) {
+ return 0;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Entotu/ObjEntotu_Update.s")
+ ret = 2;
+ } else if (hours >= 6) {
+ if ((hours == 6) && (currMinutes < minutes)) {
+ return 0;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Entotu/ObjEntotu_Draw.s")
+ if (hours >= 9) {
+ return 0;
+ }
+
+ if ((hours == 8) && (minutes < currMinutes)) {
+ return 0;
+ }
+
+ ret = 1;
+ }
+ return ret;
+}
+
+void func_80A349C0(ObjEntotu* this) {
+ s32 temp_v0 = func_80A34700(this->unk_1C6);
+ u8 temp = temp_v0;
+ s16 temp2 = this->unk_1C4;
+
+ if (temp_v0 != temp2) {
+ this->unk_1C4 = temp;
+ this->unk_1C6 = Rand_S16Offset(0, 59);
+ }
+
+ temp2 = this->unk_1C4;
+ Math_ApproachF(&this->unk_1B8.x, (temp2 == 0) ? 0.0f : 1.0f, 0.02f, 1000.0f);
+}
+
+void func_80A34A44(ObjEntotu* this, GlobalContext* globalCtx) {
+ Matrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW);
+ this->actor.shape.rot.y = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)));
+ Matrix_RotateY(this->actor.shape.rot.y, MTXMODE_APPLY);
+ Matrix_Scale(0.1f, 0.1f, 0.0f, MTXMODE_APPLY);
+
+ OPEN_DISPS(globalCtx->state.gfxCtx);
+
+ func_8012C28C(globalCtx->state.gfxCtx);
+
+ gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_OPA_DISP++, object_f53_obj_DL_000158);
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+}
+
+void func_80A34B28(ObjEntotu* this, GlobalContext* globalCtx) {
+ u8 sp57;
+ u8 sp56;
+ s32 i;
+
+ this->unk_1B8.y += 1.8f;
+ this->unk_1B8.z += 0.6f;
+ sp57 = 0x7F - (u8)this->unk_1B8.y;
+ sp56 = 0x7F - (u8)this->unk_1B8.z;
+
+ this->unk_1B8.x = CLAMP(this->unk_1B8.x, 0.0f, 1.0f);
+
+ for (i = 0; i < ARRAY_COUNT(ovl_Obj_Entotu_Vtx_000D10); i++) {
+ this->unk_148[i].v.cn[3] = ovl_Obj_Entotu_Vtx_000D10[i].v.cn[3] * this->unk_1B8.x;
+ }
+
+ if (this->unk_1B8.x > 0.0f) {
+ Matrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z,
+ MTXMODE_NEW);
+ this->actor.shape.rot.y = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)));
+ Matrix_RotateY(this->actor.shape.rot.y, MTXMODE_APPLY);
+ Matrix_Scale(0.1f, 0.1f, 0.0f, MTXMODE_APPLY);
+
+ OPEN_DISPS(globalCtx->state.gfxCtx);
+
+ func_8012C28C(globalCtx->state.gfxCtx);
+
+ gSPSegment(POLY_XLU_DISP++, 0x08,
+ Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, sp57, 0x20, 0x20, 1, 0, sp56, 0x20, 0x20));
+ gSPSegment(POLY_XLU_DISP++, 0x09, Lib_SegmentedToVirtual(this->unk_148));
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_XLU_DISP++, object_f53_obj_DL_001C00);
+
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+ }
+}
+
+void ObjEntotu_Init(Actor* thisx, GlobalContext* globalCtx) {
+ ObjEntotu* this = THIS;
+
+ Lib_MemCpy(this->unk_148, ovl_Obj_Entotu_Vtx_000D10, sizeof(ovl_Obj_Entotu_Vtx_000D10));
+ this->unk_1C6 = Rand_S16Offset(0, 59);
+ this->unk_1C4 = 0;
+}
+
+void ObjEntotu_Destroy(Actor* thisx, GlobalContext* globalCtx) {
+}
+
+void ObjEntotu_Update(Actor* thisx, GlobalContext* globalCtx) {
+ ObjEntotu* this = THIS;
+
+ func_80A349C0(this);
+}
+
+void ObjEntotu_Draw(Actor* thisx, GlobalContext* globalCtx) {
+ ObjEntotu* this = THIS;
+
+ func_80A34B28(this, globalCtx);
+ func_80A34A44(this, globalCtx);
+}
diff --git a/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.h b/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.h
index 5d0b3cedd..a00a7fcd4 100644
--- a/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.h
+++ b/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.h
@@ -7,7 +7,11 @@ struct ObjEntotu;
typedef struct ObjEntotu {
/* 0x000 */ Actor actor;
- /* 0x144 */ char unk_144[0x84];
+ /* 0x144 */ UNK_TYPE1 unk144[4];
+ /* 0x148 */ Vtx unk_148[7];
+ /* 0x1B8 */ Vec3f unk_1B8;
+ /* 0x1C4 */ u8 unk_1C4;
+ /* 0x1C6 */ s16 unk_1C6;
} ObjEntotu; // size = 0x1C8
extern const ActorInit Obj_Entotu_InitVars;
diff --git a/undefined_syms.txt b/undefined_syms.txt
index ea2d42b3a..5b25825ae 100644
--- a/undefined_syms.txt
+++ b/undefined_syms.txt
@@ -1702,11 +1702,6 @@ D_06000BA0 = 0x06000BA0;
D_06003FD0 = 0x06003FD0;
D_06004160 = 0x06004160;
-// ovl_Obj_Entotu
-
-D_06000158 = 0x06000158;
-D_06001C00 = 0x06001C00;
-
// ovl_Obj_Hariko
D_06000080 = 0x06000080;