Skip to content

Commit

Permalink
Renamings & docs in monster structs
Browse files Browse the repository at this point in the history
  • Loading branch information
captainurist committed Oct 9, 2023
1 parent 7647bc7 commit d88158d
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Engine/Events/EventInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Engine/Objects/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class Actor {
std::array<ActorJob, 8> 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 };
};

Expand Down
2 changes: 1 addition & 1 deletion src/Engine/Objects/Monsters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Engine/Objects/Monsters.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ struct MonsterStats {
void InitializePlacements(const Blob &placements);
MonsterId FindMonsterByTextureName(const std::string &Str2);

IndexedArray<MonsterInfo, MONSTER_FIRST, MONSTER_LAST> pInfos; // 0 - 5b18h
std::array<std::string, 31> pPlaceStrings; // 5B18h placement counts from 1
IndexedArray<MonsterInfo, MONSTER_FIRST, MONSTER_LAST> pInfos;
std::array<std::string, 31> pUniqueNames; // Names of unique monsters, see Actor::uniqueNameIndex. Element 0 is unused.
};

struct MonsterDesc {
Expand Down
4 changes: 2 additions & 2 deletions src/Engine/Snapshots/EntitySnapshots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/GUI/GUIWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit d88158d

Please sign in to comment.