Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions config/GALE01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
66 changes: 39 additions & 27 deletions src/melee/ft/ftmaterial.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -48,20 +54,18 @@ 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;
HSD_TExp texp;
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);

Expand All @@ -82,41 +86,43 @@ 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;
tobj = tobj_toon;
}
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) {
Expand All @@ -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);
Expand All @@ -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) {
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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");
Expand All @@ -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;
Expand All @@ -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);
Comment thread
jellejurre marked this conversation as resolved.
Comment thread
jellejurre marked this conversation as resolved.
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);
Expand Down
3 changes: 2 additions & 1 deletion src/melee/ft/ftmaterial.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#include <dolphin/gx.h>

/* 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,
Expand Down
Loading