From d88158ddc0d14847cce7ea8cfccd0ae214dafc8e Mon Sep 17 00:00:00 2001 From: captainurist <73941350+captainurist@users.noreply.github.com> Date: Mon, 9 Oct 2023 18:05:29 +0900 Subject: [PATCH] Renamings & docs in monster structs --- src/Engine/Events/EventInterpreter.cpp | 2 +- src/Engine/Objects/Actor.h | 2 +- src/Engine/Objects/Monsters.cpp | 2 +- src/Engine/Objects/Monsters.h | 4 ++-- src/Engine/Snapshots/EntitySnapshots.cpp | 4 ++-- src/GUI/GUIWindow.cpp | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Engine/Events/EventInterpreter.cpp b/src/Engine/Events/EventInterpreter.cpp index 98d7479f54b2..7d4a58d69d1c 100644 --- a/src/Engine/Events/EventInterpreter.cpp +++ b/src/Engine/Events/EventInterpreter.cpp @@ -89,7 +89,7 @@ static void spawnMonsters(int16_t typeindex, int16_t level, int count, for (int i = oldNumActors; i < pActors.size(); ++i) { pActors[i].PrepareSprites(0); pActors[i].yawAngle = direction.uYawAngle; - pActors[i].dword_000334_unique_name = uUniqueName; + pActors[i].uniqueNameIndex = uUniqueName; } } } diff --git a/src/Engine/Objects/Actor.h b/src/Engine/Objects/Actor.h index 1e89062afa98..2f466b8d84a4 100644 --- a/src/Engine/Objects/Actor.h +++ b/src/Engine/Objects/Actor.h @@ -237,7 +237,7 @@ class Actor { std::array scheduledJobs; Pid summonerId; Pid lastCharacterIdToHit; - int dword_000334_unique_name = 0; // Index into pMonsterStats->pPlaceStrings for a unique monster name. + int uniqueNameIndex = 0; // Index into pMonsterStats->pUniqueNames for a unique monster name. Regular name is used if this field is 0. bool donebloodsplat{ false }; }; diff --git a/src/Engine/Objects/Monsters.cpp b/src/Engine/Objects/Monsters.cpp index 5fa1f4f14b14..03d14195ee85 100644 --- a/src/Engine/Objects/Monsters.cpp +++ b/src/Engine/Objects/Monsters.cpp @@ -430,7 +430,7 @@ void MonsterStats::InitializePlacements(const Blob &placements) { *tmp_pos = 0; if (temp_str_len) { if (decode_step == 1) - pPlaceStrings[i] = removeQuotes(test_string); + pUniqueNames[i] = removeQuotes(test_string); } else { break_loop = true; } diff --git a/src/Engine/Objects/Monsters.h b/src/Engine/Objects/Monsters.h index 4a55c8ea6988..3c69b4902e0b 100644 --- a/src/Engine/Objects/Monsters.h +++ b/src/Engine/Objects/Monsters.h @@ -84,8 +84,8 @@ struct MonsterStats { void InitializePlacements(const Blob &placements); MonsterId FindMonsterByTextureName(const std::string &Str2); - IndexedArray pInfos; // 0 - 5b18h - std::array pPlaceStrings; // 5B18h placement counts from 1 + IndexedArray pInfos; + std::array pUniqueNames; // Names of unique monsters, see Actor::uniqueNameIndex. Element 0 is unused. }; struct MonsterDesc { diff --git a/src/Engine/Snapshots/EntitySnapshots.cpp b/src/Engine/Snapshots/EntitySnapshots.cpp index 38b38445c4a0..41bcf46b82ed 100644 --- a/src/Engine/Snapshots/EntitySnapshots.cpp +++ b/src/Engine/Snapshots/EntitySnapshots.cpp @@ -1230,7 +1230,7 @@ void snapshot(const Actor &src, Actor_MM7 *dst) { dst->uSummonerID = src.summonerId.packed(); dst->uLastCharacterIDToHit = src.lastCharacterIdToHit.packed(); - dst->dword_000334_unique_name = src.dword_000334_unique_name; + dst->dword_000334_unique_name = src.uniqueNameIndex; } void reconstruct(const Actor_MM7 &src, Actor *dst) { @@ -1324,7 +1324,7 @@ void reconstruct(const Actor_MM7 &src, Actor *dst) { dst->summonerId = Pid::fromPacked(src.uSummonerID); dst->lastCharacterIdToHit = Pid::fromPacked(src.uLastCharacterIDToHit); - dst->dword_000334_unique_name = src.dword_000334_unique_name; + dst->uniqueNameIndex = src.dword_000334_unique_name; } void snapshot(const BLVDoor &src, BLVDoor_MM7 *dst) { diff --git a/src/GUI/GUIWindow.cpp b/src/GUI/GUIWindow.cpp index da26926ec3e9..be27aaad4fbe 100644 --- a/src/GUI/GUIWindow.cpp +++ b/src/GUI/GUIWindow.cpp @@ -1319,8 +1319,8 @@ std::string NameAndTitle(NPCData *npc) { std::string GetDisplayName(Actor *actor) { - if (actor->dword_000334_unique_name) - return pMonsterStats->pPlaceStrings[actor->dword_000334_unique_name]; + if (actor->uniqueNameIndex) + return pMonsterStats->pUniqueNames[actor->uniqueNameIndex]; else return pMonsterStats->pInfos[actor->monsterInfo.uID].pName; }