Skip to content

Commit 8c9eea9

Browse files
zaloclaude
andcommitted
AI-assisted decompilation: 6 new 100% matches
100% byte-perfect matches: - ftCh_Damage2_Anim (ftCh_Init.c, 208b) — Crazy Hand motion state enum fix - grIceMt_801F7F1C (gricemt.c, 84b) — ground material loop - grIceMt_801F81B4 (gricemt.c, 84b) — ground material loop variant - grIceMt_801F929C (gricemt.c, 156b) — stage animation - it_802D747C (itoldkuri.c, 84b) — item state change sequence - grPura_80212290 (grpura.c, 132b) — stage function Tool: https://github.com/sh1ftmaker/decomp-research-ai Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 65ebb34 commit 8c9eea9

File tree

4 files changed

+285
-63
lines changed

4 files changed

+285
-63
lines changed

src/melee/ft/chara/ftCrazyHand/ftCh_Init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,7 @@ void ftCh_Damage2_Anim(HSD_GObj* gobj)
12701270
attrs = fp->ft_data->ext_attr;
12711271
fp->mv.ch.unk0.xC.x = fp->cur_pos.x - attrs->x28;
12721272
fp->mv.ch.unk0.xC.y = attrs->x24;
1273-
Fighter_ChangeMotionState(gobj, ftMh_MS_Damage, 0,
1273+
Fighter_ChangeMotionState(gobj, ftMh_MS_Damage2, 0,
12741274
fp->mv.ch.unk0.xC.z = ftCh_Init_804DA070,
12751275
ftCh_Init_804DA074, ftCh_Init_804DA070,
12761276
NULL);

src/melee/gr/gricemt.c

Lines changed: 237 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -475,10 +475,29 @@ void grIceMt_801F77AC(Ground_GObj* arg0) {}
475475
/// #fn_801F77B0
476476
void fn_801F77B0(HSD_GObj* arg0)
477477
{
478-
Ground* gp = GET_GROUND(arg0);
479-
// 803E4544
480-
// mpJointGetCb1();
481-
mpJointSetCb1(4, gp, grIceMt_801FA7F0);
478+
extern s16 grIm_803E4544[];
479+
void (*sp14)(Ground*, s32, CollData*, s32, enum mpLib_GroundEnum, f32);
480+
Ground* sp10;
481+
Ground* temp_r6;
482+
s16* var_r30;
483+
u32 var_r28;
484+
u32 temp_r5;
485+
486+
var_r28 = 0U;
487+
temp_r5 = var_r28 << 1;
488+
temp_r6 = arg0->user_data;
489+
temp_r5 = 0;
490+
*(u8*)((u8*)temp_r6 + 0xD8) = (*(u8*)((u8*)temp_r6 + 0xD8) & 0x7F) | ((temp_r5 << 7) & 0x80);
491+
var_r30 = (s16*)((u8*)grIm_803E4544 + temp_r5);
492+
temp_r6 = temp_r6;
493+
do {
494+
mpJointGetCb1((s32) *var_r30, &sp14, &sp10);
495+
if (sp14 == NULL) {
496+
mpJointSetCb1((s32) *var_r30, temp_r6, (void (*)(Ground*, s32, CollData*, s32, enum mpLib_GroundEnum, f32))grIceMt_801FA7F0);
497+
}
498+
var_r28 += 1;
499+
var_r30 = (s16*)((u8*)var_r30 + 2);
500+
} while (var_r28 < 0xD9U);
482501
}
483502

484503
/// #grIceMt_801F785C
@@ -518,22 +537,32 @@ void grIceMt_801F785C(Ground_GObj* gobj)
518537
/// #grIceMt_801F796C gricemt.c
519538
bool grIceMt_801F796C(Ground_GObj* arg0)
520539
{
521-
Ground* gp = GET_GROUND(arg0);
522-
HSD_GObj* gobj;
523-
if (gp->gv.icemt2.xC4 != NULL) {
524-
gobj = Ground_801C2BA4(gp->gv.icemt2.xC4);
525-
if (gobj == NULL) {
540+
Ground* gp;
541+
s16 temp_r3;
542+
HSD_GObj* temp_r3_2;
543+
s16 temp_r3_3;
544+
HSD_GObj* temp_r3_4;
545+
PAD_STACK(8);
546+
547+
gp = arg0->user_data;
548+
temp_r3 = *(s16*)((u8*)gp + 0xC4);
549+
if (temp_r3 != -1) {
550+
temp_r3_2 = Ground_801C2BA4(temp_r3);
551+
if (temp_r3_2 == NULL) {
526552
__assert("gricemt.c", 0x475, "mgobj");
527553
}
554+
Ground_801C4A08(temp_r3_2);
528555
}
529-
if (gp->gv.icemt.xCC != NULL) {
530-
gobj = Ground_801C2BA4(gp->gv.icemt2.xC4);
531-
if (gobj == NULL) {
532-
__assert("gricemt.c", 0x4A7, "mgobj");
556+
temp_r3_3 = *(s16*)((u8*)gp + 0xC6);
557+
if (temp_r3_3 != -1) {
558+
temp_r3_4 = Ground_801C2BA4(temp_r3_3);
559+
if (temp_r3_4 == NULL) {
560+
__assert("gricemt.c", 0x47A, "mgobj");
533561
}
562+
Ground_801C4A08(temp_r3_4);
534563
}
535-
//__assert("gricemt.c",0x475,"mgobj");
536564
grIceMt_801F785C(arg0);
565+
*(u8*)((u8*)gp + 0xD8) &= ~0x80;
537566
return 0;
538567
}
539568

@@ -576,15 +605,20 @@ void grIceMt_801F7EE8(Ground_GObj* arg0)
576605
}
577606

578607
/// #grIceMt_801F7F1C
579-
void grIceMt_801F7F1C(Ground_GObj* arg0)
608+
void grIceMt_801F7F1C(HSD_GObj* gobj)
580609
{
581-
int i = 0;
582-
Ground* gp = GET_GROUND(arg0);
610+
u8 _[8];
611+
void* ptr;
612+
s32 i;
613+
614+
i = 0;
615+
ptr = gobj->user_data;
583616
do {
584-
if (42 != 0) {
585-
grMaterial_801C8CDC(arg0);
617+
if (*(void**)((u8*)ptr + 0xF8) != NULL) {
618+
grMaterial_801C8CDC(*(void**)((u8*)ptr + 0xF8));
586619
}
587-
i++;
620+
i += 1;
621+
ptr = (void*)((u8*)ptr + 4);
588622
} while (i < 2);
589623
}
590624

@@ -631,13 +665,19 @@ void grIceMt_801F815C(Ground_GObj* param1)
631665
/// #grIceMt_801F81B4
632666
void grIceMt_801F81B4(Ground_GObj* arg0)
633667
{
634-
int i = 0;
635-
Ground* gp = GET_GROUND(arg0);
668+
Ground* gp;
669+
int i;
670+
PAD_STACK(8);
671+
672+
i = 0;
673+
gp = arg0->user_data;
674+
636675
do {
637-
if (42 != 0) {
638-
grMaterial_801C8CDC(arg0);
676+
if (*(HSD_GObj**)((u8*)gp + 0xF8) != NULL) {
677+
grMaterial_801C8CDC(*(HSD_GObj**)((u8*)gp + 0xF8));
639678
}
640679
i++;
680+
gp = (Ground*)((u8*)gp + 4);
641681
} while (i < 2);
642682
}
643683

@@ -960,8 +1000,25 @@ void grIceMt_801F8CDC(Ground_GObj* gobj, s16* joint_indices, int count,
9601000

9611001
IceMountainParams* fn_801F9150(HSD_GObj* arg0)
9621002
{
963-
Ground* gp = GET_GROUND(arg0);
964-
return grIm_804D69F4;
1003+
Ground* gp = (Ground*)arg0->user_data;
1004+
1005+
gp->gv.icemt.xDE = 0;
1006+
1007+
while (1) {
1008+
IceMountainParams* params = grIm_804D69F4;
1009+
s32 index = gp->gv.icemt.xDE;
1010+
s16 *arr1 = *(s16**)(((u8*)params) + 0xB0);
1011+
s16 *arr2 = *(s16**)(((u8*)params) + 0xB4);
1012+
s16 val1 = arr1[index];
1013+
s16 val2 = arr2[index];
1014+
1015+
if (val1 != -1 && val2 != -1) {
1016+
gp->gv.icemt.xDE++;
1017+
return params;
1018+
}
1019+
1020+
gp->gv.icemt.xDE = 0;
1021+
}
9651022
}
9661023

9671024
void fn_801F91A4(void) {}
@@ -1007,38 +1064,99 @@ void grIceMt_801F91EC(HSD_GObj* param_1, s16* param_2, int param_3,
10071064
/// #grIceMt_801F929C
10081065
void grIceMt_801F929C(HSD_GObj* arg0, void* arg1)
10091066
{
1010-
mpLib_80057BC0(2);
1011-
mpJointListAdd(2);
1012-
grAnime_801C83D0(arg0, 2, 7);
1067+
s16 temp_r3;
1068+
1069+
if (*(s16*)((u8*)arg1 + 0x0) != 0) {
1070+
*(s16*)((u8*)arg1 + 0x2) = (s16) (*(s16*)((u8*)arg1 + 0x2) + 1);
1071+
temp_r3 = *(s16*)((u8*)arg1 + 0x2);
1072+
if (temp_r3 == *(s16*)((u8*)arg1 + 0xA)) {
1073+
mpLib_80057BC0(*(s16*)((u8*)arg1 + 0x8));
1074+
} else if (temp_r3 == *(s16*)((u8*)arg1 + 0xC)) {
1075+
mpJointListAdd(*(s16*)((u8*)arg1 + 0x8));
1076+
}
1077+
if (grAnime_801C83D0(arg0, *(s16*)((u8*)arg1 + 0x4), 7) != 0) {
1078+
*(s16*)((u8*)arg1 + 0x0) = 0;
1079+
}
1080+
}
10131081
}
10141082

10151083
/// #fn_801F9338
10161084
void fn_801F9338(Ground* gp, int arg1, CollData* arg2, s32 arg3,
10171085
mpLib_GroundEnum arg4, float arg8)
10181086
{
1019-
// mpLib_80057BC0(2);
1020-
// mpJointListAdd(2);
1021-
// grAnime_801C83D0(arg0,2,7);
1087+
HSD_GObj* temp_r3;
1088+
s16* temp_r30;
1089+
s16 temp_r4;
1090+
u8 flag_byte;
1091+
1092+
temp_r30 = (s16*)((u8*)gp + 0x100);
1093+
flag_byte = *(u8*)((u8*)arg2 + 0x34);
1094+
if (((flag_byte >> 3) & 0xF) == 1 && *temp_r30 == 0) {
1095+
temp_r3 = Ground_801C2BA4(2);
1096+
*temp_r30 = 1;
1097+
temp_r30[1] = 0;
1098+
grAnime_801C7A04(temp_r3, temp_r30[2], 7, 1.0f);
1099+
grAnime_801C7B24(temp_r3, temp_r30[2], 7, 0.0f);
1100+
grAnime_801C78FC(temp_r3, temp_r30[2], 7);
1101+
temp_r4 = temp_r30[3];
1102+
if (temp_r4 != -1) {
1103+
grAnime_801C7A04(temp_r3, temp_r4, 7, 1.0f);
1104+
grAnime_801C7B24(temp_r3, temp_r30[3], 7, 0.0f);
1105+
grAnime_801C78FC(temp_r3, temp_r30[3], 7);
1106+
}
1107+
}
10221108
grIceMt_801FA7F0(gp, arg1, arg2, arg3, arg4, arg8);
10231109
}
10241110

10251111
/// #fn_801F9448
10261112
void fn_801F9448(Ground* gp, int arg1, CollData* arg2, s32 arg3,
10271113
mpLib_GroundEnum arg4, float arg8)
10281114
{
1029-
// mpLib_80057BC0(2);
1030-
// mpJointListAdd(2);
1031-
// grAnime_801C83D0(arg0,2,7);
1115+
HSD_GObj* gobj;
1116+
s16* icemt_ptr = &gp->gv.icemt.x10E;
1117+
s16 temp_r4;
1118+
u8 flag_byte = *(u8*)((u8*)arg2 + 0x34);
1119+
1120+
if (((flag_byte >> 3) & 0xF) == 1 && icemt_ptr[0] == 0) {
1121+
gobj = Ground_801C2BA4(2);
1122+
icemt_ptr[0] = 1;
1123+
icemt_ptr[1] = 0;
1124+
grAnime_801C7A04(gobj, icemt_ptr[2], 7, 1.0f);
1125+
grAnime_801C7B24(gobj, icemt_ptr[2], 7, 0.0f);
1126+
grAnime_801C78FC(gobj, icemt_ptr[2], 7);
1127+
temp_r4 = icemt_ptr[3];
1128+
if (temp_r4 != -1) {
1129+
grAnime_801C7A04(gobj, temp_r4, 7, 1.0f);
1130+
grAnime_801C7B24(gobj, icemt_ptr[3], 7, 0.0f);
1131+
grAnime_801C78FC(gobj, icemt_ptr[3], 7);
1132+
}
1133+
}
10321134
grIceMt_801FA7F0(gp, arg1, arg2, arg3, arg4, arg8);
10331135
}
10341136

10351137
/// #fn_801F9558
10361138
void fn_801F9558(Ground* gp, int arg1, CollData* arg2, s32 arg3,
10371139
mpLib_GroundEnum arg4, float arg8)
10381140
{
1039-
// mpLib_80057BC0(2);
1040-
// mpJointListAdd(2);
1041-
// grAnime_801C83D0(arg0,2,7);
1141+
HSD_GObj* temp_r3;
1142+
s16 temp_r4;
1143+
s16* temp_r30;
1144+
1145+
temp_r30 = (s16*)((u8*)gp + 0x108);
1146+
if (((s32) (((u8) *(u8*)((u8*)arg2 + 0x34) >> 3U) & 0xF) == 1) && ((s16) temp_r30[0] == 0)) {
1147+
temp_r3 = Ground_801C2BA4(4);
1148+
temp_r30[0] = 1;
1149+
temp_r30[1] = 0;
1150+
grAnime_801C7A04(temp_r3, (s32) temp_r30[2], 7U, 1.0f);
1151+
grAnime_801C7B24(temp_r3, (s32) temp_r30[2], 7U, 0.0f);
1152+
grAnime_801C78FC(temp_r3, (s32) temp_r30[2], 7U);
1153+
temp_r4 = temp_r30[3];
1154+
if (temp_r4 != -1) {
1155+
grAnime_801C7A04(temp_r3, (s32) temp_r4, 7U, 1.0f);
1156+
grAnime_801C7B24(temp_r3, (s32) temp_r30[3], 7U, 0.0f);
1157+
grAnime_801C78FC(temp_r3, (s32) temp_r30[3], 7U);
1158+
}
1159+
}
10421160
grIceMt_801FA7F0(gp, arg1, arg2, arg3, arg4, arg8);
10431161
}
10441162

@@ -1157,22 +1275,90 @@ int fn_801FA4CC(int num)
11571275

11581276
int grIceMt_801FA500(HSD_GObj* param1)
11591277
{
1160-
int iVar1 = NULL;
1161-
int iVar2;
1162-
int iVar3;
1163-
iVar3 = 0;
1164-
if (param1->hsd_obj == NULL) {
1278+
int count = 0;
1279+
HSD_JObj* current;
1280+
HSD_JObj* child;
1281+
HSD_JObj* sibling;
1282+
HSD_JObj* parent;
1283+
HSD_JObj* parent_sibling;
1284+
1285+
PAD_STACK(8);
1286+
1287+
current = param1->hsd_obj;
1288+
1289+
if (current == NULL) {
11651290
__assert("gricemt.c", 2993, "jobj");
1166-
iVar1 = 0;
1167-
//} else {
1168-
// ivar1 = param1->hsd_obj
11691291
}
1170-
do {
1171-
if (iVar1 == 0) {
1172-
return iVar3;
1292+
1293+
if (current != NULL) {
1294+
current = current->child;
1295+
} else {
1296+
current = NULL;
1297+
}
1298+
1299+
if (current == NULL) {
1300+
__assert("gricemt.c", 2994, "jobj");
1301+
}
1302+
1303+
// Main tree traversal loop
1304+
while (current != NULL) {
1305+
// Check the flags for traversal control
1306+
if (!(current->flags & 0x1000)) {
1307+
// Can traverse to child
1308+
if (current != NULL) {
1309+
child = current->child;
1310+
} else {
1311+
child = NULL;
1312+
}
1313+
if (child != NULL) {
1314+
current = child;
1315+
count++;
1316+
continue;
1317+
}
11731318
}
1174-
iVar3++;
1175-
} while (true);
1319+
1320+
// Try sibling
1321+
if (current != NULL) {
1322+
sibling = current->next;
1323+
} else {
1324+
sibling = NULL;
1325+
}
1326+
if (sibling != NULL) {
1327+
current = sibling;
1328+
count++;
1329+
continue;
1330+
}
1331+
1332+
// Go up to parent and look for its sibling
1333+
if (current != NULL) {
1334+
parent = current->parent;
1335+
} else {
1336+
parent = NULL;
1337+
}
1338+
1339+
while (parent != NULL) {
1340+
if (parent != NULL) {
1341+
parent_sibling = parent->next;
1342+
} else {
1343+
parent_sibling = NULL;
1344+
}
1345+
if (parent_sibling != NULL) {
1346+
current = parent_sibling;
1347+
count++;
1348+
goto next_iteration;
1349+
}
1350+
if (parent != NULL) {
1351+
parent = parent->parent;
1352+
} else {
1353+
parent = NULL;
1354+
}
1355+
}
1356+
current = parent; // NULL
1357+
1358+
next_iteration:;
1359+
}
1360+
1361+
return (current != NULL) ? count : -1;
11761362
}
11771363

11781364
/// #grIceMt_801FA6D8

0 commit comments

Comments
 (0)