diff options
| author | Prakxo <87568477+Prakxo@users.noreply.github.com> | 2024-01-20 01:09:40 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-19 17:09:40 -0700 |
| commit | cc4355f6adae67c2f90b78659dc6bcf13910cc86 (patch) | |
| tree | d4123f90e73c5a5e1abb43bed8444163721707d7 | |
| parent | 7606ac4586b9ce976dcf7978a9fe3b7e58d1c727 (diff) | |
ac_sample OK (#134)
* ac_sample OK
* some review
* review
| -rw-r--r-- | include/69E2C0.h | 4 | ||||
| -rw-r--r-- | include/m_msg_main.h | 14 | ||||
| -rw-r--r-- | linker_scripts/jp/symbol_addrs_code.txt | 8 | ||||
| -rw-r--r-- | linker_scripts/jp/undefined_syms.ld | 8 | ||||
| -rw-r--r-- | src/code/m_submenu.c | 2 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_Sample/ac_sample.c | 247 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_Sample/ac_sample.h | 11 | ||||
| -rw-r--r-- | yamls/jp/overlays.yaml | 4 |
8 files changed, 241 insertions, 57 deletions
diff --git a/include/69E2C0.h b/include/69E2C0.h index 6ad67b0..be1e58a 100644 --- a/include/69E2C0.h +++ b/include/69E2C0.h @@ -88,8 +88,8 @@ void mDemo_Set_ListenAble(void); // void func_8007D0B0_jp(); // void func_8007D0C4_jp(); // void func_8007D0D8_jp(); -// void func_8007D0EC_jp(); -// void func_8007D100_jp(); +s32 mDemo_Check_ListenAble(void); +s32 mDemo_Check_DiffAngle_forTalk(s16 angle); // void func_8007D128_jp(); #endif diff --git a/include/m_msg_main.h b/include/m_msg_main.h index 43df742..c937273 100644 --- a/include/m_msg_main.h +++ b/include/m_msg_main.h @@ -6,13 +6,13 @@ struct Game_Play; -UNK_TYPE mMsg_Get_base_window_p(void); +UNK_PTR mMsg_Get_base_window_p(void); // void func_8009D200_jp(); // void func_8009D210_jp(); // void func_8009D260_jp(); // void func_8009D274_jp(); -UNK_RET mMsg_Check_not_series_main_wait(UNK_TYPE arg0); -UNK_RET mMsg_Check_main_hide(UNK_TYPE arg0); +UNK_RET mMsg_Check_not_series_main_wait(UNK_PTR arg0); +UNK_RET mMsg_Check_main_hide(UNK_PTR arg0); // void func_8009D308_jp(); // void func_8009D3B4_jp(); // void func_8009D3E4_jp(); @@ -26,12 +26,12 @@ UNK_RET mMsg_Check_main_hide(UNK_TYPE arg0); // void func_8009D620_jp(); // void func_8009D640_jp(); // void func_8009D688_jp(); -void mMsg_Set_free_str(UNK_TYPE arg0, s32 arg1, UNK_PTR arg2, s32 arg3); +void mMsg_Set_free_str(UNK_PTR arg0, s32 arg1, UNK_PTR arg2, s32 arg3); // void func_8009D820_jp(); -// void func_8009D88C_jp(); +void mMsg_Set_item_str(UNK_PTR arg0, s32 arg1, char* str, s32 size); // void func_8009D9A4_jp(); // void func_8009DA1C_jp(); -// void func_8009DA94_jp(); +void mMsg_Set_mail_str(UNK_PTR arg0, s32 arg1, char* str, s32 size); // void func_8009DBA4_jp(); // void func_8009DBB0_jp(); // void func_8009DBE0_jp(); @@ -131,7 +131,7 @@ void mMsg_Set_free_str(UNK_TYPE arg0, s32 arg1, UNK_PTR arg2, s32 arg3); // void func_8009FC5C_jp(); // void func_8009FCB8_jp(); // void func_8009FCE0_jp(); -void mMsg_sound_spec_change_voice(UNK_TYPE arg0); +void mMsg_sound_spec_change_voice(UNK_PTR arg0); // void func_8009FD80_jp(); // void func_8009FDA0_jp(); // void func_8009FDF8_jp(); diff --git a/linker_scripts/jp/symbol_addrs_code.txt b/linker_scripts/jp/symbol_addrs_code.txt index 63b1ae8..86f8b8e 100644 --- a/linker_scripts/jp/symbol_addrs_code.txt +++ b/linker_scripts/jp/symbol_addrs_code.txt @@ -1052,8 +1052,8 @@ mDemo_Set_ListenAble = 0x8007D098; // type:func func_8007D0B0_jp = 0x8007D0B0; // type:func func_8007D0C4_jp = 0x8007D0C4; // type:func func_8007D0D8_jp = 0x8007D0D8; // type:func -func_8007D0EC_jp = 0x8007D0EC; // type:func -func_8007D100_jp = 0x8007D100; // type:func +mDemo_Check_ListenAble = 0x8007D0EC; // type:func +mDemo_Check_DiffAngle_forTalk = 0x8007D100; // type:func func_8007D128_jp = 0x8007D128; // type:func func_8007D140_jp = 0x8007D140; // type:func func_8007D180_jp = 0x8007D180; // type:func @@ -1923,10 +1923,10 @@ func_8009D640_jp = 0x8009D640; // type:func func_8009D688_jp = 0x8009D688; // type:func mMsg_Set_free_str = 0x8009D6D0; // type:func func_8009D820_jp = 0x8009D820; // type:func -func_8009D88C_jp = 0x8009D88C; // type:func +mMsg_Set_item_str = 0x8009D88C; // type:func func_8009D9A4_jp = 0x8009D9A4; // type:func func_8009DA1C_jp = 0x8009DA1C; // type:func -func_8009DA94_jp = 0x8009DA94; // type:func +mMsg_Set_mail_str = 0x8009DA94; // type:func func_8009DBA4_jp = 0x8009DBA4; // type:func func_8009DBB0_jp = 0x8009DBB0; // type:func func_8009DBE0_jp = 0x8009DBE0; // type:func diff --git a/linker_scripts/jp/undefined_syms.ld b/linker_scripts/jp/undefined_syms.ld index e120cda..b28eeb2 100644 --- a/linker_scripts/jp/undefined_syms.ld +++ b/linker_scripts/jp/undefined_syms.ld @@ -1052,10 +1052,10 @@ D_C000000 = 0x0C000000; // ovl_Sample -D_60018AC = 0x060018AC; -D_60019B8 = 0x060019B8; -D_60019D0 = 0x060019D0; -D_60019F0 = 0x060019F0; +cKF_bs_r_hnw = 0x060018AC; +cKF_ba_r_hnw_move = 0x060019B8; +hnw_face = 0x060019D0; +hnw_tmem_txt = 0x060019F0; // ovl_My_Room diff --git a/src/code/m_submenu.c b/src/code/m_submenu.c index 2860ab1..cf7e269 100644 --- a/src/code/m_submenu.c +++ b/src/code/m_submenu.c @@ -489,7 +489,7 @@ void mSM_move_Play(Submenu* submenu) { void mSM_move_End(Submenu* submenu) { UNUSED s32 pad; Game_Play* sp28; - UNK_TYPE sp24; + UNK_PTR sp24; UNUSED s32 sp20[1]; sp28 = (Game_Play*)gamePT; diff --git a/src/overlays/actors/ovl_Sample/ac_sample.c b/src/overlays/actors/ovl_Sample/ac_sample.c index e116dbd..7ece473 100644 --- a/src/overlays/actors/ovl_Sample/ac_sample.c +++ b/src/overlays/actors/ovl_Sample/ac_sample.c @@ -1,54 +1,233 @@ #include "ac_sample.h" #include "m_actor_dlftbls.h" #include "m_object.h" +#include "m_rcp.h" +#include "69E2C0.h" +#include "m_msg_main.h" #include "overlays/gamestates/ovl_play/m_play.h" -void Ac_Sample_Actor_ct(Actor* thisx, Game_Play* game_play); -void Ac_Sample_Actor_dt(Actor* thisx, Game_Play* game_play); -void Ac_Sample_Actor_main(Actor* thisx, Game_Play* game_play); -void Ac_Sample_Actor_draw(Actor* thisx, Game_Play* game_play); +void Ac_Sample_Actor_ct(Actor* thisx, Game_Play* play); +void Ac_Sample_Actor_dt(Actor* thisx, Game_Play* play); +void Ac_Sample_Actor_main(Actor* thisx, Game_Play* play); +void Ac_Sample_Actor_draw(Actor* thisx, Game_Play* play); -#if 0 -ActorProfile Sample_Profile = { - /* */ ACTOR_SAMPLE, - /* */ ACTOR_PART_4, - /* */ 0, - /* */ 0x9000, - /* */ OBJECT_12, - /* */ sizeof(Sample), - /* */ Ac_Sample_Actor_ct, - /* */ Ac_Sample_Actor_dt, - /* */ Ac_Sample_Actor_main, - /* */ Ac_Sample_Actor_draw, - /* */ NULL, +// TODO: extract assets + +extern BaseSkeletonR cKF_bs_r_hnw; +extern BaseAnimationR cKF_ba_r_hnw_move; + +extern u8 hnw_tmem_txt[]; +extern u16 hnw_face[]; + +ClObjPipe_Init Ac_Sample_OcInfoData_forStand = { + { OC1_1 | OC1_TYPE_8 | OC1_TYPE_10 | OC1_TYPE_20, OC2_TYPE_20, COLSHAPE_PIPE }, + { ELEM_FLAG_1 }, + { { 0x1E, 0x3C, 0, { 0, 0, 0 } } }, }; -#endif -extern ClObjPipe_Init Ac_Sample_OcInfoData_forStand; -#if 0 -ClObjPipe_Init Ac_Sample_OcInfoData_forStand = { { OC1_1 | OC1_TYPE_8 | OC1_TYPE_10 | OC1_TYPE_20, OC2_TYPE_20, COLSHAPE_PIPE }, { ELEM_FLAG_1 }, { { 0x1E, 0x3C, 0, { 0, 0, 0 } } } }; -#endif +void Ac_Sample_ct_forCorect(Actor* thisx, Game_Play* play) { + + Sample* this = (Sample*)thisx; + + ClObjPipe_ct(play, &this->stand); + ClObjPipe_set5(play, &this->stand, thisx, &Ac_Sample_OcInfoData_forStand); +} + +void Ac_Sample_Excute_Corect(Actor* thisx, Game_Play* play) { + UNUSED s32 pad[3]; + Sample* this = (Sample*)thisx; + ClObjPipe* stand = &this->stand; + + CollisionCheck_Uty_ActorWorldPosSetPipeC(thisx, stand); + CollisionCheck_setOC(play, &play->unk_2138, &stand->base); +} + +void Ac_Sample_Actor_dt(Actor* thisx, Game_Play* play) { + Sample* this = (Sample*)thisx; + SkeletonInfoR* info = &this->skeletonInfo; + + if (thisx->child != NULL) { + Actor_delete(thisx->child); + } + + cKF_SkeletonInfo_R_dt(info); + ClObjPipe_dt(play, &this->stand); +} + +void Ac_Sample_Animation_Base(Sample* this) { + cKF_SkeletonInfo_R_play(&this->skeletonInfo); +} + +char Ac_Sample_str_mail[64]; + +void Ac_Sample_Actor_wait_demo_ct(UNUSED Actor* thisx) { + static char str0[] = { + 0xDC, 0xB8, 0x97, 0x8C, 0x9D, 0x20, 0x20, 0x20, 0x20, 0x20, + }; + static char str9[] = { + 0xE4, 0xBA, 0x9D, 0xA3, 0x32, + }; + + mDemo_Set_msg_num(9); + + mMsg_Set_item_str(mMsg_Get_base_window_p(), 0, str0, 6); + + mMsg_Set_item_str(mMsg_Get_base_window_p(), 4, str9, sizeof(str9)); + mMsg_Set_free_str(mMsg_Get_base_window_p(), 0, str0, sizeof(str0)); + mMsg_Set_free_str(mMsg_Get_base_window_p(), 9, str9, sizeof(str9)); + mMsg_Set_mail_str(mMsg_Get_base_window_p(), 0, Ac_Sample_str_mail, sizeof(Ac_Sample_str_mail)); +} + +void func_80934104_jp(Actor* thisx, Game_Play* play) { + Sample* this = (Sample*)thisx; + void* segment = play->objectExchangeBank.status[thisx->unk_026].segment; + SkeletonInfoR* info = &this->skeletonInfo; + + if (segment != this->segment) { + info->skeleton = Lib_SegmentedToVirtual(&cKF_bs_r_hnw); + info->animation = Lib_SegmentedToVirtual(&cKF_ba_r_hnw_move); + this->segment = segment; + } +} -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Sample/ac_sample/func_80933F40_jp.s") +void Ac_Sample_Actor_main_wait(Sample* this, Game_Play* play) { + Ac_Sample_Animation_Base(this); + Actor_world_to_eye(&this->actor, 48.0f); + Ac_Sample_Excute_Corect(&this->actor, play); -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Sample/ac_sample/func_80933F8C_jp.s") + if (mDemo_Check(7, &this->actor) == 0) { + mDemo_Request(7, &this->actor, &Ac_Sample_Actor_wait_demo_ct); + } else { + this->mainAction = 1; + } +} -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Sample/ac_sample/Ac_Sample_Actor_dt.s") +void Ac_Sample_Actor_main_talk(Sample* this, Game_Play* play) { + s32 check; + s16 angle; + s16 temp; -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Sample/ac_sample/func_8093401C_jp.s") + Ac_Sample_Animation_Base(this); + Actor_world_to_eye(&this->actor, 48.0f); + Ac_Sample_Excute_Corect(&this->actor, play); -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Sample/ac_sample/func_80934040_jp.s") + check = mDemo_Check(7, &this->actor); + if (check != 0) { -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Sample/ac_sample/func_80934104_jp.s") + angle = add_calc_short_angle2(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0.5f, 5000, 100); + temp = angle; + this->actor.world.rot.y = this->actor.shape.rot.y; + if (mDemo_Check_ListenAble() == FALSE && mDemo_Check_DiffAngle_forTalk(temp)) { + mDemo_Set_ListenAble(); + } + } else { + this->mainAction = 0; + } +} -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Sample/ac_sample/func_80934190_jp.s") +void Ac_Sample_Actor_main(Actor* thisx, Game_Play* play) { + static SampleActionFunc proc[] = { &Ac_Sample_Actor_main_wait, &Ac_Sample_Actor_main_talk }; + Sample* this = (Sample*)thisx; + s32 action = this->mainAction; -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Sample/ac_sample/func_8093420C_jp.s") + func_80934104_jp(thisx, play); + if (action < 0 || action >= 2 || proc[action] == NULL) { + return; + } -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Sample/ac_sample/Ac_Sample_Actor_main.s") + proc[action](this, play); +} -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Sample/ac_sample/Ac_Sample_Actor_ct.s") +void Ac_Sample_Actor_ct(Actor* thisx, Game_Play* play) { + SkeletonInfoR* info; + UNUSED s32 pad[2]; + Sample* this = (Sample*)thisx; -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Sample/ac_sample/func_809343BC_jp.s") + info = &this->skeletonInfo; + cKF_SkeletonInfo_R_ct(info, &cKF_bs_r_hnw, &cKF_ba_r_hnw_move, this->jointTable, this->morphTable); + cKF_SkeletonInfo_R_init_standard_stop(info, &cKF_ba_r_hnw_move, NULL); + Ac_Sample_ct_forCorect(thisx, play); -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Sample/ac_sample/Ac_Sample_Actor_draw.s") + this->drawAction = 1; + this->segment = play->objectExchangeBank.status[thisx->unk_026].segment; +} + +#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_CUSTOM_POLY_OPA() \ + { \ + Gfx* __polyOpa = __gfxCtx->polyOpa.p; \ + int __opa_opened = 0; \ + do { \ + } while (0) + +#define CLOSE_CUSTOM_POLY_OPA() \ + __gfxCtx->polyOpa.p = __polyOpa; \ + (void)__opa_opened; \ + } \ + do { \ + } while (0) + +void Ac_Sample_Actor_draw_normal(Sample* this, Game_Play* play) { + UNUSED s32 pad; + SkeletonInfoR* info = &this->skeletonInfo; + Mtx* mtx = GRAPH_ALLOC_NO_ALIGN(play->state.gfxCtx, sizeof(Mtx) * info->skeleton->unk01); + + if (mtx != NULL) { + + _texture_z_light_fog_prim(play->state.gfxCtx); + + AC_GCN_OPEN_DISP(play->state.gfxCtx); + OPEN_CUSTOM_POLY_OPA(); + gDPLoadTextureBlockS(__polyOpa++, hnw_tmem_txt, G_IM_FMT_I, G_IM_SIZ_8b, 64, 64, 0, G_TX_MIRROR | G_TX_WRAP, + G_TX_MIRROR | G_TX_WRAP, 7, 7, G_TX_NOLOD, G_TX_NOLOD); + + gDPLoadTLUT_pal16(__polyOpa++, 15, hnw_face); + gDPSetTextureLUT(__polyOpa++, G_TT_RGBA16); + + CLOSE_CUSTOM_POLY_OPA(); + + AC_GCN_CLOSE_DISP(play->state.gfxCtx); + + cKF_Si3_draw_R_SV(play, info, mtx, NULL, NULL, NULL); + } +} + +void Ac_Sample_Actor_draw(Actor* thisx, Game_Play* play) { + static SampleActionFunc proc[] = { (SampleActionFunc)none_proc2, Ac_Sample_Actor_draw_normal }; + Sample* this = (Sample*)thisx; + + s32 action = this->drawAction; + + func_80934104_jp(&this->actor, play); + if (action < 0 || action >= 2 || proc[action] == NULL) { + return; + } + + proc[action](this, play); +} + +ActorProfile Sample_Profile = { + /* */ ACTOR_SAMPLE, + /* */ ACTOR_PART_4, + /* */ 0, + /* */ 0x9000, + /* */ OBJECT_12, + /* */ sizeof(Sample), + /* */ Ac_Sample_Actor_ct, + /* */ Ac_Sample_Actor_dt, + /* */ Ac_Sample_Actor_main, + /* */ Ac_Sample_Actor_draw, + /* */ NULL, +}; diff --git a/src/overlays/actors/ovl_Sample/ac_sample.h b/src/overlays/actors/ovl_Sample/ac_sample.h index 972ac88..69f0770 100644 --- a/src/overlays/actors/ovl_Sample/ac_sample.h +++ b/src/overlays/actors/ovl_Sample/ac_sample.h @@ -5,6 +5,7 @@ #include "m_actor.h" #include "m_collision_obj.h" #include "unk.h" +#include "c_keyframe.h" struct Game_Play; struct Sample; @@ -13,9 +14,13 @@ typedef void (*SampleActionFunc)(struct Sample*, struct Game_Play*); typedef struct Sample { /* 0x000 */ Actor actor; - /* 0x174 */ UNK_TYPE1 unk_174[0xD0]; - /* 0x244 */ ClObjPipe collider; - /* 0x260 */ UNK_TYPE1 unk_260[0xC]; + /* 0x174 */ SkeletonInfoR skeletonInfo; + /* 0x1E4 */ s_xyz jointTable[8]; + /* 0x214 */ s_xyz morphTable[8]; + /* 0x244 */ ClObjPipe stand; + /* 0x260 */ s32 mainAction; + /* 0x264 */ s32 drawAction; + /* 0x268 */ void* segment; } Sample; // size = 0x26C #endif diff --git a/yamls/jp/overlays.yaml b/yamls/jp/overlays.yaml index 900a575..c4bb6bb 100644 --- a/yamls/jp/overlays.yaml +++ b/yamls/jp/overlays.yaml @@ -1205,8 +1205,8 @@ bss_size: 0x40 subsegments: - [0x82B3C0, c, overlays/actors/ovl_Sample/ac_sample] - - [0x82BA80, data, overlays/actors/ovl_Sample/ac_sample] - - { start: 0x82BAE0, type: bss, vram: 0x80934660, name: overlays/actors/ovl_Sample/ac_sample } + - [0x82BA80, .data, overlays/actors/ovl_Sample/ac_sample] + - { start: 0x82BAE0, type: .bss, vram: 0x80934660, name: overlays/actors/ovl_Sample/ac_sample } - name: ovl_Sample_reloc type: code start: 0x82BAE0 |
