Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
BR- committed Jan 28, 2024
1 parent dacedc5 commit 17e0c60
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 131 deletions.
183 changes: 103 additions & 80 deletions src/melee/db/db_2253.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@

#include <stdarg.h>

// how do I get rid of these?
int db_8022558C_suppress_inline(int x);
int db_802255A4_suppress_inline(int x);
int db_802255BC_suppress_inline(int x);
void db_80225D7C_suppress_inlines(void);
void db_80225F20_suppress_inlines(int player);

void db_80225374(void)
{
PADStatus status[4];
Expand Down Expand Up @@ -115,25 +122,6 @@ int db_802255BC(int x)
return db_8049FA00[x].x10;
}

// how do I get rid of these?
int db_8022558C_suppress_inline(int x)
{
int y[10000];
return db_8022558C(x);
}

int db_802255A4_suppress_inline(int x)
{
int y[10000];
return db_802255A4(x);
}

int db_802255BC_suppress_inline(int x)
{
int y[10000];
return db_802255BC(x);
}

void db_802255D4(void)
{
int stack[4];
Expand Down Expand Up @@ -458,12 +446,6 @@ void db_80225D7C(void)
}
}

void db_80225D7C_suppress_inlines(void)
{
int y[5000];
db_80225D7C();
}

void db_80225DD8(Item_GObj* item, Fighter_GObj* owner)
{
Item* it = GET_ITEM(item);
Expand Down Expand Up @@ -499,7 +481,6 @@ void db_80225E6C(Fighter_GObj* owner)

void db_80225F20(int player)
{
int y[2000]; // suppress inlines of this too lol
db_8022558C_suppress_inline(player);
db_802255BC_suppress_inline(player);
db_8022558C_suppress_inline(player);
Expand Down Expand Up @@ -533,7 +514,7 @@ void db_802260D4(int player)
DevText_SetBGColor(db_804D6B38, &sp10);
spC = sp14;
DevText_SetTextColor(db_804D6B38, &spC);
DevText_SetScale(db_804D6B38, db_804DBCF8, db_804DBCFC);
DevText_SetScale(db_804D6B38, 12.0F, 16.0F);
}
}
db_8049FAA0.x0 = 1;
Expand All @@ -544,7 +525,7 @@ void db_802261BC(int player)
char* item;
db_8049FAA0.x18 = db_8049FAA0.x10;
db_8049FAA0.x1C = db_8049FAA0.x14;
db_80225F20(player);
db_80225F20_suppress_inlines(player);
if (db_8049FAA0.x18 != db_8049FAA0.x10 ||
db_8049FAA0.x1C != db_8049FAA0.x14)
{
Expand Down Expand Up @@ -663,7 +644,7 @@ void db_8022659C(void)
DevText_SetBGColor(db_8049FAC8.x0, &spC);
sp8 = sp10;
DevText_SetTextColor(db_8049FAC8.x0, &sp8);
DevText_SetScale(db_8049FAC8.x0, db_804DBD10, db_804DBD14);
DevText_SetScale(db_8049FAC8.x0, 9.0F, 12.0F);
}
}

Expand Down Expand Up @@ -707,70 +688,39 @@ void db_80226730(int arg0)

