diff options
| author | emilybrooks <emilybrooksemilybrooks@gmail.com> | 2024-02-06 18:49:33 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-06 18:49:33 -0700 |
| commit | 1d31ba9ecd3efbe7585e000a2876624f4f7df322 (patch) | |
| tree | c1fef3e1640a743358dc4ed30418d8232864ab26 /src | |
| parent | 24074d678d5d87a987bbda221f7da1a0dd02ea35 (diff) | |
ac_koinobori OK (#140)
* initial commit
* everything but draw
* fully matching
* imported data
* fixed errors
* review
Diffstat (limited to 'src')
| -rw-r--r-- | src/overlays/actors/ovl_Koinobori/ac_koinobori.c | 136 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_Koinobori/ac_koinobori.h | 17 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_T_Hanabi/ac_t_hanabi.c | 2 |
3 files changed, 143 insertions, 12 deletions
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); |
