From 3a4b3cb24225e6d0bcf34b67792eaddadd335022 Mon Sep 17 00:00:00 2001 From: BR Date: Sat, 27 Jan 2024 02:33:20 -0800 Subject: [PATCH] more db --- config/GALE01/symbols.txt | 40 +++++------ src/melee/db/db_2253.c | 113 ++++++++++++++++++++++++++++++++ src/melee/db/db_2253_external.h | 6 ++ src/melee/db/db_2253_internal.h | 27 ++++---- src/melee/it/types.h | 2 +- 5 files changed, 152 insertions(+), 36 deletions(-) diff --git a/config/GALE01/symbols.txt b/config/GALE01/symbols.txt index be0a58860e..1235132dcc 100644 --- a/config/GALE01/symbols.txt +++ b/config/GALE01/symbols.txt @@ -17721,35 +17721,35 @@ un_80301E08 = .text:0x80301E08; // type:function size:0x3C scope:global un_80301E44 = .text:0x80301E44; // type:function size:0x34 scope:global un_80301E78 = .text:0x80301E78; // type:function size:0x13C scope:global DevText_GetGObj = .text:0x80301FB4; // type:function size:0x8 scope:global -un_80301FBC = .text:0x80301FBC; // type:function size:0x13C scope:global +DevText_InitPool = .text:0x80301FBC; // type:function size:0x13C scope:global fn_803020F8 = .text:0x803020F8; // type:function size:0x4 -un_803020FC = .text:0x803020FC; // type:function size:0x68 scope:global -un_80302164 = .text:0x80302164; // type:function size:0x158 scope:global -un_803022BC = .text:0x803022BC; // type:function size:0x34C scope:global -fn_80302608 = .text:0x80302608; // type:function size:0x54 -un_8030265C = .text:0x8030265C; // type:function size:0xAC scope:global -un_80302708 = .text:0x80302708; // type:function size:0x98 scope:global -un_803027A0 = .text:0x803027A0; // type:function size:0x70 scope:global +DevText_Remove = .text:0x803020FC; // type:function size:0x68 scope:global +DevText_SetupCObj = .text:0x80302164; // type:function size:0x158 scope:global +DevText_Draw = .text:0x803022BC; // type:function size:0x34C scope:global +DevText_DrawAll = .text:0x80302608; // type:function size:0x54 +DevText_CreateCObj = .text:0x8030265C; // type:function size:0xAC scope:global +DevText_Setup = .text:0x80302708; // type:function size:0x98 scope:global +DevText_AddToList = .text:0x803027A0; // type:function size:0x70 scope:global DevText_Show = .text:0x80302810; // type:function size:0x24 scope:global DevText_Create = .text:0x80302834; // type:function size:0x180 scope:global -un_803029B4 = .text:0x803029B4; // type:function size:0x88 scope:global -un_80302A3C = .text:0x80302A3C; // type:function size:0x4C scope:global -un_80302A88 = .text:0x80302A88; // type:function size:0x28 scope:global +DevText_EraseFirstLine = .text:0x803029B4; // type:function size:0x88 scope:global +DevText_SetCursorXY = .text:0x80302A3C; // type:function size:0x4C scope:global +DevText_SetCursorX = .text:0x80302A88; // type:function size:0x28 scope:global DevText_HideCursor = .text:0x80302AB0; // type:function size:0x10 scope:global un_80302AC0 = .text:0x80302AC0; // type:function size:0x10 scope:global -un_80302AD0 = .text:0x80302AD0; // type:function size:0x10 scope:global -un_80302AE0 = .text:0x80302AE0; // type:function size:0x10 scope:global -un_80302AF0 = .text:0x80302AF0; // type:function size:0x10 scope:global -un_80302B00 = .text:0x80302B00; // type:function size:0x10 scope:global +DevText_ShowBackground = .text:0x80302AD0; // type:function size:0x10 scope:global +DevText_HideBackground = .text:0x80302AE0; // type:function size:0x10 scope:global +DevText_ShowText = .text:0x80302AF0; // type:function size:0x10 scope:global +DevText_HideText = .text:0x80302B00; // type:function size:0x10 scope:global DevText_SetScale = .text:0x80302B10; // type:function size:0xC scope:global -un_80302B1C = .text:0x80302B1C; // type:function size:0x2C scope:global -un_80302B48 = .text:0x80302B48; // type:function size:0x1C scope:global +DevText_SetXY = .text:0x80302B1C; // type:function size:0x2C scope:global +DevText_StoreColorIndex = .text:0x80302B48; // type:function size:0x1C scope:global DevText_SetTextColor = .text:0x80302B64; // type:function size:0x2C scope:global DevText_SetBGColor = .text:0x80302B90; // type:function size:0x20 scope:global -un_80302BB0 = .text:0x80302BB0; // type:function size:0x34 scope:global -un_80302BE4 = .text:0x80302BE4; // type:function size:0x128 scope:global +DevText_Erase = .text:0x80302BB0; // type:function size:0x34 scope:global +DevText_Print = .text:0x80302BE4; // type:function size:0x128 scope:global un_80302D0C = .text:0x80302D0C; // type:function size:0x40 scope:global -un_80302D4C = .text:0x80302D4C; // type:function size:0xA4 scope:global +DevText_Printf = .text:0x80302D4C; // type:function size:0xA4 scope:global un_80302DF0 = .text:0x80302DF0; // type:function size:0x8 scope:global un_80302DF8 = .text:0x80302DF8; // type:function size:0x8 scope:global un_80302E00 = .text:0x80302E00; // type:function size:0xA4 scope:global diff --git a/src/melee/db/db_2253.c b/src/melee/db/db_2253.c index dd91b848f6..928e2a40d6 100644 --- a/src/melee/db/db_2253.c +++ b/src/melee/db/db_2253.c @@ -9,7 +9,9 @@ #include "dolphin/os/OSContext.h" #include "dolphin/pad/pad.h" #include "dolphin/vi/vi.h" +#include "ef/efsync.h" #include "ft/ftlib.h" +#include "it/it_266F.h" #include "it/item.h" #include "lb/lbarchive.h" #include "sysdolphin/baselib/gobj.h" @@ -490,6 +492,7 @@ 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); @@ -500,6 +503,116 @@ void db_80225F20(int player) db_802255BC_suppress_inline(player); } +void db_802260D4(int player) +{ + int sp18; + int sp14; + int sp10; + int spC; + HSD_GObj* temp_r30; + + temp_r30 = DevText_GetGObj(); + if (db_8049FAA0.x0 == 2) { + DevText_ShowBackground(db_804D6B38); + DevText_ShowText(db_804D6B38); + } else { + db_804D6B38 = DevText_Create(8, 0x14, 0x14, 0x28, 1, db_8049FA50); + if (db_804D6B38 != NULL) { + sp18 = db_804DBCF0; + sp14 = db_804DBCF4; + DevText_Show(temp_r30, db_804D6B38, db_804DBCF0); + DevText_HideCursor(db_804D6B38); + sp10 = sp18; + DevText_SetBGColor(db_804D6B38, &sp10); + spC = sp14; + DevText_SetTextColor(db_804D6B38, &spC); + DevText_SetScale(db_804D6B38, db_804DBCF8, db_804DBCFC); + } + } + db_8049FAA0.x0 = 1; +} + +void db_802261BC(int player) +{ + char* item; + db_8049FAA0.x18 = db_8049FAA0.x10; + db_8049FAA0.x1C = db_8049FAA0.x14; + db_80225F20(player); + if (db_8049FAA0.x18 != db_8049FAA0.x10 || + db_8049FAA0.x1C != db_8049FAA0.x14) + { + db_8049FAA0.xC = player; + db_8049FAA0.x4 = 0x78; + if (db_8049FAA0.x0 != 1) { + db_802260D4(player); + } + DevText_Erase(db_804D6B38); + DevText_SetCursorXY(db_804D6B38, 0, 0); + if (db_8049FAA0.x10 < 0x23) { + item = db_803EA94C[db_8049FAA0.x10]; + } else if (db_8049FAA0.x10 < 0x2F) { + item = db_803EAA50[db_8049FAA0.x10]; + } else if (db_8049FAA0.x10 < 0xEA) { + // TODO: this is wrong. return when the data section is good + item = db_803EA94C[db_8049FAA0.x10]; + } else { + while (1) { + } + } + DevText_Printf(db_804D6B38, "Item-> %s Pokemon-> %s", item, + db_803EAA50[db_8049FAA0.x14]); + } +} + +void db_802262E0(int player) +{ + int mask = HSD_PAD_DPADLEFT | HSD_PAD_DPADRIGHT | HSD_PAD_DPADUP | + HSD_PAD_Z | HSD_PAD_R | HSD_PAD_L | HSD_PAD_A | HSD_PAD_B | + HSD_PAD_X | HSD_PAD_Y | HSD_PAD_START; + SpawnItem spawnItem; + if ((db_8022558C_suppress_inline(player) & mask) != 0) { + return; + } + if ((db_802255A4_suppress_inline(player) & HSD_PAD_DPADDOWN) == 0) { + return; + } + spawnItem.kind = db_8049FAA0.x10; + if (Item_80266F3C() == 0 && spawnItem.kind < 0x23) { + return; + } + Player_LoadPlayerCoords(player, &spawnItem.prev_pos); + spawnItem.prev_pos.y += 60.0F; + spawnItem.prev_pos.z = 0.0F; + spawnItem.pos = spawnItem.prev_pos; + spawnItem.facing_dir = it_8026B684(&spawnItem.prev_pos); + spawnItem.x3C_damage = 0; + spawnItem.vel.x = spawnItem.vel.y = spawnItem.vel.z = 0.0F; + spawnItem.x0_parent_gobj = NULL; + spawnItem.x4_parent_gobj2 = spawnItem.x0_parent_gobj; + spawnItem.x44_flag.bits.b0 = 1; + spawnItem.x40 = 0; + if (spawnItem.kind < 0x23 && Item_804A0C64.x0 >= it_804D6D28->x0) { + OSReport("Item Max Over.\n"); + return; + } + if (spawnItem.kind < 0x2F && Item_804A0C64.x2C >= it_804D6D28->x14) { + OSReport("couldn't get Item struct.(CZako)"); + return; + } + if ((spawnItem.kind < 0xD0 || spawnItem.kind >= 0xEA || + it_804A0F60[spawnItem.kind] != 0) && + (spawnItem.kind != 0x22 || it_8026C704() == 0)) + { + { + HSD_GObj* gobj = Item_80268B18(&spawnItem); + if (gobj != NULL) { + GET_ITEM(gobj)->xDAA_flag.u8 |= db_804D6B3C; + efSync_Spawn(0x420, gobj, &spawnItem.prev_pos); + } + } + } +} + void db_8022659C(void) { int sp14; diff --git a/src/melee/db/db_2253_external.h b/src/melee/db/db_2253_external.h index f2e575620c..eb93228160 100644 --- a/src/melee/db/db_2253_external.h +++ b/src/melee/db/db_2253_external.h @@ -43,5 +43,11 @@ void DevText_HideCursor(DevText*); void DevText_SetBGColor(DevText*, int*); void DevText_SetTextColor(DevText*, int*); void DevText_SetScale(DevText*, float, float); +void DevText_ShowBackground(DevText*); +void DevText_ShowText(DevText*); +void DevText_Erase(DevText*); +void DevText_Printf(DevText*, char*, ...); +void DevText_SetCursorXY(DevText*, int, int); +int it_8026C704(void); #endif diff --git a/src/melee/db/db_2253_internal.h b/src/melee/db/db_2253_internal.h index 9f472db6c7..e1a0ac2132 100644 --- a/src/melee/db/db_2253_internal.h +++ b/src/melee/db/db_2253_internal.h @@ -35,9 +35,9 @@ void db_80225D7C(void); void db_80225DD8(Item_GObj* item, Fighter_GObj* owner); void db_80225E6C(Fighter_GObj* gobj); void db_80225F20(int); -void db_802260D4(void); -void db_802261BC(void); -void db_802262E0(void); +void db_802260D4(int); +void db_802261BC(int); +void db_802262E0(int); void db_802264C4(int); void db_8022659C(void); void db_8022666C(void); @@ -131,7 +131,7 @@ char* db_803EA94C[] = { "M Ball ", // clang-format on }; -char* db_string_803EAA50[] = { +char* db_803EAA50[] = { "Random", "Tosakinto", "Chicorita", "Kabigon", "Kamex", "Matadogas", "Lizardon", "Fire", "Thunder", "Freezer", "Sonans", "Hassam", "Unknown", "Entei", "Raikou", @@ -162,9 +162,6 @@ 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_803EAC88[0x18] = "Item-> %s Pokemon-> %s"; -char db_string_803EACA0[0x10] = "Item Max Over.\n"; -char db_string_803EACB0[0x28] = "couldn't get Item struct.(CZako)\n"; char db_string_803EACD8[0x18] = "A B C D E F G"; char db_string_803EACF0[0x20] = "\n%d %d %2d %d %2.2f %2.2f %2.2f"; char db_string_803EAD10[0x10] = "EYE %d,%d,%d"; @@ -200,13 +197,13 @@ struct { } db_8049FA00[4]; char db_8049FA50[0x50]; struct { - int x0; + unsigned int x0; int x4; int x8; int xC; - int x10; + ItemKind x10; int x14; - int x18; + ItemKind x18; int x1C; UnkFlagStruct x20; int x24; @@ -229,7 +226,7 @@ void* db_804D6B24; void* db_804D6B28; void* db_804D6B2C; unsigned short db_804D6B30; -int db_804D6B38; +DevText* db_804D6B38; int db_804D6B3C; int db_804D6B40; int db_804D6B48; @@ -257,10 +254,10 @@ int db_804D6BA0; // sdata2 const int db_804DBCF0 = 1; const int db_804DBCF4 = 1; -const int db_804DBCF8 = 1; -const int db_804DBCFC = 1; -const int db_804DBD00 = 1; -const int db_804DBD04 = 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; diff --git a/src/melee/it/types.h b/src/melee/it/types.h index 959249d7bc..a9742363aa 100644 --- a/src/melee/it/types.h +++ b/src/melee/it/types.h @@ -770,7 +770,7 @@ struct x1C_struct { }; struct HSD_ObjAllocUnk { - s32 x0; + u32 x0; s32 x4; s32 x8; s32 xC;