void db_802267C8(void)
{
s32 sp14;
s32 sp10;
s32 spC;
s32 sp8;
int sp14;
int sp10;
int spC;
int sp8;
HSD_GObj* temp_r3;

temp_r3 = DevText_GetGObj();
M2C_FIELD(&db_804D6B48, u8*, 0) =
(M2C_FIELD(&db_804D6B48, u8*, 0) & ~0xE0) | 0x20;
M2C_FIELD(&db_804D6B48, u8*, 1) = M2C_FIELD(&db_804D6B48, u8*, 1) & ~0x40;
M2C_FIELD(&db_804D6B48, u8*, 0) =
M2C_FIELD(&db_804D6B48, u8*, 0) & ~0x1F80;
*db_8049FE18 = DevText_Create(7, 0x14, 0x14, 0x3C, 0xC, db_8049FE18 + 4);
if (*db_8049FE18 != NULL) {
db_804D6B48.b0 = 1;
db_804D6B48.b9 = 0;
db_804D6B48.b3 = 0;
db_8049FE18.x0 = DevText_Create(7, 20, 20, 60, 12, db_8049FE18.x4);
if (db_8049FE18.x0 != NULL) {
sp14 = db_804DBD18;
sp10 = db_804DBD1C;
DevText_Show(temp_r3, *db_8049FE18, db_804DBD18);
DevText_HideCursor(*db_8049FE18);
DevText_Show(temp_r3, db_8049FE18.x0, db_804DBD18);
DevText_HideCursor(db_8049FE18.x0);
spC = sp14;
DevText_SetBGColor(*db_8049FE18, &spC);
DevText_SetBGColor(db_8049FE18.x0, &spC);
sp8 = sp10;
DevText_SetTextColor(*db_8049FE18, &sp8);
DevText_SetScale(*db_8049FE18, M2C_BITWISE(f32, db_804DBD20),
M2C_BITWISE(f32, db_804DBD24));
DevText_SetTextColor(db_8049FE18.x0, &sp8);
DevText_SetScale(db_8049FE18.x0, 9.0F, 12.0F);
}
}

void db_802268B8(void)
{
Fighter* temp_r5;
Fighter_GObj* var_r4;
s32 temp_r3;

temp_r3 = (db_804D6B48 >> 7) & 0x3F;
if (temp_r3 != 0) {
db_804D6B48 =
(db_804D6B48 & ~0x1F80) | ((((temp_r3 * 2) & 0x3E) << 7) & 0x1F80);
} else {
db_804D6B48 = (db_804D6B48 & ~0x1F80) | 0x80;
}
var_r4 = HSD_GObj_Entities->fighters;
loop_5:
if (var_r4 != NULL) {
temp_r5 = var_r4->user_data;
temp_r5->x21FC_flag.u8 =
((db_804D6B48 >> 5) & 0xFC & ~3) | (temp_r5->x21FC_flag.u8 & 3);
var_r4 = var_r4->next;
goto loop_5;
}
if ((db_804D6B48 >> 7) & 2) {
db_80225BF0();
} else {
db_80225C44();
}
if ((db_804D6B48 >> 7) & 8) {
db_80225C8C();
} else {
db_80225CD4();
}
if ((db_804D6B48 >> 7) & 0x20) {
db_80225B48();
return;
HSD_GObj* fighter;
for (fighter = HSD_GObj_Entities->fighters; fighter != NULL;
fighter = fighter->next)
{
Fighter* ft = GET_FIGHTER(fighter);
ft->x21FC_flag.bits.b7 = 0;
}
db_80225B9C();
}

u8 db_8022697C(Fighter_GObj* owner)
Expand All @@ -783,6 +733,79 @@ u8 db_8022697C(Fighter_GObj* owner)
}
}

void db_802269C0(void)
{
DevText* temp_r31;
Fighter* temp_r28;
Fighter_GObj* var_r29;
f32 temp_f1;
f32 temp_f1_2;
s32 temp_r5;
s32 temp_r5_2;
s32 temp_r5_3;
s32 temp_r5_4;
s32 temp_r6;
s32 var_r30;

if ((M2C_FIELD(&db_804D6B48, u8*, 1) >> 6) & 1) {
temp_r31 = db_8049FE18.x0;
var_r30 = 0;
DevText_Erase(temp_r31);
DevText_SetCursorXY(temp_r31, 0, 0);
for (var_r29 = HSD_GObj_Entities->fighters; var_r29 != NULL;
var_r29 = var_r29->next)
{
temp_r28 = var_r29->user_data;
if (var_r30 == 0) {
var_r30 = 1;
} else {
DevText_Printf(temp_r31, "\n");
}
temp_r6 = temp_r28->motion_id;
if (temp_r6 < 0x155) {
DevText_Printf(temp_r31, "%d %s", temp_r28->player_id,
((char*) db_804D6B28)[temp_r6]);
} else {
DevText_Printf(temp_r31, "%d %d", temp_r28->player_id,
temp_r6);
}
DevText_SetCursorX(temp_r31, 0x17);
temp_r5 = temp_r28->anim_id;
if (temp_r5 != -1) {
if (temp_r5 < 0x127) {
DevText_Printf(temp_r31, "%s",
((char*) db_804D6B24)[temp_r5]);
} else {
DevText_Printf(temp_r31, "%d", temp_r5);
}
}
DevText_SetCursorX(temp_r31, 0x2C);
DevText_Printf(temp_r31, "%03.2f", temp_r28->cur_anim_frame);
if ((M2C_FIELD(temp_r28, u16*, 0x221C) >> 6) & 7) {
DevText_SetCursorX(temp_r31, 0x34);
temp_r5_2 = (M2C_FIELD(temp_r28, u16*, 0x221C) >> 6) & 7;
if (temp_r5_2 & 1) {
DevText_Printf(temp_r31, "L");
} else {
DevText_Printf(temp_r31, " ");
}
temp_r5_3 = (M2C_FIELD(temp_r28, u16*, 0x221C) >> 6) & 7;
if (temp_r5_3 & 2) {
DevText_Printf(temp_r31, "R");
} else {
DevText_Printf(temp_r31, " ");
}
temp_r5_4 = (M2C_FIELD(temp_r28, u16*, 0x221C) >> 6) & 7;
if (temp_r5_4 & 4) {
DevText_Printf(temp_r31, "T");
} else {
DevText_Printf(temp_r31, " ");
}
}
}
}
}

/////////////////////////////////////////////////////////////////////////////

