summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linker_scripts/jp/symbol_addrs_overlays.txt24
-rw-r--r--src/overlays/actors/ovl_T_Keitai/ac_t_keitai.c181
-rw-r--r--src/overlays/actors/ovl_T_Keitai/ac_t_keitai.h14
-rw-r--r--yamls/jp/overlays.yaml2
4 files changed, 193 insertions, 28 deletions
diff --git a/linker_scripts/jp/symbol_addrs_overlays.txt b/linker_scripts/jp/symbol_addrs_overlays.txt
index f7855b2..b7fc34c 100644
--- a/linker_scripts/jp/symbol_addrs_overlays.txt
+++ b/linker_scripts/jp/symbol_addrs_overlays.txt
@@ -14394,23 +14394,23 @@ RO_FLT_80A1F440_jp = 0x80A1F440; // type:f32
aTKT_actor_ct = 0x80A1F510; // type:func
func_80A1F58C_jp = 0x80A1F58C; // type:func
-func_80A1F634_jp = 0x80A1F634; // type:func
-func_80A1F6C0_jp = 0x80A1F6C0; // type:func
-func_80A1F6E0_jp = 0x80A1F6E0; // type:func
-func_80A1F700_jp = 0x80A1F700; // type:func
-func_80A1F720_jp = 0x80A1F720; // type:func
+aTKT_calc_scale = 0x80A1F634; // type:func
+aTKT_takeout = 0x80A1F6C0; // type:func
+aTKT_putaway = 0x80A1F6E0; // type:func
+aTKT_destruct = 0x80A1F700; // type:func
+aTKT_setupAction = 0x80A1F720; // type:func
aTKT_actor_move = 0x80A1F7C8; // type:func
aTKT_actor_draw = 0x80A1F824; // type:func
// .data
-D_80A1F960_jp = 0x80A1F960; //
+aTKT_anm_dt = 0x80A1F960; //
T_Keitai_Profile = 0x80A1F99C; //
-D_FLT_80A1F9C0_jp = 0x80A1F9C0; // type:f32
-D_FLT_80A1F9C8_jp = 0x80A1F9C8; // type:f32
-D_FLT_80A1F9D0_jp = 0x80A1F9D0; // type:f32
-D_FLT_80A1F9D8_jp = 0x80A1F9D8; // type:f32
-D_80A1F9E0_jp = 0x80A1F9E0; //
+start_scale = 0x80A1F9C0; // type:f32 allow_duplicated:true
+end_scale = 0x80A1F9C8; // type:f32
+start_chno = 0x80A1F9D0; // type:f32
+end_chno = 0x80A1F9D8; // type:f32
+process = 0x80A1F9E0; // allow_duplicated:true
D_80A1F9F4_jp = 0x80A1F9F4; //
// .rodata
@@ -14457,7 +14457,7 @@ aTHB_actor_draw = 0x80A1FF58; // type:func
T_Hanabi_Profile = 0x80A20050; //
aim = 0x80A20074; // type:f32
process = 0x80A2007C; // allow_duplicated:true
-start_scale = 0x80A20090; // type:f32
+start_scale = 0x80A20090; // type:f32 allow_duplicated:true
D_80A200A4_jp = 0x80A200A4; //
// .rodata
diff --git a/src/overlays/actors/ovl_T_Keitai/ac_t_keitai.c b/src/overlays/actors/ovl_T_Keitai/ac_t_keitai.c
index 291661d..abf5c73 100644
--- a/src/overlays/actors/ovl_T_Keitai/ac_t_keitai.c
+++ b/src/overlays/actors/ovl_T_Keitai/ac_t_keitai.c
@@ -2,19 +2,38 @@
#include "m_lib.h"
#include "m_actor_dlftbls.h"
#include "m_object.h"
+#include "m_rcp.h"
+#include "objects/tol_keitai_1/tol_keitai_1.h"
#include "overlays/gamestates/ovl_play/m_play.h"
+#define THIS ((T_Keitai*)thisx)
+
void aTKT_actor_ct(Actor* thisx, Game_Play* game_play);
void aTKT_actor_move(Actor* thisx, Game_Play* game_play);
void aTKT_actor_draw(Actor* thisx, Game_Play* game_play);
-#if 0
+void aTKT_setupAction(T_Keitai* this, s32 processIndex);
+
+typedef struct TKeitaiAnimationData {
+ /* 0x0 */ BaseAnimationR* animation;
+ /* 0x4 */ f32 startFrame;
+ /* 0x8 */ f32 endFrame;
+} TKeitaiAnimationData; // size = 0xC
+
+TKeitaiAnimationData aTKT_anm_dt[] = {
+ { &cKF_ba_r_tol_keitai_1_keitai_on1, 1.0f, 68.0f },
+ { &cKF_ba_r_tol_keitai_1_keitai_off1, 1.0f, 61.0f },
+ { &cKF_ba_r_tol_keitai_1_keitai_off1, 1.0f, 61.0f },
+ { &cKF_ba_r_tol_keitai_1_keitai_on1, 1.0f, 68.0f },
+ { NULL, 0.0f, 0.0f },
+};
+
ActorProfile T_Keitai_Profile = {
/* */ ACTOR_T_KEITAI,
/* */ ACTOR_PART_4,
/* */ ACTOR_FLAG_10 | ACTOR_FLAG_20,
/* */ 0x0000,
- /* */ OBJECT_45,
+ /* */ OBJECT_TOL_KEITAI_1,
/* */ sizeof(T_Keitai),
/* */ aTKT_actor_ct,
/* */ (void*)none_proc1,
@@ -22,22 +41,160 @@ ActorProfile T_Keitai_Profile = {
/* */ aTKT_actor_draw,
/* */ NULL,
};
-#endif
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_T_Keitai/ac_t_keitai/aTKT_actor_ct.s")
+void aTKT_actor_ct(Actor* thisx, Game_Play* game_play) {
+ T_Keitai* this = THIS;
+
+ cKF_SkeletonInfo_R_ct(&this->skeletonInfo, &cKF_bs_r_tol_keitai_1, NULL, this->jointTable, this->morphTable);
+ this->segment = game_play->objectExchangeBank.status[this->toolActor.actor.unk_026].segment;
+ aTKT_setupAction(this, 0);
+}
+
+void func_80A1F58C_jp(T_Keitai* this, Game_Play* game_play) {
+ UNUSED s32 pad;
+ void* segment = game_play->objectExchangeBank.status[this->toolActor.actor.unk_026].segment;
+ SkeletonInfoR* skeletonInfo;
+ TKeitaiAnimationData* animData;
+
+ if (this->segment != segment) {
+ animData = &aTKT_anm_dt[this->processIndex];
+ skeletonInfo = &this->skeletonInfo;
+ skeletonInfo->skeleton = Lib_SegmentedToVirtual(&cKF_bs_r_tol_keitai_1);
+ skeletonInfo->animation = Lib_SegmentedToVirtual(animData->animation);
+ this->segment = segment;
+ }
+}
+
+void aTKT_calc_scale(T_Keitai* this, s32 index) {
+ static f32 start_scale[] = { 0.0f, 1.0f };
+ static f32 end_scale[] = { 1.0f, 0.0f };
+ static f32 start_chno[] = { 10.0f, 33.0f };
+ static f32 end_chno[] = { 20.0f, 41.0f };
+ f32 currentFrame = this->skeletonInfo.frameControl.currentFrame;
+ f32 startingChno = start_chno[index];
+ f32 endingChno = end_chno[index];
+ f32 startingScale = start_scale[index];
+ f32 endingScale = end_scale[index];
+ f32 scale;
+
+ if (currentFrame < startingChno) {
+ scale = startingScale;
+ } else if (endingChno < currentFrame) {
+ scale = endingScale;
+ } else {
+ scale = (((currentFrame - startingChno) / (endingChno - startingChno)) * (endingScale - startingScale)) +
+ startingScale;
+ }
+
+ this->toolActor.actor.scale.x = scale;
+ this->toolActor.actor.scale.y = scale;
+ this->toolActor.actor.scale.z = scale;
+}
+
+void aTKT_takeout(T_Keitai* this) {
+ aTKT_calc_scale(this, 0);
+}
+
+void aTKT_putaway(T_Keitai* this) {
+ aTKT_calc_scale(this, 1);
+}
+
+void aTKT_destruct(T_Keitai* this) {
+ Actor_delete(&this->toolActor.actor);
+}
+
+void aTKT_setupAction(T_Keitai* this, s32 processIndex) {
+ static T_KeitaiActionFunc process[] = {
+ aTKT_takeout, aTKT_putaway, aTKT_destruct, (T_KeitaiActionFunc)(void*)none_proc1, NULL,
+ };
+ this->process = process[processIndex];
+ this->processIndex = processIndex;
+
+ {
+ TKeitaiAnimationData* animData = &aTKT_anm_dt[processIndex];
+
+ cKF_SkeletonInfo_R_init(&this->skeletonInfo, this->skeletonInfo.skeleton, animData->animation,
+ animData->startFrame, animData->endFrame, animData->startFrame, 1.0f, 0.0f,
+ ANIMATION_STOP, NULL);
+ }
+}
+
+void aTKT_actor_move(Actor* thisx, Game_Play* game_play) {
+ T_Keitai* this = THIS;
+
+ func_80A1F58C_jp(this, game_play);
+
+ if (this->toolActor.unk1BC != this->processIndex) {
+ aTKT_setupAction(this, this->toolActor.unk1BC);
+ }
+
+ cKF_SkeletonInfo_R_play(&this->skeletonInfo);
+ this->process(this);
+}
+
+#define AC_GCN_OPEN_DISP(gfxCtx) \
+ { \
+ GraphicsContext* __gfxCtx = gfxCtx; \
+ int __gfx_opened = 0; \
+ do { \
+ } while (0)
+
+#define AC_GCN_CLOSE_DISP(gfxCtx) \
+ (void)__gfx_opened; \
+ } \
+ do { \
+ } while (0)
+
+#define OPEN_POLY_OPA_DISPS() \
+ { \
+ Gfx* __polyOpa = __gfxCtx->polyOpa.p; \
+ int __opa_opened = 0; \
+ do { \
+ } while (0)
+
+#define CLOSE_POLY_OPA_DISPS() \
+ __gfxCtx->polyOpa.p = __polyOpa; \
+ (void)__opa_opened; \
+ } \
+ do { \
+ } while (0)
+
+void aTKT_actor_draw(Actor* thisx, Game_Play* game_play) {
+ static xyz_t D_80A1F9F4_jp = { 0.0f, 0.0f, 0.0f };
+ T_Keitai* this = THIS;
+ SkeletonInfoR* skeletonInfo = &this->skeletonInfo;
+ GraphicsContext* gfxCtx = game_play->state.gfxCtx;
+ Mtx* mtx;
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_T_Keitai/ac_t_keitai/func_80A1F58C_jp.s")
+ func_80A1F58C_jp(this, game_play);
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_T_Keitai/ac_t_keitai/func_80A1F634_jp.s")
+ mtx = GRAPH_ALLOC_NO_ALIGN(gfxCtx, sizeof(Mtx) * skeletonInfo->skeleton->unk01);
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_T_Keitai/ac_t_keitai/func_80A1F6C0_jp.s")
+ if (mtx != NULL) {
+ if (this->toolActor.unk1B8 == 1) {
+ Matrix_put(&this->toolActor.unk178);
+ Matrix_Position(&D_80A1F9F4_jp, &this->toolActor.actor.world.pos);
+ this->toolActor.unk1B8 = 0;
+ } else {
+ Matrix_translate(this->toolActor.actor.world.pos.x, this->toolActor.actor.world.pos.y,
+ this->toolActor.actor.world.pos.z, MTXMODE_NEW);
+ Matrix_scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY);
+ }
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_T_Keitai/ac_t_keitai/func_80A1F6E0_jp.s")
+ _texture_z_light_fog_prim_npc(gfxCtx);
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_T_Keitai/ac_t_keitai/func_80A1F700_jp.s")
+ if (1) {}
+ AC_GCN_OPEN_DISP(gfxCtx);
+ OPEN_POLY_OPA_DISPS();
+ if (1) {}
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_T_Keitai/ac_t_keitai/func_80A1F720_jp.s")
+ Matrix_scale(this->toolActor.actor.scale.x, this->toolActor.actor.scale.y, this->toolActor.actor.scale.z,
+ MTXMODE_APPLY);
+ gSPMatrix(__polyOpa++, _Matrix_to_Mtx_new(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_T_Keitai/ac_t_keitai/aTKT_actor_move.s")
+ CLOSE_POLY_OPA_DISPS();
+ AC_GCN_CLOSE_DISP(gfxCtx);
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_T_Keitai/ac_t_keitai/aTKT_actor_draw.s")
+ cKF_Si3_draw_R_SV(game_play, skeletonInfo, mtx, NULL, NULL, NULL);
+ }
+}
diff --git a/src/overlays/actors/ovl_T_Keitai/ac_t_keitai.h b/src/overlays/actors/ovl_T_Keitai/ac_t_keitai.h
index 434b9a8..9bc1105 100644
--- a/src/overlays/actors/ovl_T_Keitai/ac_t_keitai.h
+++ b/src/overlays/actors/ovl_T_Keitai/ac_t_keitai.h
@@ -2,17 +2,25 @@
#define AC_T_KEITAI_H
#include "ultra64.h"
+#include "c_keyframe.h"
#include "m_actor.h"
+#include "overlays/actors/ovl_Tools/ac_tools.h"
#include "unk.h"
struct Game_Play;
struct T_Keitai;
-typedef void (*T_KeitaiActionFunc)(struct T_Keitai*, struct Game_Play*);
+typedef void (*T_KeitaiActionFunc)(struct T_Keitai*);
typedef struct T_Keitai {
- /* 0x000 */ Actor actor;
- /* 0x174 */ UNK_TYPE1 unk_174[0x100];
+ /* 0x000 */ ToolActor toolActor;
+ /* 0x1C0 */ UNK_TYPE1 unk_1C0[0x8];
+ /* 0x1C8 */ T_KeitaiActionFunc process;
+ /* 0x1CC */ s32 processIndex;
+ /* 0x1D0 */ SkeletonInfoR skeletonInfo;
+ /* 0x240 */ s_xyz jointTable[4];
+ /* 0x258 */ s_xyz morphTable[4];
+ /* 0x270 */ void* segment;
} T_Keitai; // size = 0x274
#endif
diff --git a/yamls/jp/overlays.yaml b/yamls/jp/overlays.yaml
index e4a0fb6..343bd1b 100644
--- a/yamls/jp/overlays.yaml
+++ b/yamls/jp/overlays.yaml
@@ -3366,7 +3366,7 @@
bss_size: 0x0
subsegments:
- [0x8E6FD0, c, overlays/actors/ovl_T_Keitai/ac_t_keitai]
- - [0x8E7420, data, overlays/actors/ovl_T_Keitai/ac_t_keitai]
+ - [0x8E7420, .data, overlays/actors/ovl_T_Keitai/ac_t_keitai]
- [0x8E74C0, .rodata, overlays/actors/ovl_T_Keitai/ac_t_keitai]
- name: ovl_T_Keitai_reloc
type: code