Skip to content

Commit

Permalink
add sdata
Browse files Browse the repository at this point in the history
  • Loading branch information
thefoxcam committed Jul 24, 2024
1 parent a16288a commit a27d720
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 75 deletions.
142 changes: 79 additions & 63 deletions src/melee/gr/grflatzone.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,33 @@
#include "gr/types.h"
#include "gr/inlines.h"

// struct grKongo_GroundVars {
// /* 0x00 */ s16 xC4;
// /* 0x02 */ s16 xC6;
// /* 0x04 */ char pad4[4]; /* maybe part of xC6[3]? */
// /* 0x08 */ s16 unk8; /* inferred */
// /* 0x0A */ char padA[2];
// /* 0x0C */ union _anonymous u;
// }; /* size = 0x10 */
static StageCallbacks grFz_803E7940[9] = {
{ grFlatzone_80217030, grFlatzone_8021705C, grFlatzone_80217064, grFlatzone_80217068, 0 },
{ grFlatzone_802173D4, grFlatzone_80217430, grFlatzone_80217438, grFlatzone_8021743C, 0 },
{ grFlatzone_8021707C, grFlatzone_802171CC, grFlatzone_802171D4, grFlatzone_802173D0, 0xC0000000 },
{ grFlatzone_80217648, grFlatzone_802176B4, grFlatzone_802176BC, grFlatzone_80217CD0, 0 },
{ grFlatzone_80217CD4, grFlatzone_80217D28, grFlatzone_80217D30, grFlatzone_80217DA4, 0 },
{ grFlatzone_80217450, grFlatzone_802174E4, grFlatzone_802174EC, grFlatzone_80217644, 0 },
{ grFlatzone_80217DA8, grFlatzone_80217DFC, grFlatzone_80217E04, grFlatzone_80217E78, 0 },
{ grFlatzone_80217E7C, grFlatzone_80217E80, grFlatzone_80217E88, grFlatzone_80217E8C, 0 },
{ grFlatzone_80217E90, grFlatzone_80217EE8, grFlatzone_80217EF0, grFlatzone_8021805C, 0 }
};

StageData grFz_803E7A00 = {
27,
grFz_803E7940,
"/GrFz.dat",
grFlatzone_80216E78,
grFlatzone_80216E74,
grFlatzone_80216F38,
grFlatzone_80216F3C,
grFlatzone_80216F40,
grFlatzone_802182B4,
grFlatzone_802182BC,
(1 << 0),
NULL,
0,
};

void fn_8021706C(HSD_GObj *);
void fn_80217440(HSD_GObj *);
Expand Down Expand Up @@ -55,12 +74,9 @@ static struct {
f32 unk38;
s32 unk3C;
}* grFz_804D6AB0;
static struct StageCallbacks grFz_803E7940[9]; /* unable to generate initializer: cannot parse grFlatzone_8021705C as integer */
static u16 grFz_803E7A68[9]; /* unable to generate initializer: non-zero padding */
// static s8 grFz_804D4920[8] = { 0x6A, 0x6F, 0x62, 0x6A, 0x2E, 0x68, 0, 0 };
// static s8 grFz_804D4928[8] = { 0x6A, 0x6F, 0x62, 0x6A, 0, 0, 0, 0 };
static Vec3 grFz_803B8430;
static s32 grFz_804DBAC4 = 0x30004; /* const */

void grFlatzone_80216E74(void) {
return;
Expand Down Expand Up @@ -96,7 +112,7 @@ void grFlatzone_80216F3C(void) {
return;
}

s32 grFlatzone_80216F40(void) {
int grFlatzone_80216F40(void) {
return 0;
}

Expand All @@ -118,7 +134,7 @@ HSD_GObj *grFlatzone_80216F48(s32 gobj_id) {
HSD_GObjProc_8038FD54(gobj, callbacks->callback2, 4);
}
} else {
// OSReport(grFz_803E7940 + 0xF4, grFz_803E7940 + 0x118, 0xE8, gobj_id, (bitwise f32) temp_ret);
OSReport("%s:%d: couldn t get gobj(id=%d)\n", "grflatzone.c", 0xE8, gobj_id);
}
return gobj;
}
Expand All @@ -128,7 +144,7 @@ void grFlatzone_80217030(Ground_GObj *gobj) {
grAnime_801C8138(gobj, gp->map_id, 0);
}