void db_8022886C(void)
Expand Down
1 change: 1 addition & 0 deletions src/melee/db/db_2253_external.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ void DevText_ShowBackground(DevText*);
void DevText_ShowText(DevText*);
void DevText_Erase(DevText*);
void DevText_Printf(DevText*, char*, ...);
void DevText_SetCursorX(DevText*, int);
void DevText_SetCursorXY(DevText*, int, int);
void DevText_HideBackground(DevText*);
void DevText_HideText(DevText*);
Expand Down
83 changes: 32 additions & 51 deletions src/melee/db/db_2253_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,28 +162,11 @@ int db_803EABDC[0xD] = { 0 };
char db_string_803EAC10[0x78] =
"Item=%d Foods=%d Yaku=%d Sp_Item=%d Pokemon=%d PokeShot=%d CZako=%d "
"CZakoShot=%d Zako=%d ZakoShot=%d Shot=%d Etc=%d\n";
char db_string_803EAD10[0x10] = "EYE %d,%d,%d";
char db_string_803EAD20[0x10] = "INT %d,%d,%d";
char db_string_803EAD30[0x10] = "FOV %d ANG %d";
int db_803EAD40[4] = { 3, 2, 0, 1 };
char db_string_803EAD50[0x14] = "FGM:OFF BGM:OFF";
char db_string_803EAD64[0x14] = "FGM:OFF BGM:ON ";
char db_string_803EAD78[0x14] = "FGM:ON BGM:OFF";
char db_string_803EAD8C[0x14] = "FGM:ON BGM:ON ";
char db_string_803EADA0[0x14] = "PVoice %3d %3d\n";
char db_string_803EADB4[0x14] = "VVoice %3d %3d\n";
char db_string_803EADC8[0x10] = "cant find xfb!\n";
char db_string_803EADD8[0x10] = "dbscreenshot.c";
char db_string_803EADE8[0x20] = "USB:shot/screenshot%02d.frb";
struct {
void* x0;
int x4;
} db_803EAE08[2] = { { NULL, 0xFF0000FF }, { &hsd_8040FF80, 0x000000FF } };
char db_string_803EAE18[0x10] = "1P %7d 2P %7d\n";
char db_string_803EAE28[0x10] = "3P %7d 4P %7d\n";
char db_string_803EAE38[0x10] = "%dP screen %d";
char db_string_803EAE48[0x10] = "screen over!!";
char db_string_803EAE58[0x10] = "objalloc.h";

// bss
struct {
Expand All @@ -210,7 +193,10 @@ struct {
DevText* x0;
char x4[0x34C];
} db_8049FAC8;
char db_8049FE18[0x5A8];
struct {
DevText* x0;
char x4[0x5A4];
} db_8049FE18;
char db_804A03C0[0xC0];
char db_804A0480[0x70];

Expand All @@ -227,7 +213,33 @@ unsigned short db_804D6B30;
DevText* db_804D6B38;
int db_804D6B3C;
UnkFlagStruct db_804D6B40;
int db_804D6B48;
struct {
int b0 : 3;
int b3 : 6;
int b9 : 1;
int b10 : 1;
int b11 : 1;
int b12 : 1;
int b13 : 1;
int b14 : 1;
int b15 : 1;
int b16 : 1;
int b17 : 1;
int b18 : 1;
int b19 : 1;
int b20 : 1;
int b21 : 1;
int b22 : 1;
int b23 : 1;
int b24 : 1;
int b25 : 1;
int b26 : 1;
int b27 : 1;
int b28 : 1;
int b29 : 1;
int b30 : 1;
int b31 : 1;
} db_804D6B48;
int db_804D6B50;
int db_804D6B58;
int db_804D6B5C;
Expand All @@ -249,43 +261,12 @@ int db_804D6B98;
int db_804D6B9C;
int db_804D6BA0;

// sdata2
// sdata2 (constants)
const int db_804DBCF0 = 1;
const int db_804DBCF4 = 1;
const float db_804DBCF8 = 1;
const float db_804DBCFC = 1;
const float db_804DBD00 = 1;
const float db_804DBD04 = 1;
const int db_804DBD08 = 1;
const int db_804DBD0C = 1;
const int db_804DBD10 = 1;
const int db_804DBD14 = 1;
const int db_804DBD18 = 1;
const int db_804DBD1C = 1;
const int db_804DBD20 = 1;
const int db_804DBD24 = 1;
const int db_804DBD28 = 1;
const int db_804DBD2C = 1;
const int db_804DBD30 = 1;
const int db_804DBD34 = 1;
const int db_804DBD38 = 1;
const int db_804DBD3C = 1;
const int db_804DBD40 = 1;
const int db_804DBD44 = 1;
const int db_804DBD48 = 1;
const int db_804DBD4C = 1;
const int db_804DBD50 = 1;
const int db_804DBD54 = 1;
const int db_804DBD58 = 1;
const int db_804DBD5C = 1;
const int db_804DBD60 = 1;
const int db_804DBD64 = 1;
const int db_804DBD68 = 1;
const int db_804DBD6C = 1;
const int db_804DBD70 = 1;
const int db_804DBD74 = 1;
const int db_804DBD78 = 1;
const int db_804DBD80 = 1;
const int db_804DBD84 = 1;

#endif

0 comments on commit 17e0c60

Please sign in to comment.