diff options
| author | roeming <brother64youyou@gmail.com> | 2026-03-15 21:06:16 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-15 18:06:16 -0700 |
| commit | ae0f8909a6ad9d1df2cf247a2538ff658d6e49c0 (patch) | |
| tree | a7e3efe8f8230158d77ccebf2b635995b54138e5 | |
| parent | bc9bf9d06227a2db4dd18e880dd00209b62a59de (diff) | |
convert `daPasserMng_c::mGroupTbl` underlying data from bytes to `daPasserMng_c::Group` (#3129)
* daPasserMng_c::mGroupTbl underlying data to daPasserMng_c::Group
* move over to const groups
* templated solution that works on modern compilers + mwcc
---------
Co-authored-by: roeming <roeming@users.noreply.github.com>
| -rw-r--r-- | include/d/actor/d_a_passer_mng.h | 3 | ||||
| -rw-r--r-- | src/d/actor/d_a_passer_mng.cpp | 47 |
2 files changed, 29 insertions, 21 deletions
diff --git a/include/d/actor/d_a_passer_mng.h b/include/d/actor/d_a_passer_mng.h index aa2a55c00f..981eff33b9 100644 --- a/include/d/actor/d_a_passer_mng.h +++ b/include/d/actor/d_a_passer_mng.h @@ -251,12 +251,13 @@ public: return paramLow << 8; } + // SizedGroup in d_a_passer_mng.cpp relies on this layout, any changes here should also be changed there struct Group { u8 field_0x00; int field_0x04[0]; }; - static Group* mGroupTbl[4]; + static const Group* mGroupTbl[4]; private: /* 0x568 */ fpc_ProcID* childProcIds; diff --git a/src/d/actor/d_a_passer_mng.cpp b/src/d/actor/d_a_passer_mng.cpp index b83c96a319..55a191ebe2 100644 --- a/src/d/actor/d_a_passer_mng.cpp +++ b/src/d/actor/d_a_passer_mng.cpp @@ -38,33 +38,40 @@ int daPasserMng_c::execute() { return 1; } -static u8 const groupA[32] = { - 0x07, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x04, 0x50, 0x00, 0x00, 0x06, 0x01, 0x00, 0x00, 0x07, - 0x01, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x1B, 0x01, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x1D, +// this is based off of daPasserMng_c::Group, any changes here should also be changed there +template <int N> +struct SizedGroup { + u8 field_0x00; + int field_0x04[N]; }; -static u8 const groupB[36] = { - 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x11, - 0x11, 0x00, 0x00, 0x12, 0x10, 0x00, 0x00, 0x13, 0x40, 0x00, 0x00, 0x09, - 0x40, 0x00, 0x00, 0x08, 0x50, 0x00, 0x00, 0x0A, 0x01, 0x00, 0x00, 0x0B, +static SizedGroup<7> const groupA = { + 7, + {0x11000004, 0x50000006, 0x01000007, 0x01000005, 0x0100001B, 0x0100001C, 0x0000001D}, }; -static u8 const groupC[36] = { - 0x08, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x01, - 0x50, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x03, 0x21, 0x00, 0x00, 0x17, - 0x10, 0x00, 0x00, 0x18, 0x01, 0x00, 0x00, 0x19, 0x10, 0x00, 0x00, 0x1A, +static SizedGroup<8> const groupB = { + 8, + {0x01000010, 0x10000011, 0x11000012, 0x10000013, 0x40000009, 0x40000008, 0x5000000A, + 0x0100000B}, }; -static u8 const groupD[32] = { - 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x14, 0x21, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x16, - 0x11, 0x00, 0x00, 0x0C, 0x50, 0x00, 0x00, 0x0E, 0x40, 0x00, 0x00, 0x0F, 0x01, 0x00, 0x00, 0x0D, +static SizedGroup<8> const groupC = { + 8, + {0x11000000, 0x11000001, 0x50000002, 0x01000003, 0x21000017, 0x10000018, 0x01000019, + 0x1000001A}, }; -daPasserMng_c::Group* daPasserMng_c::mGroupTbl[4] = { - (Group*)groupA, - (Group*)groupB, - (Group*)groupC, - (Group*)groupD, +static SizedGroup<7> const groupD = { + 7, + {0x01000014, 0x21000015, 0x00000016, 0x1100000C, 0x5000000E, 0x4000000F, 0x0100000D}, +}; + +const daPasserMng_c::Group* daPasserMng_c::mGroupTbl[4] = { + (const Group*)&groupA, + (const Group*)&groupB, + (const Group*)&groupC, + (const Group*)&groupD, }; int daPasserMng_c::getPasserParam() { @@ -84,7 +91,7 @@ int daPasserMng_c::getPasserParam() { } else { groupInd = 0; } - Group* pGroup = mGroupTbl[groupInd]; + const Group* pGroup = mGroupTbl[groupInd]; int iVar5; do { iVar5 = cLib_getRndValue(0, (int)pGroup->field_0x00); |