s32 grFlatzone_8021705C(void) {
int grFlatzone_8021705C(void) {
return 0;
}

Expand Down Expand Up @@ -173,7 +189,7 @@ void grFlatzone_8021707C(Ground_GObj *gobj) {
Ground_801C10B8(gobj, fn_8021706C);
}

s32 grFlatzone_802171CC() {
int grFlatzone_802171CC() {
return 0;
}

Expand All @@ -188,33 +204,18 @@ static inline grFlatzone_802171D4_inline(Ground_GObj *gobj) {

void grFlatzone_802171D4(Ground_GObj *gobj) {
s32 sp24;
// HSD_GObj *gobj;
// HSD_GObj *gobj_1;
// HSD_GObj *gobj_2;
// HSD_GObj *gobj_3;
s16 temp_r3;
s32 temp_r29;
s32 temp_r3_11;
s32 temp_r3_12;
s32 var_r28;
s32 var_r3;
s32 var_r3_2;
u8 temp_r3_2;
void *temp_r3_10;
void *temp_r3_4;
void *temp_r3_6;
void *temp_r3_8;

Ground *gp = GET_GROUND(gobj);
if (!gp->gv.flatzone.xC4 && gp->gv.flatzone.xC7) {
temp_r3 = gp->gv.izumi3.xC8;
if (temp_r3 != 0) {
gp->gv.izumi3.xC8 = temp_r3 - 1;
if ((s16) gp->gv.izumi3.xC8 == 0) {
if (gp->gv.flatzone.xC8 != 0) {
gp->gv.flatzone.xC8 -= 1;
if (gp->gv.flatzone.xC8 == 0) {
gp->gv.flatzone.xC7 = 0;
gp->gv.flatzone.xC6 = gp->gv.flatzone.xC5;
do {
// gp->gv.flatzone.xC5 = grFz_804DBAC4[HSD_Randi(2)];
s16 vals[2] = { 3, 4 };
gp->gv.flatzone.xC5 = vals[HSD_Randi(2)];
} while (gp->gv.flatzone.xC6 == gp->gv.flatzone.xC5);
switch (gp->gv.flatzone.xC5) {
case 1:
Expand Down Expand Up @@ -256,7 +257,7 @@ void grFlatzone_802173D4(Ground_GObj *gobj) {
gp->x11_flags.b012 = 2;
}

s32 grFlatzone_80217430(void) {
int grFlatzone_80217430(void) {
return 0;
}

Expand Down Expand Up @@ -288,7 +289,7 @@ void grFlatzone_80217450(Ground_GObj *gobj) {
Ground_801C10B8((HSD_GObj *) gobj, fn_80217440);
}

s32 grFlatzone_802174E4(void) {
int grFlatzone_802174E4(void) {
return 0;
}

Expand Down Expand Up @@ -429,11 +430,8 @@ void grFlatzone_802176BC(Ground_GObj *gobj) {
Ground_801C2FE0(gobj);
}




void grFlatzone_80217644(void) {

return;
}

void grFlatzone_80217648(Ground_GObj *gobj) {
Expand All @@ -449,7 +447,7 @@ void grFlatzone_80217648(Ground_GObj *gobj) {
gp->gv.flatzone2.xD4 = 0;
}

s32 grFlatzone_802176B4(void) {
int grFlatzone_802176B4(void) {
return 0;
}

Expand All @@ -466,7 +464,7 @@ void grFlatzone_80217CD4(Ground_GObj *gobj) {
gp->gv.flatzone.xC4 = 0;
}

s32 grFlatzone_80217D28(void) {
int grFlatzone_80217D28(void) {
return 0;
}

Expand Down Expand Up @@ -495,21 +493,40 @@ void grFlatzone_80217DA8(Ground_GObj *gobj) {
grFlatzone_80217CD4(gobj);
}

s32 grFlatzone_80217DFC(void) {
int grFlatzone_80217DFC(void) {
return 0;
}

static s16 grFz_803E7A68[] = {
0x0000, 0x0001,
0x0002, 0xFFFF,
0xFFFF, 0x0003,
0x0004, 0x0005,
0x0006, 0x0007,
0x0008, 0x0009,
0x000A, 0x000B,
0x000C, 0x000D,
0x000E, 0x000F,
0x0010, 0x0011,
0x0012, 0xFFFF,
0xFFFF, 0xFFFF,
0xFFFF, 0x0013,
0xFFFF, 0xFFFF,
0xFFFF, 0xFFFF,
0x0014, 0xFFFF,
0xFFFF, 0xFFFF,
0xFFFF, 0x0015,
0xFFFF, 0xFFFF,
0xFFFF, 0xFFFF,
0x0000, 0x0000,
0x0000, 0x0000,
0x0000, 0x0000,
0x0000
};

void grFlatzone_802174EC(Ground_GObj *gobj) {
s16 temp_r0;
s16 temp_r4;
s32 temp_r29;
s32 temp_r3_2;
s32 temp_r3_3;
s32 var_r28;
s32 var_r3;
s32 var_r3_2;
u8 temp_r3;
u8 temp_r3_4;

Ground *gp = GET_GROUND(gobj);
if (((u8) gp->gv._[0] == 0) && ((u8) gp->gv._[3] != 8) && ((u8) gp->gv._[5] != 0)) {
Expand All @@ -522,7 +539,7 @@ void grFlatzone_802174EC(Ground_GObj *gobj) {
if (gp->gv._[6] == gp->gv._[5]) {
continue;
}
temp_r0 = *((u16 *)grFz_803E7A68 + (gp->gv._[3] * 5 + (gp->gv._[5])));
temp_r0 = *((u16 *)grFz_803E7A68 + (gp->gv._[3] * 10 + (gp->gv._[5])));
} while (temp_r0 == -1);
gp->gv._[1] = (u8) temp_r0;
grAnime_801C8138(gobj, gp->map_id, gp->gv._[1]);
Expand Down Expand Up @@ -550,7 +567,7 @@ void grFlatzone_80217E7C(void) {
return;
}

s32 grFlatzone_80217E80(void) {
int grFlatzone_80217E80(void) {
return 0;
}

Expand All @@ -571,7 +588,7 @@ void grFlatzone_80217E90(Ground_GObj *gobj) {
*(s32 *)&gp->gv.flatzone.xC8 = 0;
}

s32 grFlatzone_80217EE8(void) {
int grFlatzone_80217EE8(void) {
return 0;
}

Expand Down Expand Up @@ -693,11 +710,11 @@ void grFlatzone_802181B4(void) {
if (gp != NULL) {
do {
gp->gv.flatzone.xC7 = HSD_Randi(8);
} while (gp->gv.flatzone.xC7 == gp->gv.flatzone.xC8);
gp->gv._[0xC9] = 0;
gp->gv._[0xCA] = 0;
} while (gp->gv.flatzone.xC7 == gp->gv._[4]);
gp->gv._[5] = 0;
gp->gv._[6] = 0;
gp->gv.flatzone.xCC = 0;
gp->gv.flatzone.xC5 = *((u16 *)grFz_803E7A68 + (gp->gv.flatzone.xC7 * 5 + gp->gv._[5]));
gp->gv.flatzone.xC5 = *(grFz_803E7A68 + (gp->gv._[3] * 10 + gp->gv._[5]));
grAnime_801C8138(gobj, gp->map_id, gp->gv.flatzone.xC5);
}
}
Expand All @@ -718,11 +735,10 @@ void grFlatzone_80218260(void) {
}
}
}

s32 grFlatzone_802182B4(void) {
return 0;
lb_UnkAnimStruct * grFlatzone_802182B4(int arg0) {
return NULL;
}

s32 grFlatzone_802182BC(void) {
int grFlatzone_802182BC(void) {
return 1;
}
24 changes: 12 additions & 12 deletions src/melee/gr/grflatzone.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,46 @@ void grFlatzone_80216E74(); /* static */
void grFlatzone_80216E78(); /* static */
void grFlatzone_80216F38(); /* static */
void grFlatzone_80216F3C(); /* static */
s32 grFlatzone_80216F40(); /* static */
int grFlatzone_80216F40(); /* static */
HSD_GObj *grFlatzone_80216F48(s32 ); /* static */
void grFlatzone_80217030(Ground_GObj *); /* static */
s32 grFlatzone_8021705C(); /* static */
int grFlatzone_8021705C(); /* static */
void grFlatzone_80217064(); /* static */
void grFlatzone_80217068(); /* static */
void grFlatzone_8021707C(Ground_GObj *); /* static */
s32 grFlatzone_802171CC(); /* static */
int grFlatzone_802171CC(); /* static */
void grFlatzone_802171D4(Ground_GObj *); /* static */
void grFlatzone_802173D0(); /* static */
void grFlatzone_802173D4(Ground_GObj *); /* static */
s32 grFlatzone_80217430(); /* static */
int grFlatzone_80217430(); /* static */
void grFlatzone_80217438(); /* static */
void grFlatzone_8021743C(); /* static */
void grFlatzone_80217450(Ground_GObj *); /* static */
s32 grFlatzone_802174E4(); /* static */
int grFlatzone_802174E4(); /* static */
void grFlatzone_802174EC(Ground_GObj *); /* static */
void grFlatzone_80217644(); /* static */
void grFlatzone_80217648(Ground_GObj *); /* static */
s32 grFlatzone_802176B4(); /* static */
int grFlatzone_802176B4(); /* static */
void grFlatzone_802176BC(Ground_GObj *); /* static */
void grFlatzone_80217CD0(); /* static */
void grFlatzone_80217CD4(Ground_GObj *); /* static */
s32 grFlatzone_80217D28(); /* static */
int grFlatzone_80217D28(); /* static */
void grFlatzone_80217D30(Ground_GObj *); /* static */
void grFlatzone_80217DA4(); /* static */
void grFlatzone_80217DA8(Ground_GObj *); /* static */
s32 grFlatzone_80217DFC(); /* static */
int grFlatzone_80217DFC(); /* static */
void grFlatzone_80217E04(Ground_GObj *); /* static */
void grFlatzone_80217E78(); /* static */
void grFlatzone_80217E7C(); /* static */
s32 grFlatzone_80217E80(); /* static */
int grFlatzone_80217E80(); /* static */
void grFlatzone_80217E88(); /* static */
void grFlatzone_80217E8C(); /* static */
void grFlatzone_80217E90(Ground_GObj *); /* static */
s32 grFlatzone_80217EE8(); /* static */
int grFlatzone_80217EE8(); /* static */
void grFlatzone_80217EF0(Ground_GObj *); /* static */
void grFlatzone_8021805C(); /* static */
void grFlatzone_80218060(s32 ); /* static */
void grFlatzone_802181B4(); /* static */
void grFlatzone_80218260(); /* static */
s32 grFlatzone_802182B4(); /* static */
s32 grFlatzone_802182BC(); /* static */
lb_UnkAnimStruct *grFlatzone_802182B4(int); /* static */
int grFlatzone_802182BC(); /* static */

0 comments on commit a27d720

Please sign in to comment.