From 2498d687ebdca4e035887054fe6fd3b1a4ca09dd Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Mon, 18 Dec 2023 19:55:24 -0500 Subject: [PATCH] use enums for file indexes in a few more actors --- include/d/d_cloth_packet.h | 4 ++- include/d/d_com_inf_game.h | 5 +++ include/d/d_item_data.h | 2 +- src/d/actor/d_a_arrow_lighteff.cpp | 18 +++++------ src/d/actor/d_a_ghostship.cpp | 22 ++++++++++--- src/d/actor/d_a_shop_item.cpp | 51 ++++++++++++++++++++++++++++-- 6 files changed, 83 insertions(+), 19 deletions(-) diff --git a/include/d/d_cloth_packet.h b/include/d/d_cloth_packet.h index 689c55469..b2740c958 100644 --- a/include/d/d_cloth_packet.h +++ b/include/d/d_cloth_packet.h @@ -10,6 +10,9 @@ class dKy_tevstr_c; class dCloth_packet_c : public J3DPacket { public: + typedef dCloth_packet_c* (*CreateFunc)(ResTIMG*, ResTIMG*, dKy_tevstr_c*, cXyz**); + typedef int (*FactorCheck)(dCloth_packet_c*, int, int); + dCloth_packet_c(ResTIMG*, int, int, float, float, dKy_tevstr_c*, cXyz**); ~dCloth_packet_c(); virtual void init(); @@ -27,7 +30,6 @@ public: void setScale(cXyz scale) { mScale = scale; } void setMtx(Mtx mtx); - typedef int (*FactorCheck)(dCloth_packet_c*, int, int); void setFactorCheckCB(FactorCheck cb) { mpFactorCheckCB = cb; } void setWindPower(f32 wind, f32 windWave) { mWindSpeed = wind; diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index bf2337bf4..506b48723 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -175,6 +175,11 @@ enum ALWAYS_RES_FILE_ID { // IDs and indexes are synced ALWAYS_BTI_UMIPT=0x8E, }; +enum CLOTH_RES_FILE_ID { // IDs and indexes are synced + /* TEX */ + CLOTH_BTI_CLOTHTOON=0x3, +}; + class __d_timer_info_c { public: __d_timer_info_c() { diff --git a/include/d/d_item_data.h b/include/d/d_item_data.h index 6cd9975bf..48ec1db32 100644 --- a/include/d/d_item_data.h +++ b/include/d/d_item_data.h @@ -274,7 +274,7 @@ struct dItem_data_item_resource { /* 0x14 */ s8 mTevFrm; // If specified, keep the BRK animation on this frame. /* 0x16 */ s16 mItemMesgNum; // Message containing this item's name /* 0x18 */ u32 mUnused; // Always 0, doesn't seem to be read - /* 0x1C */ u32 mUnknown; // Varies between items, but doesn't seem to be read + /* 0x1C */ u32 mUnknown; // Varies between items, but doesn't seem to be read. Resembles a differed dlist flag. /* 0x20 */ u16 mHeapSize; }; diff --git a/src/d/actor/d_a_arrow_lighteff.cpp b/src/d/actor/d_a_arrow_lighteff.cpp index 54d72f404..4584c4aa0 100644 --- a/src/d/actor/d_a_arrow_lighteff.cpp +++ b/src/d/actor/d_a_arrow_lighteff.cpp @@ -81,13 +81,13 @@ BOOL daArrow_Lighteff_c::CreateHeap() { J3DModelData* modelData; if(field_0x2E8 == 1) { - modelData = static_cast(dComIfG_getObjectRes("Link", 0x32)); + modelData = static_cast(dComIfG_getObjectRes("Link", LINK_BDL_GARWFI00)); } else if(field_0x2E8 == 2) { - modelData = static_cast(dComIfG_getObjectRes("Link", 0x33)); + modelData = static_cast(dComIfG_getObjectRes("Link", LINK_BDL_GARWFI01)); } else { - modelData = static_cast(dComIfG_getObjectRes("Link", 0x34)); + modelData = static_cast(dComIfG_getObjectRes("Link", LINK_BDL_GARWG00)); } JUT_ASSERT(187, modelData != 0); @@ -100,16 +100,16 @@ BOOL daArrow_Lighteff_c::CreateHeap() { J3DAnmTextureSRTKey* btk; J3DAnmTevRegKey* brk; if(field_0x2E8 == 1) { - btk = static_cast(dComIfG_getObjectRes("Link", 0x5E)); - brk = static_cast(dComIfG_getObjectRes("Link", 0x52)); + btk = static_cast(dComIfG_getObjectRes("Link", LINK_BTK_GARWFI00)); + brk = static_cast(dComIfG_getObjectRes("Link", LINK_BRK_GARWFI00)); } else if(field_0x2E8 == 2) { - btk = static_cast(dComIfG_getObjectRes("Link", 0x5F)); - brk = static_cast(dComIfG_getObjectRes("Link", 0x53)); + btk = static_cast(dComIfG_getObjectRes("Link", LINK_BTK_GARWFI01)); + brk = static_cast(dComIfG_getObjectRes("Link", LINK_BRK_GARWFI01)); } else { - btk = static_cast(dComIfG_getObjectRes("Link", 0x60)); - brk = static_cast(dComIfG_getObjectRes("Link", 0x54)); + btk = static_cast(dComIfG_getObjectRes("Link", LINK_BTK_GARWG00)); + brk = static_cast(dComIfG_getObjectRes("Link", LINK_BRK_GARWG00)); } JUT_ASSERT(216, btk != 0); diff --git a/src/d/actor/d_a_ghostship.cpp b/src/d/actor/d_a_ghostship.cpp index 425c43263..1e5bab710 100644 --- a/src/d/actor/d_a_ghostship.cpp +++ b/src/d/actor/d_a_ghostship.cpp @@ -12,6 +12,18 @@ #include "d/d_s_play.h" #include "d/d_kankyo_wether.h" +enum AYUSH_RES_FILE_ID { // IDs and indexes are synced + /* BDLM */ + AYUSH_BDL_AYUSH=0x5, + + /* BTK */ + AYUSH_BTK_AYUSH=0x8, + + /* TEX */ + AYUSH_BTI_B_GSHIP_HATA=0xB, + AYUSH_BTI_B_GSHIP_HO=0xC, +}; + // Needed for .data to match. static f32 dummy1[3] = {1.0f, 1.0f, 1.0f}; static f32 dummy2[3] = {1.0f, 1.0f, 1.0f}; @@ -36,7 +48,7 @@ static BOOL createHeap_CB(fopAc_ac_c* i_this) { /* 00000118-0000032C .text _createHeap__13daGhostship_cFv */ BOOL daGhostship_c::_createHeap() { - J3DModelData* modelData = static_cast(dComIfG_getObjectRes(m_arc_name, 5)); + J3DModelData* modelData = static_cast(dComIfG_getObjectRes(m_arc_name, AYUSH_BDL_AYUSH)); JUT_ASSERT(88, modelData != 0); mpModel = mDoExt_J3DModel__create(modelData, 0, 0x11020203); @@ -44,16 +56,16 @@ BOOL daGhostship_c::_createHeap() { return false; } - J3DAnmTextureSRTKey* btk = static_cast(dComIfG_getObjectRes(m_arc_name, 8)); + J3DAnmTextureSRTKey* btk = static_cast(dComIfG_getObjectRes(m_arc_name, AYUSH_BTK_AYUSH)); JUT_ASSERT(95, btk != 0); if(!mBtk.init(modelData, btk, true, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, 0, -1, false, 0)) { return false; } - ResTIMG* res1 = static_cast(dComIfG_getObjectRes(m_arc_name, 0xB)); - ResTIMG* res2 = static_cast(dComIfG_getObjectRes(m_arc_name, 0xC)); - ResTIMG* res3 = static_cast(dComIfG_getObjectRes(m_cloth_arc_name, 0x3)); + ResTIMG* res1 = static_cast(dComIfG_getObjectRes(m_arc_name, AYUSH_BTI_B_GSHIP_HATA)); + ResTIMG* res2 = static_cast(dComIfG_getObjectRes(m_arc_name, AYUSH_BTI_B_GSHIP_HO)); + ResTIMG* res3 = static_cast(dComIfG_getObjectRes(m_cloth_arc_name, CLOTH_BTI_CLOTHTOON)); mpCloth = dCloth_packetXlu_create(res1, res3, 5, 5, 700.0f, 350.0f, &mTevStr, 0); mpCloth2 = dCloth_packetXlu_create(res2, res3, 6, 6, 1800.0f, 1000.0f, &mTevStr, 0); diff --git a/src/d/actor/d_a_shop_item.cpp b/src/d/actor/d_a_shop_item.cpp index d7de7727a..66ea9b67d 100644 --- a/src/d/actor/d_a_shop_item.cpp +++ b/src/d/actor/d_a_shop_item.cpp @@ -15,6 +15,41 @@ #include "m_Do/m_Do_mtx.h" #include "m_Do/m_Do_lib.h" +enum FDAI_RES_FILE_ID { // IDs and indexes are synced + /* BCK */ + FDAI_BCK_FOBJ00=0x5, + FDAI_BCK_FOBJ01=0x6, + FDAI_BCK_FOBJ02=0x7, + FDAI_BCK_FOBJ05=0x8, + FDAI_BCK_FOBJ06=0x9, + FDAI_BCK_FOBJ07=0xA, + FDAI_BCK_FOBJ08=0xB, + FDAI_BCK_FOBJ09=0xC, + FDAI_BCK_FOBJ10=0xD, + FDAI_BCK_FOBJ11=0xE, + + /* BDL */ + FDAI_BDL_FDAI=0x11, + FDAI_BDL_FOBJ00=0x12, + FDAI_BDL_FOBJ01=0x13, + FDAI_BDL_FOBJ02=0x14, + FDAI_BDL_FOBJ03=0x15, + FDAI_BDL_FOBJ04=0x16, + FDAI_BDL_FOBJ05=0x17, + FDAI_BDL_FOBJ06=0x18, + FDAI_BDL_FOBJ07=0x19, + FDAI_BDL_FOBJ08=0x1A, + FDAI_BDL_FOBJ09=0x1B, + FDAI_BDL_FOBJ10=0x1C, + FDAI_BDL_FOBJ11=0x1D, + + /* TEX */ + FDAI_BTI_FTEX03=0x20, + FDAI_BTI_FTEX04=0x21, + FDAI_BTI_FTEX05=0x22, + FDAI_BTI_FTEX07=0x23, +}; + const char daShopItem_c::m_cloth_arcname[] = "Cloth"; const f32 daShopItem_c::m_cullfar_max = 5000.0f; @@ -62,8 +97,18 @@ void daShopItem_c::CreateInit() { BOOL daShopItem_c::clothCreate() { if(isUseClothPacket(m_itemNo)) { - dCloth_packet_c* (*clothFunc[4])(ResTIMG*, ResTIMG*, dKy_tevstr_c*, cXyz**) = {dClothVobj03_create, dClothVobj04_create, dClothVobj05_create, dClothVobj07_0_create}; - u32 clothRes[4] = {0x20, 0x21, 0x22, 0x23}; + dCloth_packet_c::CreateFunc clothFunc[4] = { + (dCloth_packet_c::CreateFunc)dClothVobj03_create, + (dCloth_packet_c::CreateFunc)dClothVobj04_create, + (dCloth_packet_c::CreateFunc)dClothVobj05_create, + (dCloth_packet_c::CreateFunc)dClothVobj07_0_create + }; + u32 clothRes[4] = { + FDAI_BTI_FTEX03, + FDAI_BTI_FTEX04, + FDAI_BTI_FTEX05, + FDAI_BTI_FTEX07 + }; switch(m_itemNo) { case HEROS_FLAG: @@ -81,7 +126,7 @@ BOOL daShopItem_c::clothCreate() { } ResTIMG* shopArc = (ResTIMG*)dComIfG_getObjectRes(getShopArcname(), clothRes[field_0x648]); - ResTIMG* clothArc = (ResTIMG*)dComIfG_getObjectRes(m_cloth_arcname, 3); + ResTIMG* clothArc = (ResTIMG*)dComIfG_getObjectRes(m_cloth_arcname, CLOTH_BTI_CLOTHTOON); field_0x644 = (*clothFunc[field_0x648])(shopArc, clothArc, &mTevStr, 0); if (field_0x644 == 0) {