From 99081d5a7ec723e439e352f00d14fa2bb569e69b Mon Sep 17 00:00:00 2001 From: inspectredc <78732756+inspectredc@users.noreply.github.com> Date: Mon, 22 Apr 2024 21:21:18 +0100 Subject: ac_kago OK and documented (#177) * ac_kago OK and documented * palette types * suggestions + object stuff --- src/overlays/actors/ovl_Kago/ac_kago.c | 126 ++++++++++++++++++++--- src/overlays/actors/ovl_Kago/ac_kago.h | 13 ++- src/overlays/actors/ovl_Koinobori/ac_koinobori.c | 2 +- src/overlays/actors/ovl_Toudai/ac_toudai.c | 4 +- 4 files changed, 127 insertions(+), 18 deletions(-) (limited to 'src') 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; -- cgit v1.2.3