summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinspectredc <78732756+inspectredc@users.noreply.github.com>2024-04-22 21:21:18 +0100
committerGitHub <noreply@github.com>2024-04-22 13:21:18 -0700
commit99081d5a7ec723e439e352f00d14fa2bb569e69b (patch)
tree11746eb57a599970cdb4eba387f95b266fc1c5ae
parent202737c1f0e252059f16a45dcda0c8a7b3dde78c (diff)
ac_kago OK and documented (#177)
* ac_kago OK and documented * palette types * suggestions + object stuff
-rw-r--r--include/m_clip.h8
-rw-r--r--include/m_collision_bg.h2
-rw-r--r--linker_scripts/jp/symbol_addrs_code.txt2
-rw-r--r--linker_scripts/jp/symbol_addrs_overlays.txt16
-rw-r--r--linker_scripts/jp/undefined_syms.ld3
-rw-r--r--src/overlays/actors/ovl_Kago/ac_kago.c126
-rw-r--r--src/overlays/actors/ovl_Kago/ac_kago.h13
-rw-r--r--src/overlays/actors/ovl_Koinobori/ac_koinobori.c2
-rw-r--r--src/overlays/actors/ovl_Toudai/ac_toudai.c4
-rw-r--r--tools/profiles.txt2
-rw-r--r--yamls/jp/overlays.yaml2
11 files changed, 144 insertions, 36 deletions
diff --git a/include/m_clip.h b/include/m_clip.h
index b096d4f..97cb356 100644
--- a/include/m_clip.h
+++ b/include/m_clip.h
@@ -86,7 +86,7 @@ typedef struct Clip_unk_070 {
} Clip_unk_070; // size >= 0x10
typedef UNK_RET (*Clip_unk_074_unk_00)(UNK_TYPE);
-typedef void (*Clip_unk_074_unk_04)(struct Game_Play* game_play, struct ShadowData* shadowData, s16 unk2);
+typedef void (*Clip_unk_074_unk_04)(struct Game_Play* game_play, struct ShadowData* shadowData, s32 unk2);
typedef void (*Clip_unk_074_unk_30)(UNK_TYPE, UNK_TYPE, UNK_TYPE, UNK_TYPE);
typedef struct Clip_unk_074 {
@@ -119,9 +119,9 @@ typedef UNK_RET (*Clip_unk_08C_unk_8)(void);
typedef UNK_PTR (*Clip_unk_08C_unk_0C)(void);
typedef UNK_RET (*Clip_unk_08C_unk_10)(struct Actor*);
typedef void (*Clip_unk_08C_unk_A4)(struct ObjectExchangeBank*);
-typedef UNK_RET (*Clip_unk_08C_unk_A8)(UNK_PTR, UNK_TYPE, u16 name, struct Actor* actor);
-typedef UNK_RET (*Clip_unk_08C_unk_AC)(u16);
-typedef UNK_RET (*Clip_unk_08C_unk_450)(u16);
+typedef UNK_RET (*Clip_unk_08C_unk_A8)(UNK_PTR, UNK_TYPE, s16 name, struct Actor* actor);
+typedef UNK_RET (*Clip_unk_08C_unk_AC)(s16);
+typedef u16* (*Clip_unk_08C_unk_450)(s16);
typedef struct Clip_unk_08C {
/* 0x00 */ UNK_TYPE1 unk_00[0x4];
diff --git a/include/m_collision_bg.h b/include/m_collision_bg.h
index 6080ba5..3294cd1 100644
--- a/include/m_collision_bg.h
+++ b/include/m_collision_bg.h
@@ -261,7 +261,7 @@ f32 mCoBG_GetBalloonGroundY(xyz_t*);
// void func_80073800_jp();
// void func_800738A4_jp();
// void func_80073970_jp();
-// void func_800739FC_jp();
+void mCoBG_SetPlussOffset(xyz_t, s32, s32);
// void func_80073C38_jp();
// void func_80073CC0_jp();
void mCoBG_SetPluss5PointOffset_file(xyz_t pos, mCoBG_unkStruct2 arg1, char* file, s32 line);
diff --git a/linker_scripts/jp/symbol_addrs_code.txt b/linker_scripts/jp/symbol_addrs_code.txt
index 7e3a3f1..f03c268 100644
--- a/linker_scripts/jp/symbol_addrs_code.txt
+++ b/linker_scripts/jp/symbol_addrs_code.txt
@@ -812,7 +812,7 @@ func_800737D4_jp = 0x800737D4; // type:func
func_80073800_jp = 0x80073800; // type:func
func_800738A4_jp = 0x800738A4; // type:func
func_80073970_jp = 0x80073970; // type:func
-func_800739FC_jp = 0x800739FC; // type:func
+mCoBG_SetPlussOffset = 0x800739FC; // type:func
func_80073C38_jp = 0x80073C38; // type:func
func_80073CC0_jp = 0x80073CC0; // type:func
mCoBG_SetPluss5PointOffset_file = 0x80073D80; // type:func
diff --git a/linker_scripts/jp/symbol_addrs_overlays.txt b/linker_scripts/jp/symbol_addrs_overlays.txt
index 5f2e06e..0449321 100644
--- a/linker_scripts/jp/symbol_addrs_overlays.txt
+++ b/linker_scripts/jp/symbol_addrs_overlays.txt
@@ -20010,21 +20010,19 @@ D_80A8F298_jp = 0x80A8F298; //
// .text
aKAG_actor_ct = 0x80A8F2F0; // type:func
-func_80A8F340_jp = 0x80A8F340; // type:func
-func_80A8F3CC_jp = 0x80A8F3CC; // type:func
-func_80A8F418_jp = 0x80A8F418; // type:func
-func_80A8F428_jp = 0x80A8F428; // type:func
-func_80A8F448_jp = 0x80A8F448; // type:func
+aKAG_actor_dt = 0x80A8F340; // type:func
+aKAG_set_bgOffset = 0x80A8F3CC; // type:func
+aKAG_wait = 0x80A8F418; // type:func
+aKAG_setup_action = 0x80A8F428; // type:func
+aKAG_actor_move = 0x80A8F448; // type:func
aKAG_actor_init = 0x80A8F530; // type:func
aKAG_actor_draw = 0x80A8F598; // type:func
// .data
Kago_Profile = 0x80A8F6E0; //
-D_80A8F704_jp = 0x80A8F704; //
-D_80A8F714_jp = 0x80A8F714; //
-D_80A8F728_jp = 0x80A8F728; //
-D_80A8F72C_jp = 0x80A8F72C; //
+aKAG_shadow_vtx_fix_flg_table = 0x80A8F704; //
+aKAG_shadow_data = 0x80A8F714; //
// .text
diff --git a/linker_scripts/jp/undefined_syms.ld b/linker_scripts/jp/undefined_syms.ld
index 70cb5ef..17a206a 100644
--- a/linker_scripts/jp/undefined_syms.ld
+++ b/linker_scripts/jp/undefined_syms.ld
@@ -4862,7 +4862,8 @@ D_6001284 = 0x06001284;
// ovl_Kago
-D_6001628 = 0x06001628;
+obj_e_kago_shadow_v = 0x06001628;
+obj_e_kago_shadow_model = 0x060016F8;
// ovl__0094FA20
diff --git a/src/overlays/actors/ovl_Kago/ac_kago.c b/src/overlays/actors/ovl_Kago/ac_kago.c
index 26b5410..d88e228 100644
--- a/src/overlays/actors/ovl_Kago/ac_kago.c
+++ b/src/overlays/actors/ovl_Kago/ac_kago.c
@@ -2,13 +2,26 @@
#include "m_actor_dlftbls.h"
#include "m_object.h"
#include "overlays/gamestates/ovl_play/m_play.h"
+#include "overlays/actors/player_actor/m_player.h"
+#include "69E2C0.h"
+#include "m_field_info.h"
+#include "m_player_lib.h"
+#include "m_rcp.h"
+#include "code_variables.h"
+
+#include "objects/object_00D5E000/obj_e_kago_r/obj_e_kago_r.h"
+#include "objects/object_00D5E000/obj_e_kago_w/obj_e_kago_w.h"
+
+#define THIS ((Kago*)thisx)
void aKAG_actor_ct(Actor* thisx, Game_Play* game_play);
-void func_80A8F340_jp(Actor* thisx, Game_Play* game_play);
+void aKAG_actor_dt(Actor* thisx, Game_Play* game_play);
void aKAG_actor_init(Actor* thisx, Game_Play* game_play);
void aKAG_actor_draw(Actor* thisx, Game_Play* game_play);
-#if 0
+void aKAG_set_bgOffset(Kago*, s32);
+void aKAG_setup_action(Kago*, s32);
+
ActorProfile Kago_Profile = {
/* */ ACTOR_KAGO,
/* */ ACTOR_PART_0,
@@ -17,25 +30,114 @@ ActorProfile Kago_Profile = {
/* */ GAMEPLAY_KEEP,
/* */ sizeof(Kago),
/* */ aKAG_actor_ct,
- /* */ func_80A8F340_jp,
+ /* */ aKAG_actor_dt,
/* */ aKAG_actor_init,
/* */ aKAG_actor_draw,
/* */ NULL,
};
-#endif
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Kago/ac_kago/aKAG_actor_ct.s")
+void aKAG_actor_ct(Actor* thisx, UNUSED Game_Play* game_play) {
+ Kago* this = THIS;
+
+ this->type = this->actor.fgName - 0x5835;
+ this->structureType = this->type + 0x23;
+ this->structurePalette = this->type + 0x4C;
+ aKAG_setup_action(this, 0);
+ aKAG_set_bgOffset(this, 1);
+}
+
+void aKAG_actor_dt(Actor* thisx, UNUSED Game_Play* game_play) {
+ Kago* this = THIS;
+
+ common_data.clip.unk_08C->unk_A8(&common_data.clip.unk_08C->unk_B0, 8, this->structureType, &this->actor);
+ common_data.clip.unk_08C->unk_A8(&common_data.clip.unk_08C->unk_454, 9, this->structurePalette, &this->actor);
+ common_data.clip.unk_08C->unk_A8(&common_data.clip.unk_08C->unk_86C, 8, this->structureType, &this->actor);
+}
+
+void aKAG_set_bgOffset(Kago* this, s32 id) {
+ id = id == 0 ? 10 : 10;
+ mCoBG_SetPlussOffset(this->actor.home.pos, id, 100);
+}
+
+void aKAG_wait(UNUSED Kago* this, UNUSED Game_Play* game_play) {
+}
+
+u8 aKAG_shadow_vtx_fix_flg_table[] = { 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0 };
+
+extern Vtx obj_e_kago_shadow_v[];
+extern Gfx obj_e_kago_shadow_model[];
+
+ShadowData aKAG_shadow_data = { 13, aKAG_shadow_vtx_fix_flg_table, 60.0f, obj_e_kago_shadow_v,
+ obj_e_kago_shadow_model };
+
+void aKAG_setup_action(Kago* this, s32 processIndex) {
+ static KagoActionFunc process[] = { &aKAG_wait };
+
+ this->process = process[processIndex];
+ this->processNum = processIndex;
+}
+
+void aKAG_actor_move(Actor* thisx, Game_Play* game_play) {
+ UNUSED UNK_TYPE1 pad[0x4];
+ Kago* this = THIS;
+ Player* player = get_player_actor_withoutCheck(game_play);
+ s32 xBlock;
+ s32 yBlock;
+ s32 playerXBlock;
+ s32 playerYBlock;
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Kago/ac_kago/func_80A8F340_jp.s")
+ mFI_Wpos2BlockNum(&xBlock, &yBlock, this->actor.world.pos);
+ mFI_Wpos2BlockNum(&playerXBlock, &playerYBlock, player->actor.world.pos);
+ if ((mDemo_Check(1, &player->actor) == 0) && (mDemo_Check(5, &player->actor) == 0) &&
+ ((xBlock != playerXBlock) || (yBlock != playerYBlock))) {
+ Actor_delete(&this->actor);
+ } else {
+ this->process(this, game_play);
+ }
+}
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Kago/ac_kago/func_80A8F3CC_jp.s")
+void aKAG_actor_init(Actor* thisx, Game_Play* game_play) {
+ Kago* this = THIS;
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Kago/ac_kago/func_80A8F418_jp.s")
+ mFI_SetFG_common(0xF0FD, this->actor.home.pos, 0);
+ aKAG_actor_move(&this->actor, game_play);
+ this->actor.update = aKAG_actor_move;
+}
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Kago/ac_kago/func_80A8F428_jp.s")
+#define OPEN_CUSTOM_POLY_OPA() \
+ { \
+ Gfx* __polyOpa = __gfxCtx->polyOpa.p; \
+ int __opa_opened = 0; \
+ do { \
+ } while (0)
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Kago/ac_kago/func_80A8F448_jp.s")
+#define CLOSE_CUSTOM_POLY_OPA() \
+ __gfxCtx->polyOpa.p = __polyOpa; \
+ (void)__opa_opened; \
+ } \
+ do { \
+ } while (0)
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Kago/ac_kago/aKAG_actor_init.s")
+void aKAG_actor_draw(Actor* thisx, Game_Play* game_play) {
+ static Gfx* model[] = { kago_r_DL_model, kago_w_DL_model };
+ GraphicsContext* gfxCtx = game_play->state.gfxCtx;
+ Kago* this = THIS;
+ u32 object = common_data.clip.unk_08C->unk_AC(this->structureType);
+ u16* palette = common_data.clip.unk_08C->unk_450(this->structurePalette);
+ Mtx* mtx;
-#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Kago/ac_kago/aKAG_actor_draw.s")
+ OPEN_DISPS(gfxCtx);
+ mtx = _Matrix_to_Mtx_new(gfxCtx);
+ if (mtx != NULL) {
+ _texture_z_light_fog_prim(gfxCtx);
+ OPEN_CUSTOM_POLY_OPA();
+ gSPSegment(__polyOpa++, 0x08, palette);
+ gSegments[6] = (uintptr_t)OS_PHYSICAL_TO_K0(object);
+ gSPSegment(__polyOpa++, 0x06, object);
+ gSPMatrix(__polyOpa++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(__polyOpa++, model[this->type]);
+ CLOSE_CUSTOM_POLY_OPA();
+ common_data.clip.unk_074->unk_04(game_play, &aKAG_shadow_data, this->structureType);
+ }
+ CLOSE_DISPS(gfxCtx);
+}
diff --git a/src/overlays/actors/ovl_Kago/ac_kago.h b/src/overlays/actors/ovl_Kago/ac_kago.h
index 2f91cd8..bee6727 100644
--- a/src/overlays/actors/ovl_Kago/ac_kago.h
+++ b/src/overlays/actors/ovl_Kago/ac_kago.h
@@ -1,18 +1,25 @@
#ifndef AC_KAGO_H
#define AC_KAGO_H
-
#include "ultra64.h"
#include "m_actor.h"
#include "unk.h"
+#include "c_keyframe.h"
struct Game_Play;
struct Kago;
-
typedef void (*KagoActionFunc)(struct Kago*, struct Game_Play*);
typedef struct Kago {
/* 0x000 */ Actor actor;
- /* 0x174 */ UNK_TYPE1 unk_174[0x164];
+ /* 0x174 */ UNK_TYPE1 unk_174[0x12C];
+ /* 0x2A0 */ KagoActionFunc process;
+ /* 0x2A4 */ UNK_TYPE1 unk_2A4[0x4];
+ /* 0x2A8 */ s32 structureType;
+ /* 0x2AC */ s32 structurePalette;
+ /* 0x2B0 */ UNK_TYPE1 unk_2B0[0x4];
+ /* 0x2B4 */ s32 type;
+ /* 0x2B8 */ s32 processNum;
+ /* 0x2BC */ UNK_TYPE1 unk_2BC[0x1C];
} Kago; // size = 0x2D8
#endif
diff --git a/src/overlays/actors/ovl_Koinobori/ac_koinobori.c b/src/overlays/actors/ovl_Koinobori/ac_koinobori.c
index 9ca8afe..466b03c 100644
--- a/src/overlays/actors/ovl_Koinobori/ac_koinobori.c
+++ b/src/overlays/actors/ovl_Koinobori/ac_koinobori.c
@@ -133,7 +133,7 @@ void aKOI_actor_draw(Actor* thisx, Game_Play* game_play) {
Mtx* mtx;
UNUSED s32 pad;
s32 object;
- s32 palette;
+ u16* palette;
mtx = GRAPH_ALLOC_NO_ALIGN(gfxCtx, this->skeletonInfo.skeleton->unk01 * sizeof(Mtx));
if (mtx != NULL) {
diff --git a/src/overlays/actors/ovl_Toudai/ac_toudai.c b/src/overlays/actors/ovl_Toudai/ac_toudai.c
index abbcffa..fe80eea 100644
--- a/src/overlays/actors/ovl_Toudai/ac_toudai.c
+++ b/src/overlays/actors/ovl_Toudai/ac_toudai.c
@@ -259,7 +259,7 @@ s32 aTOU_actor_draw_after(Game_Play* game_play, SkeletonInfoR* skeletonInfo UNUS
Toudai* this = (Toudai*)thisx;
s32 type;
s32 object;
- s32 palette;
+ u16* palette;
Mtx* mtx;
// LIGHTHOUSE_JOINT_LIGHT
@@ -296,7 +296,7 @@ void aTOU_actor_draw(Actor* thisx, Game_Play* game_play) {
UNUSED s32 pad2[2];
Toudai* this = THIS;
s32 object;
- s32 palette;
+ u16* palette;
UNUSED s32 pad3;
Mtx* mtx;
xyz_t* worldPosition = &this->actor.world.pos;
diff --git a/tools/profiles.txt b/tools/profiles.txt
index c86ffca..6be6bac 100644
--- a/tools/profiles.txt
+++ b/tools/profiles.txt
@@ -235,7 +235,7 @@ asm/jp/data/overlays/actors/ovl_Kago/ac_kago.data.s-/* 94F964 80A8F6E4 */ .word
asm/jp/data/overlays/actors/ovl_Kago/ac_kago.data.s-/* 94F968 80A8F6E8 */ .word 0x58350003
asm/jp/data/overlays/actors/ovl_Kago/ac_kago.data.s-/* 94F96C 80A8F6EC */ .word 0x000002D8
asm/jp/data/overlays/actors/ovl_Kago/ac_kago.data.s-/* 94F970 80A8F6F0 */ .word aKAG_actor_ct
-asm/jp/data/overlays/actors/ovl_Kago/ac_kago.data.s-/* 94F974 80A8F6F4 */ .word func_80A8F340_jp
+asm/jp/data/overlays/actors/ovl_Kago/ac_kago.data.s-/* 94F974 80A8F6F4 */ .word aKAG_actor_dt
asm/jp/data/overlays/actors/ovl_Kago/ac_kago.data.s-/* 94F978 80A8F6F8 */ .word aKAG_actor_init
asm/jp/data/overlays/actors/ovl_Kago/ac_kago.data.s-/* 94F97C 80A8F6FC */ .word aKAG_actor_draw
asm/jp/data/overlays/actors/ovl_Kago/ac_kago.data.s-/* 94F980 80A8F700 */ .word 0x00000000
diff --git a/yamls/jp/overlays.yaml b/yamls/jp/overlays.yaml
index 9c9e24a..ef5b267 100644
--- a/yamls/jp/overlays.yaml
+++ b/yamls/jp/overlays.yaml
@@ -14917,7 +14917,7 @@
bss_size: 0x0
subsegments:
- [0x94F570, c, overlays/actors/ovl_Kago/ac_kago]
- - [0x94F960, data, overlays/actors/ovl_Kago/ac_kago]
+ - [0x94F960, .data, overlays/actors/ovl_Kago/ac_kago]
- name: ovl_Kago_reloc
type: code
start: 0x94F9C0