summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremilybrooks <emilybrooksemilybrooks@gmail.com>2024-02-06 18:49:33 -0700
committerGitHub <noreply@github.com>2024-02-06 18:49:33 -0700
commit1d31ba9ecd3efbe7585e000a2876624f4f7df322 (patch)
treec1fef3e1640a743358dc4ed30418d8232864ab26
parent24074d678d5d87a987bbda221f7da1a0dd02ea35 (diff)
ac_koinobori OK (#140)
* initial commit * everything but draw * fully matching * imported data * fixed errors * review
-rw-r--r--include/m_common_data.h13
-rw-r--r--include/m_rcp.h2
-rw-r--r--linker_scripts/jp/symbol_addrs_code.txt2
-rw-r--r--linker_scripts/jp/symbol_addrs_overlays.txt23
-rw-r--r--linker_scripts/jp/undefined_syms.ld6
-rw-r--r--requirements.txt2
-rw-r--r--src/overlays/actors/ovl_Koinobori/ac_koinobori.c136
-rw-r--r--src/overlays/actors/ovl_Koinobori/ac_koinobori.h17
-rw-r--r--src/overlays/actors/ovl_T_Hanabi/ac_t_hanabi.c2
-rw-r--r--yamls/jp/overlays.yaml12
10 files changed, 184 insertions, 31 deletions
diff --git a/include/m_common_data.h b/include/m_common_data.h
index 78e2240..ced543a 100644
--- a/include/m_common_data.h
+++ b/include/m_common_data.h
@@ -24,6 +24,7 @@ struct CommonData_unk_1004C_unk_14_arg0;
struct Game_Play;
struct struct_809AEFA4;
struct ToolClip;
+struct ShadowData;
typedef UNK_RET (*CommonData_unk_1004C_unk_04)(struct ActorOverlay*, const struct struct_801161E8_jp*, size_t, s32);
typedef UNK_RET (*CommonData_unk_1004C_unk_08)(void);
@@ -76,6 +77,14 @@ typedef struct CommonData_unk_10078 {
/* 0x08 */ CommonData_unk_10078_unk_08 unk_08;
} CommonData_unk_10078; // size >= 0xC
+typedef UNK_RET (*CommonData_unk_10080_unk_00)(UNK_TYPE);
+typedef void (*CommonData_unk_10080_unk_04)(struct Game_Play* game_play, struct ShadowData* shadowData, s16 unk2);
+
+typedef struct CommonData_unk_10080 {
+ /* 0x00 */ CommonData_unk_10080_unk_00 unk_00;
+ /* 0x04 */ CommonData_unk_10080_unk_04 unk_04;
+} CommonData_unk_10080; // size >= 0x8
+
typedef UNK_RET (*CommonData_unk_10098_unk_4)(struct ActorOverlay*, size_t);
typedef UNK_RET (*CommonData_unk_10098_unk_8)(void);
typedef UNK_PTR (*CommonData_unk_10098_unk_0C)(void);
@@ -206,7 +215,9 @@ typedef struct CommonData {
/* 0x1004C */ CommonData_unk_1004C* unk_1004C;
/* 0x10050 */ UNK_TYPE1 unk_10050[0x28];
/* 0x10078 */ CommonData_unk_10078* unk_10078;
- /* 0x1007C */ UNK_TYPE1 unk_1007C[0x1C];
+ /* 0x1007C */ UNK_TYPE1 unk_1007C[0x4];
+ /* 0x10080 */ CommonData_unk_10080* unk_10080;
+ /* 0x10084 */ UNK_TYPE1 unk_10084[0x14];
/* 0x10098 */ CommonData_unk_10098* unk_10098;
/* 0x1009C */ UNK_TYPE1 unk_1009C[0x4];
/* 0x100A0 */ struct ToolClip* toolClip;
diff --git a/include/m_rcp.h b/include/m_rcp.h
index f8e5298..e4a33d3 100644
--- a/include/m_rcp.h
+++ b/include/m_rcp.h
@@ -19,7 +19,7 @@ void _texture_z_light_fog_prim(struct GraphicsContext *gfxCtx);
// void func_800BD538_jp();
void _texture_z_light_fog_prim_xlu(struct GraphicsContext *gfxCtx);
void func_800BD5C0_jp(struct GraphicsContext* gfxCtx);
-void func_800BD5E8_jp(struct GraphicsContext *gfxCtx);
+void _texture_z_light_fog_prim_npc(struct GraphicsContext *gfxCtx);
// void func_800BD648_jp();
// void func_800BD68C_jp();
// void func_800BD6D0_jp();
diff --git a/linker_scripts/jp/symbol_addrs_code.txt b/linker_scripts/jp/symbol_addrs_code.txt
index d37c324..7ef76c5 100644
--- a/linker_scripts/jp/symbol_addrs_code.txt
+++ b/linker_scripts/jp/symbol_addrs_code.txt
@@ -2885,7 +2885,7 @@ _texture_z_light_fog_prim_shadow = 0x800BD510; // type:func
func_800BD538_jp = 0x800BD538; // type:func
_texture_z_light_fog_prim_xlu = 0x800BD598; // type:func
func_800BD5C0_jp = 0x800BD5C0; // type:func
-func_800BD5E8_jp = 0x800BD5E8; // type:func
+_texture_z_light_fog_prim_npc = 0x800BD5E8; // type:func
func_800BD648_jp = 0x800BD648; // type:func
func_800BD68C_jp = 0x800BD68C; // type:func
func_800BD6D0_jp = 0x800BD6D0; // type:func
diff --git a/linker_scripts/jp/symbol_addrs_overlays.txt b/linker_scripts/jp/symbol_addrs_overlays.txt
index 1b86cf1..628c4a7 100644
--- a/linker_scripts/jp/symbol_addrs_overlays.txt
+++ b/linker_scripts/jp/symbol_addrs_overlays.txt
@@ -14456,7 +14456,7 @@ aTHB_actor_draw = 0x80A1FF58; // type:func
T_Hanabi_Profile = 0x80A20050; //
aim = 0x80A20074; // type:f32
-process = 0x80A2007C; //
+process = 0x80A2007C; // allow_duplicated:true
start_scale = 0x80A20090; // type:f32
D_80A200A4_jp = 0x80A200A4; //
@@ -20275,24 +20275,21 @@ RO_FLT_80A93464_jp = 0x80A93464; // type:f32
aKOI_actor_ct = 0x80A93570; // type:func
aKOI_actor_dt = 0x80A93604; // type:func
-func_80A9369C_jp = 0x80A9369C; // type:func
-func_80A936AC_jp = 0x80A936AC; // type:func
-func_80A936BC_jp = 0x80A936BC; // type:func
-func_80A9373C_jp = 0x80A9373C; // type:func
+aKOI_set_bgOffset = 0x80A9369C; // type:func
+aKOI_wait = 0x80A936AC; // type:func
+aKOI_setup_action = 0x80A936BC; // type:func
+aKOI_actor_move = 0x80A9373C; // type:func
aKOI_actor_init = 0x80A93870; // type:func
aKOI_actor_draw = 0x80A938D8; // type:func
// .data
Koinobori_Profile = 0x80A93A70; //
-D_80A93A94_jp = 0x80A93A94; //
-D_80A93A9C_jp = 0x80A93A9C; //
-D_80A93AB0_jp = 0x80A93AB0; //
-D_80A93AB4_jp = 0x80A93AB4; //
-D_80A93AD4_jp = 0x80A93AD4; //
-D_80A93B70_jp = 0x80A93B70; //
-D_80A93BE0_jp = 0x80A93BE0; //
-D_80A93C50_jp = 0x80A93C50; //
+aKOI_shadow_vtx_fix_flg_table = 0x80A93A94; //
+aKOI_shadow_data = 0x80A93A9C; //
+process = 0x80A93AB0; // allow_duplicated:true
+aKOI_obj_e_koinobori_a_pal = 0x80A93AB4; //
+obj_e_koinobori_b_pal = 0x80A93AD4; //
// .text
diff --git a/linker_scripts/jp/undefined_syms.ld b/linker_scripts/jp/undefined_syms.ld
index aa342de..7eea191 100644
--- a/linker_scripts/jp/undefined_syms.ld
+++ b/linker_scripts/jp/undefined_syms.ld
@@ -5669,6 +5669,12 @@ cKF_ba_r_obj_w_toudai = 0x06080A74;
obj_s_toudai_light_model = 0x0607E188;
obj_w_toudai_light_model = 0x0607FD90;
+// ac_koinobori
+obj_e_koinobori_shadow_v = 0x06001DC8; //
+obj_e_koinobori_shadowT_model = 0x06001E48; //
+cKF_bs_r_obj_e_koinobori = 0x0601F22C; //
+cKF_ba_r_obj_e_koinobori = 0x0601F6D4; //
+
// Buffers
D_801524C0_jp = 0x801524C0; //
diff --git a/requirements.txt b/requirements.txt
index 9693a9a..34bd7cd 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,4 @@
-splat64[mips]==0.21.0
+splat64[mips]==0.21.9
mapfile-parser>=1.2.1,<2.0.0
colorama
libyaz0
diff --git a/src/overlays/actors/ovl_Koinobori/ac_koinobori.c b/src/overlays/actors/ovl_Koinobori/ac_koinobori.c
index cd80ce0..97caf84 100644
--- a/src/overlays/actors/ovl_Koinobori/ac_koinobori.c
+++ b/src/overlays/actors/ovl_Koinobori/ac_koinobori.c
@@ -1,14 +1,25 @@
+#include "global.h"
#include "ac_koinobori.h"
#include "m_actor_dlftbls.h"
#include "m_object.h"
#include "overlays/gamestates/ovl_play/m_play.h"
+#include "c_keyframe.h"
+#include "m_player_lib.h"
+#include "69E2C0.h"
+#include "m_field_info.h"
+#include "audio.h"
+#include "overlays/actors/player_actor/m_player.h"
+#include "m_rcp.h"
+
+#define THIS ((Koinobori*)thisx)
void aKOI_actor_ct(Actor* thisx, Game_Play* game_play);
void aKOI_actor_dt(Actor* thisx, Game_Play* game_play);
void aKOI_actor_init(Actor* thisx, Game_Play* game_play);
void aKOI_actor_draw(Actor* thisx, Game_Play* game_play);
+void aKOI_set_bgOffset(Koinobori* this, s32 processIndex);
+void aKOI_setup_action(Koinobori* this, s32 processIndex);
-#if 0
ActorProfile Koinobori_Profile = {
/* */ ACTOR_KOINOBORI,
/* */ ACTOR_PART_0,
@@ -22,20 +33,125 @@ ActorProfile Koinobori_Profile = {
/* */ aKOI_actor_draw,
/* */ NULL,
};
-#endif
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Koinobori/ac_koinobori/aKOI_actor_ct.s")
+u8 aKOI_shadow_vtx_fix_flg_table[] = { 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01 };
+extern Vtx obj_e_koinobori_shadow_v[];
+extern Gfx obj_e_koinobori_shadowT_model[];
+ShadowData aKOI_shadow_data = { 8, aKOI_shadow_vtx_fix_flg_table, 60.0f, obj_e_koinobori_shadow_v,
+ obj_e_koinobori_shadowT_model };
+
+extern BaseSkeletonR cKF_bs_r_obj_e_koinobori;
+
+void aKOI_actor_ct(Actor* thisx, Game_Play* game_play UNUSED) {
+ Koinobori* this = THIS;
+
+ gSegments[6] = OS_K0_TO_PHYSICAL(common_data.unk_10098->unk_AC(0x27));
+ cKF_SkeletonInfo_R_ct(&this->skeletonInfo, &cKF_bs_r_obj_e_koinobori, 0, this->jointTable, this->morphTable);
+ aKOI_set_bgOffset(this, 1);
+ aKOI_setup_action(this, 0);
+ cKF_SkeletonInfo_R_play(&this->skeletonInfo);
+}
+
+void aKOI_actor_dt(Actor* thisx, Game_Play* game_play UNUSED) {
+ Koinobori* this = THIS;
+
+ common_data.unk_10098->unk_A8(&common_data.unk_10098->unk_B0, 8, 0x27, &this->actor);
+ common_data.unk_10098->unk_A8(&common_data.unk_10098->unk_454, 9, 0x50, &this->actor);
+ common_data.unk_10098->unk_A8(&common_data.unk_10098->unk_86C, 8, 0x27, &this->actor);
+ cKF_SkeletonInfo_R_dt(&this->skeletonInfo);
+}
+
+void aKOI_set_bgOffset(Koinobori* this UNUSED, s32 processIndex UNUSED) {
+}
+
+void aKOI_wait(Koinobori* this UNUSED, Game_Play* game_play UNUSED) {
+}
+
+extern BaseAnimationR cKF_ba_r_obj_e_koinobori;
+
+void aKOI_setup_action(Koinobori* this, s32 processIndex) {
+ static KoinoboriActionFunc process[] = { aKOI_wait };
+
+ cKF_SkeletonInfo_R_init(&this->skeletonInfo, this->skeletonInfo.skeleton, &cKF_ba_r_obj_e_koinobori, 1.0f, 1.0f,
+ 1.0f, 1.0f, 0.0f, ANIMATION_REPEAT, NULL);
+ this->unk2A0 = process[processIndex];
+ this->unk2B4 = processIndex;
+}
+
+void aKOI_actor_move(Actor* thisx, Game_Play* game_play) {
+ Koinobori* this = THIS;
+ UNUSED s32 pad;
+ Player* player = get_player_actor_withoutCheck(game_play);
+ s32 blockX;
+ s32 blockY;
+ s32 playerBlockX;
+ s32 playerBlockY;
+ UNUSED s32 pad2;
+
+ mFI_Wpos2BlockNum(&blockX, &blockY, this->actor.world.pos);
+ mFI_Wpos2BlockNum(&playerBlockX, &playerBlockY, player->actor.world.pos);
+
+ if ((mDemo_Check(1, &player->actor) == 0) && (mDemo_Check(5, &player->actor) == 0) &&
+ ((blockX != playerBlockX) || (blockY != playerBlockY))) {
+ Actor_delete(&this->actor);
+ return;
+ }
+
+ gSegments[6] = OS_K0_TO_PHYSICAL(common_data.unk_10098->unk_AC(0x27));
+ cKF_SkeletonInfo_R_play(&this->skeletonInfo);
+ this->unk2A0(this, game_play);
+ sAdo_OngenPos((u32)this, 0x35, &this->actor.world.pos);
+}
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Koinobori/ac_koinobori/aKOI_actor_dt.s")
+void aKOI_actor_init(Actor* thisx, Game_Play* game_play) {
+ Koinobori* this = THIS;
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Koinobori/ac_koinobori/func_80A9369C_jp.s")
+ mFI_SetFG_common(0xF100, this->actor.home.pos, 0);
+ aKOI_actor_move(&this->actor, game_play);
+ this->actor.update = aKOI_actor_move;
+}
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Koinobori/ac_koinobori/func_80A936AC_jp.s")
+#define OPEN_POLY_OPA_DISPS() \
+ { \
+ Gfx* __polyOpa = __gfxCtx->polyOpa.p; \
+ int __opa_opened = 0; \
+ while (0)
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Koinobori/ac_koinobori/func_80A936BC_jp.s")
+#define CLOSE_POLY_OPA_DISPS() \
+ __gfxCtx->polyOpa.p = __polyOpa; \
+ (void)__opa_opened; \
+ } \
+ while (0)
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Koinobori/ac_koinobori/func_80A9373C_jp.s")
+extern unsigned short aKOI_obj_e_koinobori_a_pal[];
+extern unsigned short obj_e_koinobori_b_pal[];
+#include "assets/jp/overlays/actors/ovl_Koinobori/aKOI_obj_e_koinobori_a_pal.palette.inc.c"
+#include "assets/jp/overlays/actors/ovl_Koinobori/obj_e_koinobori_b_pal.palette.inc.c"
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Koinobori/ac_koinobori/aKOI_actor_init.s")
+void aKOI_actor_draw(Actor* thisx, Game_Play* game_play) {
+ GraphicsContext* gfxCtx = game_play->state.gfxCtx;
+ Koinobori* this = THIS;
+ Mtx* mtx;
+ UNUSED s32 pad;
+ s32 object;
+ s32 palette;
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Koinobori/ac_koinobori/aKOI_actor_draw.s")
+ mtx = GRAPH_ALLOC_NO_ALIGN(gfxCtx, this->skeletonInfo.skeleton->unk01 * sizeof(Mtx));
+ if (mtx != NULL) {
+ object = common_data.unk_10098->unk_AC(0x27);
+ palette = common_data.unk_10098->unk_450(0x50);
+ _texture_z_light_fog_prim_npc(gfxCtx);
+ OPEN_DISPS(gfxCtx);
+ OPEN_POLY_OPA_DISPS();
+ gSPSegment(__polyOpa++, 0x08, palette);
+ gSPSegment(__polyOpa++, 0x09, Lib_SegmentedToVirtual(&obj_e_koinobori_b_pal));
+ gSPSegment(__polyOpa++, 0x0A, Lib_SegmentedToVirtual(&aKOI_obj_e_koinobori_a_pal));
+ gSegments[6] = OS_K0_TO_PHYSICAL(object);
+ gSPSegment(__polyOpa++, 0x06, object);
+ CLOSE_POLY_OPA_DISPS();
+ CLOSE_DISPS(gfxCtx);
+ if (1) {}
+ cKF_Si3_draw_R_SV(game_play, &this->skeletonInfo, mtx, NULL, NULL, this);
+ common_data.unk_10080->unk_04(game_play, &aKOI_shadow_data, 0x27);
+ }
+}
diff --git a/src/overlays/actors/ovl_Koinobori/ac_koinobori.h b/src/overlays/actors/ovl_Koinobori/ac_koinobori.h
index 7623bd5..4da0481 100644
--- a/src/overlays/actors/ovl_Koinobori/ac_koinobori.h
+++ b/src/overlays/actors/ovl_Koinobori/ac_koinobori.h
@@ -4,6 +4,7 @@
#include "ultra64.h"
#include "m_actor.h"
#include "unk.h"
+#include "c_keyframe.h"
struct Game_Play;
struct Koinobori;
@@ -12,7 +13,21 @@ typedef void (*KoinoboriActionFunc)(struct Koinobori*, struct Game_Play*);
typedef struct Koinobori {
/* 0x000 */ Actor actor;
- /* 0x174 */ UNK_TYPE1 unk_174[0x164];
+ /* 0x174 */ s32 unk174;
+ /* 0x178 */ SkeletonInfoR skeletonInfo;
+ /* 0x1E8 */ s32 unk1E8;
+ /* 0x1EC */ s_xyz jointTable[15];
+ /* 0x246 */ s_xyz morphTable[15];
+ /* 0x2A0 */ KoinoboriActionFunc unk2A0;
+ /* 0x2A4 */ UNK_TYPE1 unk2A4[0x10];
+ /* 0x2B4 */ UNK_TYPE unk2B4;
+ /* 0x2B8 */ UNK_TYPE1 unk2B8[0x4];
+ /* 0x2BC */ UNK_TYPE unk2BC;
+ /* 0x2C0 */ UNK_TYPE1 unk2C0[0x8];
+ /* 0x2C8 */ f32 unk2C8;
+ /* 0x2CC */ f32 unk2CC;
+ /* 0x2D0 */ f32 unk2D0;
+ /* 0x2D4 */ UNK_TYPE1 unk2D4[0x4];
} Koinobori; // size = 0x2D8
#endif
diff --git a/src/overlays/actors/ovl_T_Hanabi/ac_t_hanabi.c b/src/overlays/actors/ovl_T_Hanabi/ac_t_hanabi.c
index 746462e..8616bc4 100644
--- a/src/overlays/actors/ovl_T_Hanabi/ac_t_hanabi.c
+++ b/src/overlays/actors/ovl_T_Hanabi/ac_t_hanabi.c
@@ -111,7 +111,7 @@ void aTHB_actor_draw(Actor* thisx, Game_Play* game_play) {
}
Matrix_scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY);
- func_800BD5E8_jp(gfxCtx);
+ _texture_z_light_fog_prim_npc(gfxCtx);
OPEN_DISPS(gfxCtx);
OPEN_POLY_OPA_DISPS();
gSPMatrix(__polyOpa++, _Matrix_to_Mtx_new(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
diff --git a/yamls/jp/overlays.yaml b/yamls/jp/overlays.yaml
index c4bb6bb..ce50dff 100644
--- a/yamls/jp/overlays.yaml
+++ b/yamls/jp/overlays.yaml
@@ -15114,6 +15114,7 @@
- [0x9536E0, data, overlays/actors/ovl_Tunahiki_Npc1/ac_tunahiki_npc1_reloc]
- name: ovl_Koinobori
+ dir: overlays/actors/ovl_Koinobori
type: code
start: 0x9537E0
vram: 0x80A93570
@@ -15121,8 +15122,15 @@
compress: True
bss_size: 0x0
subsegments:
- - [0x9537E0, c, overlays/actors/ovl_Koinobori/ac_koinobori]
- - [0x953CE0, data, overlays/actors/ovl_Koinobori/ac_koinobori]
+ - [0x9537E0, c, ac_koinobori]
+ - start: 0x953CE0
+ type: .data
+ name: ac_koinobori
+ subsegments:
+ - [0x953CE0, .data, ac_koinobori]
+ - [0x953D24, af_palette, aKOI_obj_e_koinobori_a_pal]
+ - [0x953D44, af_palette, obj_e_koinobori_b_pal]
+ - [0x953D64]
- name: ovl_Koinobori_reloc
type: code
start: 0x953D70