diff --git a/config/GALE01/symbols.txt b/config/GALE01/symbols.txt index b21c661e47..c324f3ee25 100644 --- a/config/GALE01/symbols.txt +++ b/config/GALE01/symbols.txt @@ -21054,11 +21054,13 @@ ints$268 = .data:0x803C6948; // type:object size:0x14 scope:local @281 = .data:0x803C695C; // type:object size:0x15 scope:local data:string @282 = .data:0x803C6974; // type:object size:0x9 scope:local data:string ftMObj = .data:0x803C6980; // type:object size:0x50 scope:global -lbl_803C69D0 = .data:0x803C69D0; // type:object size:0x8C -lbl_803C6A5C = .data:0x803C6A5C; // type:object size:0x18 scope:local data:string -lbl_803C6A74 = .data:0x803C6A74; // type:object size:0x21 scope:local data:string -lbl_803C6A98 = .data:0x803C6A98; // type:object size:0xD scope:local data:string -lbl_803C6AA8 = .data:0x803C6AA8; // type:object size:0x27 data:string +...data.0 = .data:0x803C6980; // type:label scope:local +ftMaterial_803C69D0 = .data:0x803C69D0; // type:object size:0x74 +ftMaterial_803C6A44 = .data:0x803C6A44; // type:object size:0x18 scope:local +@222 = .data:0x803C6A5C; // type:object size:0x18 scope:local data:string +@291 = .data:0x803C6A74; // type:object size:0x21 scope:local data:string +@292 = .data:0x803C6A98; // type:object size:0xD scope:local data:string +@367 = .data:0x803C6AA8; // type:object size:0x27 scope:local data:string ftCo_803C6AD0 = .data:0x803C6AD0; // type:object size:0xC scope:global ftCo_803C6ADC = .data:0x803C6ADC; // type:object size:0xC scope:global @248 = .data:0x803C6AE8; // type:object size:0x1F scope:local data:string @@ -26354,8 +26356,8 @@ ftCo_804D3B7C = .sdata:0x804D3B7C; // type:object size:0x5 scope:global data:str @254 = .sdata:0x804D3BE8; // type:object size:0x5 scope:local data:string @255 = .sdata:0x804D3BF0; // type:object size:0x6 scope:local data:string @283 = .sdata:0x804D3BF8; // type:object size:0x2 scope:local data:string -ftCo_804D3C00 = .sdata:0x804D3C00; // type:object size:0x8 scope:global data:string -ftCo_804D3C08 = .sdata:0x804D3C08; // type:object size:0x2 scope:global data:string +@223 = .sdata:0x804D3C00; // type:object size:0x8 scope:local data:string +@293 = .sdata:0x804D3C08; // type:object size:0x2 scope:local data:string @250 = .sdata:0x804D3C10; // type:object size:0x2 scope:local data:string @251 = .sdata:0x804D3C18; // type:object size:0x2 scope:local data:string ftCo_804D3C20 = .sdata:0x804D3C20; // type:object size:0x7 scope:global data:string diff --git a/configure.py b/configure.py index 70bdc4df60..f86f1a9012 100755 --- a/configure.py +++ b/configure.py @@ -610,7 +610,7 @@ def MatchingFor(*versions): Object(Matching, "melee/ft/ft_0BEC.c"), Object(Matching, "melee/ft/ft_0BEF.c"), Object(Matching, "melee/ft/ft_0BF0.c"), - Object(NonMatching, "melee/ft/ftmaterial.c"), + Object(Matching, "melee/ft/ftmaterial.c"), Object(Matching, "melee/ft/ftcolanim.c"), Object(Matching, "melee/ft/ftdevice.c"), Object(NonMatching, "melee/ft/chara/ftCommon/ftCo_Bury.c"), diff --git a/src/melee/ft/ftmaterial.c b/src/melee/ft/ftmaterial.c index ec49d53385..c5f305b844 100644 --- a/src/melee/ft/ftmaterial.c +++ b/src/melee/ft/ftmaterial.c @@ -25,6 +25,12 @@ HSD_MObjInfo ftMObj = { ftMaterial_800BF260 }; +struct ft_MObjInfo { + HSD_MObjInfo parent; + HSD_TevDesc tevdesc_tmpl; + HSD_TECnst texp_tmpl; +}; + static HSD_TevDesc ftMaterial_803C69D0 = { NULL, TEVCONF_MODE, @@ -48,10 +54,10 @@ void ftMaterial_800BF260(void) { hsdInitClassInfo(&ftMObj.parent, &hsdMObj.parent, "sysdolphin_base_library", "ft_mobj", sizeof(HSD_MObjInfo), sizeof(HSD_MObj)); - ftMObj.setup = ftMaterial_800BF2B8; + ftMObj.setup = (HSD_MObjSetupFunc) (Event) ftMaterial_800BF2B8; } -void ftMaterial_800BF2B8(HSD_MObj* mobj, u32 rendermode) +void ftMaterial_800BF2B8(HSD_MObj* mobj, u32 rendermode, u32 unused) { Fighter* fp; HSD_TObj* tobj; @@ -59,9 +65,7 @@ void ftMaterial_800BF2B8(HSD_MObj* mobj, u32 rendermode) HSD_PEDesc pe; HSD_TObj** cur_tobj; HSD_TExp* texp1; - u32 mobj_rendermode; HSD_PEDesc* pe_p; - u32 unused; fp = GET_FIGHTER(HSD_GObj_804D7814); @@ -82,24 +86,24 @@ void ftMaterial_800BF2B8(HSD_MObj* mobj, u32 rendermode) HSD_StateInitTev(); { - mobj_rendermode = mobj->rendermode; + rendermode = mobj->rendermode; HSD_SetMaterialColor(mobj->mat->ambient, mobj->mat->diffuse, mobj->mat->specular, mobj->mat->alpha); - if (mobj_rendermode & RENDER_SPECULAR) { + if (rendermode & RENDER_SPECULAR) { HSD_SetMaterialShininess(mobj->mat->shininess); } { cur_tobj = NULL; { tobj = mobj->tobj; - if (mobj_rendermode & RENDER_SHADOW && tobj_shadows != NULL) { + if (rendermode & RENDER_SHADOW && tobj_shadows != NULL) { cur_tobj = &tobj; while (*cur_tobj != NULL) { cur_tobj = &(*cur_tobj)->next; } *cur_tobj = tobj_shadows; } - if ((mobj_rendermode & RENDER_TOON) && tobj_toon != NULL && + if ((rendermode & RENDER_TOON) && tobj_toon != NULL && tobj_toon->imagedesc != NULL) { tobj_toon->next = tobj; @@ -107,16 +111,18 @@ void ftMaterial_800BF2B8(HSD_MObj* mobj, u32 rendermode) } HSD_TObjSetup(tobj); HSD_TObjSetupTextureCoordGen(tobj); - HSD_MOBJ_METHOD(mobj)->setup_tev(mobj, tobj, mobj_rendermode); + HSD_MOBJ_METHOD(mobj)->setup_tev(mobj, tobj, rendermode); } if (fp->x61D != 0xFF) { - mobj_rendermode |= RENDER_NO_ZUPDATE | RENDER_XLU; + rendermode |= RENDER_NO_ZUPDATE | RENDER_XLU; } { - texp1 = ftMaterial_800BF534(fp, mobj, &texp, rendermode); + HSD_TExp* new_texp = + ftMaterial_800BF534(fp, mobj, &texp, rendermode); + texp1 = new_texp; ftMaterial_800BF6BC(fp, mobj, texp1); if (fp->x2223_b2 && !fp->x2223_b3) { - mobj_rendermode |= RENDER_NO_ZUPDATE; + rendermode |= RENDER_NO_ZUPDATE; } { if (fp->x2223_b3 && fp->x61D == 0xFF) { @@ -136,7 +142,7 @@ void ftMaterial_800BF2B8(HSD_MObj* mobj, u32 rendermode) } else { pe_p = mobj->pe; } - HSD_SetupRenderModeWithCustomPE(mobj_rendermode, pe_p); + HSD_SetupRenderModeWithCustomPE(rendermode, pe_p); } if (texp1 == NULL) { ftCo_8009F75C(fp, true); @@ -155,12 +161,12 @@ HSD_TExp* ftMaterial_800BF534(Fighter* fp, HSD_MObj* mobj, HSD_TExp* texp, HSD_TevDesc sp_tevdesc; s32 reg; bool chk; - char* base = (char*) &ftMObj; + struct ft_MObjInfo* info = (struct ft_MObjInfo*) &ftMObj; ColorOverlay* overlay = ftCo_800C0658(fp); if (overlay->x7C_flag2 && overlay->x7C_light_enable) { if (!(rendermode & RENDER_XLU) && !fp->x2223_b2) { - texp->cnst = *(HSD_TECnst*) (base + 0xC4); + texp->cnst = info->texp_tmpl; chk = lbGetFreeColorRegister(0, mobj, NULL); reg = chk; if (reg == -1) { @@ -170,7 +176,7 @@ HSD_TExp* ftMaterial_800BF534(Fighter* fp, HSD_MObj* mobj, HSD_TExp* texp, texp->cnst.val = &overlay->x50_light_color; HSD_TExpSetReg(texp); - sp_tevdesc = *(HSD_TevDesc*) (base + 0x50); + sp_tevdesc = info->tevdesc_tmpl; sp_tevdesc.stage = HSD_StateAssignTev(); sp_tevdesc.color = 2; sp_tevdesc.u.tevconf.clr_a = GX_CC_ZERO; @@ -195,11 +201,12 @@ HSD_TExp* ftMaterial_800BF534(Fighter* fp, HSD_MObj* mobj, HSD_TExp* texp, void ftMaterial_800BF6BC(Fighter* fp, HSD_MObj* mobj, HSD_TExp* texp) { GXColor sp168; + u8 _padA[84]; HSD_TECnst sp_cnst1; - HSD_TExp* sp100; + u8 _padB[80]; + GXColor unused; HSD_TECnst sp_cnst2; HSD_TevDesc sp_tevdesc; - GXColor sp18; s32 chk1; s32 var_r0; @@ -208,8 +215,7 @@ void ftMaterial_800BF6BC(Fighter* fp, HSD_MObj* mobj, HSD_TExp* texp) s32 var_r3; ColorOverlay* overlay; s32 var_r5; - char* base = (char*) &ftMObj; - PAD_STACK(160); + struct ft_MObjInfo* info = (struct ft_MObjInfo*) &ftMObj; if (!fp->x2223_b3) { overlay = ftCo_800C0658(fp); @@ -280,7 +286,7 @@ void ftMaterial_800BF6BC(Fighter* fp, HSD_MObj* mobj, HSD_TExp* texp) sp168 = overlay->x2C_hex; } if (chk1 != 0) { - sp_cnst1 = *(HSD_TECnst*) (base + 0xC4); + sp_cnst1 = info->texp_tmpl; reg1 = lbGetFreeColorRegister(0, mobj, texp); if (reg1 == -1) { HSD_ASSERTREPORT(352, 0, "can't find free color register!\n"); @@ -305,7 +311,7 @@ void ftMaterial_800BF6BC(Fighter* fp, HSD_MObj* mobj, HSD_TExp* texp) "can't find free color ratio register!\n"); } if ((u8) fp->x61D != 0xFF) { - sp_cnst2 = *(HSD_TECnst*) (base + 0xC4); + sp_cnst2 = info->texp_tmpl; sp_cnst2.reg = (u8) reg2; sp_cnst2.comp = 5; sp_cnst2.idx = 3; @@ -315,12 +321,18 @@ void ftMaterial_800BF6BC(Fighter* fp, HSD_MObj* mobj, HSD_TExp* texp) sp_cnst1.next = NULL; } sp_cnst1.reg = (u8) reg2; - sp18.r = sp168.a; - sp18.g = sp168.a; - sp18.b = sp168.a; - sp_cnst1.val = &sp18; + { + // @todo Fix this stack pointer arithmetic + GXColor* color = (GXColor*) ((u8*) &sp_tevdesc - 4); + u8 alpha = sp168.a; + + color->r = alpha; + color->g = alpha; + color->b = alpha; + sp_cnst1.val = color; + } HSD_TExpSetReg((HSD_TExp*) &sp_cnst1); - sp_tevdesc = *(HSD_TevDesc*) (base + 0x50); + sp_tevdesc = info->tevdesc_tmpl; sp_tevdesc.stage = HSD_StateAssignTev(); sp_tevdesc.u.tevconf.clr_b = lb_8000CC8C(reg1); sp_tevdesc.u.tevconf.clr_c = lb_8000CC8C(reg2); diff --git a/src/melee/ft/ftmaterial.h b/src/melee/ft/ftmaterial.h index 091dcbe436..fa5700e5f1 100644 --- a/src/melee/ft/ftmaterial.h +++ b/src/melee/ft/ftmaterial.h @@ -10,7 +10,8 @@ #include /* 0BF260 */ void ftMaterial_800BF260(void); -/* 0BF2B8 */ void ftMaterial_800BF2B8(HSD_MObj* mobj, u32 rendermode); +/* 0BF2B8 */ void ftMaterial_800BF2B8(HSD_MObj* mobj, u32 rendermode, + u32 unused); /* 0BF534 */ HSD_TExp* ftMaterial_800BF534(Fighter* fp, HSD_MObj* mobj, HSD_TExp* texp, u32 rendermode); /* 0BF6BC */ void ftMaterial_800BF6BC(Fighter* fp, HSD_MObj* mobj,