diff options
| author | emilybrooks <emilybrooksemilybrooks@gmail.com> | 2024-02-29 15:39:35 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-29 15:39:35 -0700 |
| commit | 26183fe65445602a9fbf5dbe7338be08a6bb8ec9 (patch) | |
| tree | 1f17d5fb4f4cc07cb46e5e32be69124ed19eb874 | |
| parent | 8ac6fcf5db5addcefb4219dc1e918498ee8262c3 (diff) | |
match ac_toudai draw functions (#151)
* matched aTOU_actor_draw_after
* some work on aTOU_actor_draw
* aTOU_actor_draw matching
* moved data to in function static
* missed some things
* space
* removed some unneeded stuff
| -rw-r--r-- | linker_scripts/jp/symbol_addrs_overlays.txt | 18 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_Toudai/ac_toudai.c | 219 |
2 files changed, 131 insertions, 106 deletions
diff --git a/linker_scripts/jp/symbol_addrs_overlays.txt b/linker_scripts/jp/symbol_addrs_overlays.txt index 184edbf..912bad7 100644 --- a/linker_scripts/jp/symbol_addrs_overlays.txt +++ b/linker_scripts/jp/symbol_addrs_overlays.txt @@ -21496,15 +21496,15 @@ aTOU_actor_draw = 0x80AABEB0; // type:func Toudai_Profile = 0x80AAC060; // aTOU_shadow_vtx_fix_flg_table = 0x80AAC084; // aTOU_shadow_data = 0x80AAC098; // -skl_324 = 0x80AAC0AC; // -height_table_ct_360 = 0x80AAC0B4; // -height_table_361 = 0x80AAC0D0; // -addX_362 = 0x80AAC0D8; // type:f32 -addZ_363 = 0x80AAC0E0; // type:f32 -ani_484 = 0x80AAC0E8; // -process_485 = 0x80AAC0F0; // -mdl_519 = 0x80AAC100; // -prmcol_520 = 0x80AAC108; // +skl = 0x80AAC0AC; // allow_duplicated:true +height_table_ct = 0x80AAC0B4; // allow_duplicated:true +height_table = 0x80AAC0D0; // allow_duplicated:true +addX = 0x80AAC0D8; // type:f32 allow_duplicated:true +addZ = 0x80AAC0E0; // type:f32 allow_duplicated:true +ani = 0x80AAC0E8; // allow_duplicated:true +process = 0x80AAC0F0; // allow_duplicated:true +mdl = 0x80AAC100; // allow_duplicated:true +prmcol = 0x80AAC108; // allow_duplicated:true // .rodata diff --git a/src/overlays/actors/ovl_Toudai/ac_toudai.c b/src/overlays/actors/ovl_Toudai/ac_toudai.c index 694e058..25821f9 100644 --- a/src/overlays/actors/ovl_Toudai/ac_toudai.c +++ b/src/overlays/actors/ovl_Toudai/ac_toudai.c @@ -39,22 +39,20 @@ ActorProfile Toudai_Profile = { u8 aTOU_shadow_vtx_fix_flg_table[] = { 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x00 }; - extern Vtx obj_s_toudai_shadow_v[]; extern Gfx obj_s_toudai_shadow_1_model[]; ShadowData aTOU_shadow_data = { 20, aTOU_shadow_vtx_fix_flg_table, 60.0f, obj_s_toudai_shadow_v, obj_s_toudai_shadow_1_model }; - extern BaseSkeletonR cKF_bs_r_obj_s_toudai; extern BaseSkeletonR cKF_bs_r_obj_w_toudai; -BaseSkeletonR* skl_324[] = { &cKF_bs_r_obj_s_toudai, &cKF_bs_r_obj_w_toudai }; void aTOU_actor_ct(Actor* thisx, Game_Play* game_play UNUSED) { Toudai* this = THIS; + static BaseSkeletonR* skl[] = { &cKF_bs_r_obj_s_toudai, &cKF_bs_r_obj_w_toudai }; s32 type = (common_data.time.season == WINTER); gSegments[6] = OS_K0_TO_PHYSICAL(common_data.unk_10098->unk_AC(45)); - cKF_SkeletonInfo_R_ct(&this->skeletonInfo, skl_324[type], NULL, this->jointTable, this->morphTable); + cKF_SkeletonInfo_R_ct(&this->skeletonInfo, skl[type], NULL, this->jointTable, this->morphTable); aTOU_set_bgOffset(this, 1); aTOU_setup_action(this, 0); cKF_SkeletonInfo_R_play(&this->skeletonInfo); @@ -73,25 +71,24 @@ void aTOU_actor_dt(Actor* thisx, Game_Play* game_play UNUSED) { thisx->world.pos.z += 20.0f; } -mCoBG_unkStruct2 height_table_ct_360[] = { { 0x64, 16, 16, 16, 16, 16, 0 }, - { 0x64, 16, 16, 16, 16, 16, 0 }, - { 0x64, 16, 16, 16, 16, 16, 0 }, - { 0x64, 16, 16, 16, 16, 16, 0 } }; -mCoBG_unkStruct2* height_table_361[] = { height_table_ct_360, height_table_ct_360 }; -f32 addX_362[] = { -40.0f, 0.0f }; -f32 addZ_363[] = { -40.0f, 0.0f }; - void aTOU_set_bgOffset(Toudai* this, s32 heightTableIndex) { + static mCoBG_unkStruct2 height_table_ct[] = { { 0x64, 16, 16, 16, 16, 16, 0 }, + { 0x64, 16, 16, 16, 16, 16, 0 }, + { 0x64, 16, 16, 16, 16, 16, 0 }, + { 0x64, 16, 16, 16, 16, 16, 0 } }; + static mCoBG_unkStruct2* height_table[] = { height_table_ct, height_table_ct }; + static f32 addX[] = { -40.0f, 0.0f }; + static f32 addZ[] = { -40.0f, 0.0f }; s32 i; xyz_t pos; - mCoBG_unkStruct2* offsetTable = height_table_361[heightTableIndex]; + mCoBG_unkStruct2* offsetTable = height_table[heightTableIndex]; for (i = 0; i < 2; i++) { - pos.z = addZ_363[i] + this->actor.home.pos.z; - pos.x = addX_362[0] + this->actor.home.pos.x; + pos.z = addZ[i] + this->actor.home.pos.z; + pos.x = addX[0] + this->actor.home.pos.x; mCoBG_SetPluss5PointOffset_file(pos, *offsetTable, "../ac_toudai_move.c_inc", 76); offsetTable++; - pos.x = addX_362[1] + this->actor.home.pos.x; + pos.x = addX[1] + this->actor.home.pos.x; mCoBG_SetPluss5PointOffset_file(pos, *offsetTable, "../ac_toudai_move.c_inc", 80); offsetTable++; } @@ -164,19 +161,19 @@ void aTOU_lightout(Toudai* this, Game_Play* game_play UNUSED) { extern BaseAnimationR cKF_ba_r_obj_s_toudai; extern BaseAnimationR cKF_ba_r_obj_w_toudai; -BaseAnimationR* ani_484[] = { &cKF_ba_r_obj_s_toudai, &cKF_ba_r_obj_w_toudai }; -ToudaiActionFunc process_485[] = { aTOU_init, aTOU_wait, aTOU_lighting, aTOU_lightout }; void aTOU_setup_action(Toudai* this, s32 processIndex) { + static BaseAnimationR* ani[] = { &cKF_ba_r_obj_s_toudai, &cKF_ba_r_obj_w_toudai }; + static ToudaiActionFunc process[] = { aTOU_init, aTOU_wait, aTOU_lighting, aTOU_lightout }; s32 type; if (processIndex == 0) { type = (common_data.time.season == WINTER); - cKF_SkeletonInfo_R_init(&this->skeletonInfo, this->skeletonInfo.skeleton, ani_484[type], 1.0f, 100.0f, 51.0f, - 0.0f, 0.0f, ANIMATION_REPEAT, NULL); + cKF_SkeletonInfo_R_init(&this->skeletonInfo, this->skeletonInfo.skeleton, ani[type], 1.0f, 100.0f, 51.0f, 0.0f, + 0.0f, ANIMATION_REPEAT, NULL); } - this->unk2A0 = process_485[processIndex]; + this->unk2A0 = process[processIndex]; this->unk2B4 = processIndex; } @@ -198,8 +195,9 @@ void aTOU_actor_init(Actor* thisx, Game_Play* game_play) { this->actor.update = aTOU_actor_move; } -s32 aTOU_actor_draw_before(Game_Play* game_play UNUSED, SkeletonInfoR* skeletonInfo UNUSED, s32 jointIndex, - Gfx** dlist) { +s32 aTOU_actor_draw_before(Game_Play* game_play UNUSED, SkeletonInfoR* skeletonInfo UNUSED, s32 jointIndex, Gfx** dlist, + u8* displayBufferFlag UNUSED, void* thisx UNUSED, s_xyz* rotation UNUSED, + xyz_t* translation UNUSED) { // LIGHTHOUSE_JOINT_LIGHT if (jointIndex == 4) { *dlist = NULL; @@ -207,94 +205,121 @@ s32 aTOU_actor_draw_before(Game_Play* game_play UNUSED, SkeletonInfoR* skeletonI return 1; } +#define OPEN_POLY_OPA_DISPS() \ + { \ + Gfx* __polyOpa = __gfxCtx->polyOpa.p; \ + int __opa_opened = 0; \ + while (0) + +#define CLOSE_POLY_OPA_DISPS() \ + __gfxCtx->polyOpa.p = __polyOpa; \ + (void)__opa_opened; \ + } \ + while (0) + +#define OPEN_POLY_XLU_DISPS() \ + { \ + Gfx* __polyXlu = __gfxCtx->polyXlu.p; \ + int __xlu_opened = 0; \ + while (0) + +#define CLOSE_POLY_XLU_DISPS() \ + __gfxCtx->polyXlu.p = __polyXlu; \ + (void)__xlu_opened; \ + } \ + while (0) + +#define OPEN_LIGHT_DISPS() \ + { \ + Gfx* __light = __gfxCtx->light.p; \ + int __light_opened = 0; \ + while (0) + +#define CLOSE_LIGHT_DISPS() \ + __gfxCtx->light.p = __light; \ + (void)__light_opened; \ + } \ + while (0) + extern Gfx obj_s_toudai_light_model[]; extern Gfx obj_w_toudai_light_model[]; -Gfx* mdl_519[] = { obj_s_toudai_light_model, obj_w_toudai_light_model }; -Color_RGBA8 prmcol_520 = { 255, 255, 150, 120 }; - -#ifdef NON_EQUIVALENT -s32 aTOU_actor_draw_after(Game_Play* game_play, SkeletonInfoR* skeletonInfo, s32 jointIndex, Gfx** dlist, - u8* displayBufferFlag, Toudai* arg5, s_xyz* rotation, xyz_t* translation) { - s32 type; // sp24 - s32 object; // sp20 - s32 palette; // sp1C - GraphicsContext* temp_a3; - u8 var_a0; - Mtx* mtx; // sp18 - u32 temp_v1; - u32 temp; - Gfx* gfx; + +s32 aTOU_actor_draw_after(Game_Play* game_play, SkeletonInfoR* skeletonInfo UNUSED, s32 jointIndex, Gfx** dlist UNUSED, + u8* displayBufferFlag UNUSED, void* thisx, s_xyz* rotation UNUSED, + xyz_t* translation UNUSED) { + static Gfx* mdl[] = { obj_s_toudai_light_model, obj_w_toudai_light_model }; + static Color_RGBA8 prmcol = { 255, 255, 150, 120 }; + GraphicsContext* gfxCtx = game_play->state.gfxCtx; + Toudai* this = (Toudai*)thisx; + s32 type; + s32 object; + s32 palette; + Mtx* mtx; // LIGHTHOUSE_JOINT_LIGHT - if ((jointIndex == 4) && (arg5->unk2CC)) { - OPEN_DISPS(temp_a3); - mtx = _Matrix_to_Mtx_new(temp_a3); + if ((jointIndex == 4) && ((s32)this->unk2CC)) { + mtx = _Matrix_to_Mtx_new(gfxCtx); if (mtx != NULL) { - type = (common_data.time.season == 3); - object = common_data.unk_10098->unk_AC(45); - palette = common_data.unk_10098->unk_450(90); - _texture_z_light_fog_prim_light(game_play->state.gfxCtx); - gfx = LIGHT_DISP; - gSPSegment(gfx++, 0x08, palette); - gSPSegment(gfx++, 0x06, object); - - temp = arg5->unk2C8; - var_a0 = arg5->unk2CC; - temp_v1 = arg5->unk2D0; - if (arg5->unk2D0 < arg5->unk2CC) { - arg5->unk2CC = temp_v1; + type = common_data.time.season == 3; + object = common_data.unk_10098->unk_AC(0x2D); + palette = common_data.unk_10098->unk_450(0x5A); + _texture_z_light_fog_prim_light(gfxCtx); + OPEN_DISPS(gfxCtx); + OPEN_LIGHT_DISPS(); + gSPSegment(__light++, 8, palette); + gSPSegment(__light++, 6, object); + prmcol.b = this->unk2C8; + prmcol.a = this->unk2CC; + if ((u8)this->unk2D0 < prmcol.a) { + prmcol.a = this->unk2D0; } - gDPPipeSync(gfx++); - gDPSetPrimColor(gfx++, 0, arg5->unk2D0, prmcol_520.r, prmcol_520.g, temp, var_a0); - gSPMatrix(gfx++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfx++, mdl_519[type]); - if (!temp_a3) {} + gDPPipeSync(__light++); + gDPSetPrimColor(__light++, 0, (u8)this->unk2D0, prmcol.r, prmcol.g, prmcol.b, prmcol.a); + gSPMatrix(__light++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(__light++, mdl[type]); + CLOSE_LIGHT_DISPS(); + CLOSE_DISPS(gfxCtx); } - CLOSE_DISPS(temp_a3); } return 1; } -#else -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Toudai/ac_toudai/aTOU_actor_draw_after.s") -#endif -#ifdef NON_EQUIVALENT void aTOU_actor_draw(Actor* thisx, Game_Play* game_play) { - Toudai* this = THIS; + UNUSED s32 pad; GraphicsContext* gfxCtx = game_play->state.gfxCtx; - UNK_PTR sp68; // object - u16* sp64; // palette - GraphicsContext* temp_a2; - Mtx* mtx; // temp_v1 - Gfx* gfx; - CommonData_unk_10098* ptr; - u8 t = this->skeletonInfo.skeleton->unk01; - OPEN_DISPS(gfxCtx); - ptr = common_data.unk_10098; - mtx = GRAPH_ALLOC(gfxCtx, t * sizeof(Mtx)); + UNUSED s32 pad2[2]; + Toudai* this = THIS; + s32 object; + s32 palette; + UNUSED s32 pad3; + Mtx* mtx; + xyz_t* worldPosition = &this->actor.world.pos; + u8 numberOfDisplayLists = this->skeletonInfo.skeleton->unk01; + + mtx = GRAPH_ALLOC_NO_ALIGN(gfxCtx, numberOfDisplayLists * sizeof(Mtx)); + if (mtx != NULL) { - sp68 = ptr->unk_AC(45); - sp64 = ptr->unk_450(90); - func_800BD5E8_jp(gfx); - gfx = POLY_OPA_DISP; - gSPSegment(gfx++, 0x08, sp64); - gSegments[6] = OS_K0_TO_PHYSICAL(sp68); - gSPSegment(gfx++, 0x06, sp68); - POLY_OPA_DISP = gfx; - _texture_z_light_fog_prim_xlu(gfx); - - gfx = POLY_XLU_DISP; - gSPSegment(gfx++, 0x08, sp64); - gSPSegment(gfx++, 0x06, sp68); - POLY_XLU_DISP = gfx; - Setpos_HiliteReflect_init(&this->actor.world.pos, game_play); - Setpos_HiliteReflect_xlu_init(&this->actor.world.pos, game_play); + object = common_data.unk_10098->unk_AC(0x2D); + palette = common_data.unk_10098->unk_450(0x5A); + + _texture_z_light_fog_prim_npc(gfxCtx); + OPEN_DISPS(gfxCtx); + OPEN_POLY_OPA_DISPS(); + gSPSegment(__polyOpa++, 0x8, palette); + gSegments[6] = OS_K0_TO_PHYSICAL(object); + gSPSegment(__polyOpa++, 0x6, object); + CLOSE_POLY_OPA_DISPS(); + + _texture_z_light_fog_prim_xlu(gfxCtx); + OPEN_POLY_XLU_DISPS(); + gSPSegment(__polyXlu++, 0x8, palette); + gSPSegment(__polyXlu++, 0x6, object); + CLOSE_POLY_XLU_DISPS(); + CLOSE_DISPS(gfxCtx); + + Setpos_HiliteReflect_init(worldPosition, game_play); + Setpos_HiliteReflect_xlu_init(worldPosition, game_play); cKF_Si3_draw_R_SV(game_play, &this->skeletonInfo, mtx, aTOU_actor_draw_before, aTOU_actor_draw_after, this); - common_data.unk_10080->unk_4(game_play, &aTOU_shadow_data, 45); + common_data.unk_10080->unk_04(game_play, &aTOU_shadow_data, 0x2D); } - CLOSE_DISPS(gfxCtx); - if (gfxCtx) {} } -#else -#pragma GLOBAL_ASM("asm/jp/nonmatchings/overlays/actors/ovl_Toudai/ac_toudai/aTOU_actor_draw.s") -#endif |
