Skip to content

Commit

Permalink
Docs & renamings
Browse files Browse the repository at this point in the history
  • Loading branch information
captainurist committed Feb 9, 2025
1 parent 1d6d748 commit 6ebd5c0
Show file tree
Hide file tree
Showing 32 changed files with 436 additions and 432 deletions.
4 changes: 2 additions & 2 deletions src/Application/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ bool Game::loop() {
break;
}

pParty->pPickedItem.uItemID = ITEM_NULL;
pParty->pPickedItem.itemId = ITEM_NULL;

engine->_transitionMapId = pMapStats->GetMapInfo(_config->gameplay.StartingMap.value());

Expand Down Expand Up @@ -538,7 +538,7 @@ void Game::processQueuedMessages() {
AfterEnchClickEventTimeout = 0_ticks;
}
if (ptr_50C9A4_ItemToEnchant &&
ptr_50C9A4_ItemToEnchant->uItemID != ITEM_NULL) {
ptr_50C9A4_ItemToEnchant->itemId != ITEM_NULL) {
ptr_50C9A4_ItemToEnchant->uAttributes &= ~ITEM_ENCHANT_ANIMATION_MASK;
ItemEnchantmentTimer = 0_ticks;
ptr_50C9A4_ItemToEnchant = nullptr;
Expand Down
18 changes: 9 additions & 9 deletions src/Engine/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -917,8 +917,8 @@ void Engine::_461103_load_level_sub() {
pCamera3D->_viewPitch = 0;
pCamera3D->_viewYaw = 0;
uLevel_StartingPointType = MAP_START_POINT_PARTY;
if (pParty->pPickedItem.uItemID != ITEM_NULL)
mouse->SetCursorBitmapFromItemID(pParty->pPickedItem.uItemID);
if (pParty->pPickedItem.itemId != ITEM_NULL)
mouse->SetCursorBitmapFromItemID(pParty->pPickedItem.itemId);
}

//----- (0042F3D6) --------------------------------------------------------
Expand Down Expand Up @@ -1375,22 +1375,22 @@ void RegeneratePartyHealthMana() {
if (character.HasItemEquipped(idx)) {
unsigned _idx = character.pEquipment[idx];
ItemGen equppedItem = character.pInventoryItemList[_idx - 1];
if (!isRegular(equppedItem.uItemID)) {
if (equppedItem.uItemID == ITEM_RELIC_ETHRICS_STAFF) {
if (!isRegular(equppedItem.itemId)) {
if (equppedItem.itemId == ITEM_RELIC_ETHRICS_STAFF) {
character.health -= ticks5;
}
if (equppedItem.uItemID == ITEM_ARTIFACT_HERMES_SANDALS) {
if (equppedItem.itemId == ITEM_ARTIFACT_HERMES_SANDALS) {
thisChar.hpRegen++;
thisChar.spRegen++;
}
if (equppedItem.uItemID == ITEM_ARTIFACT_MINDS_EYE) {
if (equppedItem.itemId == ITEM_ARTIFACT_MINDS_EYE) {
thisChar.spRegen++;
}
if (equppedItem.uItemID == ITEM_ARTIFACT_HEROS_BELT) {
if (equppedItem.itemId == ITEM_ARTIFACT_HEROS_BELT) {
thisChar.hpRegen++;
}
} else {
ItemEnchantment special_enchantment = equppedItem.special_enchantment;
ItemEnchantment special_enchantment = equppedItem.specialEnchantment;
if (special_enchantment == ITEM_ENCHANTMENT_OF_REGENERATION
|| special_enchantment == ITEM_ENCHANTMENT_OF_LIFE
|| special_enchantment == ITEM_ENCHANTMENT_OF_PHOENIX
Expand Down Expand Up @@ -1426,7 +1426,7 @@ void RegeneratePartyHealthMana() {
if (character.classType == CLASS_LICH) {
bool lich_has_jar = false;
for (const ItemGen &item : character.pInventoryItemList)
if (item.uItemID == ITEM_QUEST_LICH_JAR_FULL && item.uHolderPlayer == character.getCharacterIndex())
if (item.itemId == ITEM_QUEST_LICH_JAR_FULL && item.uHolderPlayer == character.getCharacterIndex())
lich_has_jar = true;

if (lich_has_jar) {
Expand Down
2 changes: 1 addition & 1 deletion src/Engine/Evt/EvtInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ int EvtInterpreter::executeOneEvent(int step, bool isNpc) {
item.Reset();
pItemTable->generateItem(ir.data.give_item_descr.treasure_level, ir.data.give_item_descr.treasure_type, &item);
if (ir.data.give_item_descr.item_id != ITEM_NULL) {
item.uItemID = ir.data.give_item_descr.item_id;
item.itemId = ir.data.give_item_descr.item_id;
}
pParty->setHoldingItem(&item);
break;
Expand Down
12 changes: 6 additions & 6 deletions src/Engine/Graphics/Indoor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1039,9 +1039,9 @@ void loadAndPrepareBLV(MapId mapid, bool bLoading) {

for (int i = 0; i < pSpriteObjects.size(); ++i) {
if (pSpriteObjects[i].uObjectDescID) {
if (pSpriteObjects[i].containing_item.uItemID != ITEM_NULL) {
if (pSpriteObjects[i].containing_item.uItemID != ITEM_POTION_BOTTLE &&
pItemTable->pItems[pSpriteObjects[i].containing_item.uItemID].uEquipType == ITEM_TYPE_POTION &&
if (pSpriteObjects[i].containing_item.itemId != ITEM_NULL) {
if (pSpriteObjects[i].containing_item.itemId != ITEM_POTION_BOTTLE &&
pItemTable->pItems[pSpriteObjects[i].containing_item.itemId].uEquipType == ITEM_TYPE_POTION &&
!pSpriteObjects[i].containing_item.potionPower)
pSpriteObjects[i].containing_item.potionPower = grng->random(15) + 5;
pItemTable->SetSpecialBonus(&pSpriteObjects[i].containing_item);
Expand Down Expand Up @@ -1986,7 +1986,7 @@ int SpawnEncounterMonsters(MapInfo *map_info, int enc_index) {
int DropTreasureAt(ItemTreasureLevel trs_level, RandomItemType trs_type, Vec3f pos, uint16_t facing) {
SpriteObject a1;
pItemTable->generateItem(trs_level, trs_type, &a1.containing_item);
a1.uType = pItemTable->pItems[a1.containing_item.uItemID].uSpriteID;
a1.uType = pItemTable->pItems[a1.containing_item.itemId].uSpriteID;
a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType);
a1.vPosition = pos;
a1.uFacing = facing;
Expand Down Expand Up @@ -2019,12 +2019,12 @@ void SpawnRandomTreasure(MapInfo *mapInfo, SpawnPoint *a2) {
}

a1a.containing_item.generateGold(a2->uItemIndex);
a1a.uType = pItemTable->pItems[a1a.containing_item.uItemID].uSpriteID;
a1a.uType = pItemTable->pItems[a1a.containing_item.itemId].uSpriteID;
a1a.uObjectDescID = pObjectList->ObjectIDByItemID(a1a.uType);
} else {
if (!a1a.containing_item.GenerateArtifact())
return;
a1a.uType = pItemTable->pItems[a1a.containing_item.uItemID].uSpriteID;
a1a.uType = pItemTable->pItems[a1a.containing_item.itemId].uSpriteID;
a1a.uObjectDescID = pObjectList->ObjectIDByItemID(a1a.uType);
a1a.containing_item.Reset(); // TODO(captainurist): this needs checking
}
Expand Down
6 changes: 3 additions & 3 deletions src/Engine/Graphics/Outdoor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,9 +628,9 @@ void OutdoorLocation::ArrangeSpriteObjects() {
if (!(pSpriteObjects[i].uAttributes & SPRITE_DROPPED_BY_PLAYER) && !pSpriteObjects[i].IsUnpickable()) {
pSpriteObjects[i].vPosition.z = pOutdoor->pTerrain.heightByPos(pSpriteObjects[i].vPosition);
}
if (pSpriteObjects[i].containing_item.uItemID != ITEM_NULL) {
if (pSpriteObjects[i].containing_item.uItemID != ITEM_POTION_BOTTLE &&
pItemTable->pItems[pSpriteObjects[i].containing_item.uItemID].uEquipType == ITEM_TYPE_POTION &&
if (pSpriteObjects[i].containing_item.itemId != ITEM_NULL) {
if (pSpriteObjects[i].containing_item.itemId != ITEM_POTION_BOTTLE &&
pItemTable->pItems[pSpriteObjects[i].containing_item.itemId].uEquipType == ITEM_TYPE_POTION &&
!pSpriteObjects[i].containing_item.potionPower)
pSpriteObjects[i].containing_item.potionPower = grng->random(15) + 5;
pItemTable->SetSpecialBonus(&pSpriteObjects[i].containing_item);
Expand Down
16 changes: 8 additions & 8 deletions src/Engine/Graphics/Viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,20 +217,20 @@ void ViewingParams::_443365() {
}

void ItemInteraction(unsigned int item_id) {
if (pItemTable->pItems[pSpriteObjects[item_id].containing_item.uItemID].uEquipType == ITEM_TYPE_GOLD) {
if (pItemTable->pItems[pSpriteObjects[item_id].containing_item.itemId].uEquipType == ITEM_TYPE_GOLD) {
pParty->partyFindsGold(pSpriteObjects[item_id].containing_item.goldAmount, GOLD_RECEIVE_SHARE);
} else {
if (pParty->pPickedItem.uItemID != ITEM_NULL) {
if (pParty->pPickedItem.itemId != ITEM_NULL) {
return;
}

engine->_statusBar->setEvent(LSTR_FMT_YOU_FOUND_ITEM, pItemTable->pItems[pSpriteObjects[item_id].containing_item.uItemID].pUnidentifiedName);
engine->_statusBar->setEvent(LSTR_FMT_YOU_FOUND_ITEM, pItemTable->pItems[pSpriteObjects[item_id].containing_item.itemId].pUnidentifiedName);

// TODO: WTF? 184 / 185 qbits are associated with Tatalia's Mercenery Guild Harmondale raids. Are these about castle's tapestries ?
if (pSpriteObjects[item_id].containing_item.uItemID == ITEM_ARTIFACT_SPLITTER) {
if (pSpriteObjects[item_id].containing_item.itemId == ITEM_ARTIFACT_SPLITTER) {
pParty->_questBits.set(QBIT_SPLITTER_FOUND);
}
if (pSpriteObjects[item_id].containing_item.uItemID == ITEM_SPELLBOOK_REMOVE_FEAR) {
if (pSpriteObjects[item_id].containing_item.itemId == ITEM_SPELLBOOK_REMOVE_FEAR) {
pParty->_questBits.set(QBIT_REMOVE_FEAR_FOUND);
}
if (!pParty->addItemToParty(&pSpriteObjects[item_id].containing_item)) {
Expand Down Expand Up @@ -331,7 +331,7 @@ void Engine::onGameViewportClick() {
pParty->activeCharacter().uQuickSpell != SPELL_NONE &&
IsSpellQuickCastableOnShiftClick(pParty->activeCharacter().uQuickSpell)) {
engine->_messageQueue->addMessageCurrentFrame(UIMSG_CastQuickSpell, 0, 0);
} else if (pParty->pPickedItem.uItemID != ITEM_NULL) {
} else if (pParty->pPickedItem.itemId != ITEM_NULL) {
pParty->dropHeldItem();
} else {
pAudioPlayer->playUISound(SOUND_error);
Expand All @@ -353,7 +353,7 @@ void Engine::onGameViewportClick() {

if (uCurrentlyLoadedLevelType == LEVEL_INDOOR) {
if (!pIndoor->pFaces[pid.id()].Clickable()) {
if (pParty->pPickedItem.uItemID == ITEM_NULL) {
if (pParty->pPickedItem.itemId == ITEM_NULL) {
engine->_statusBar->nothingHere();
} else {
pParty->dropHeldItem();
Expand All @@ -365,7 +365,7 @@ void Engine::onGameViewportClick() {
} else if (uCurrentlyLoadedLevelType == LEVEL_OUTDOOR) {
const ODMFace &model = pOutdoor->face(pid);
if (!model.Clickable()) {
if (pParty->pPickedItem.uItemID == ITEM_NULL) {
if (pParty->pPickedItem.itemId == ITEM_NULL) {
engine->_statusBar->nothingHere();
} else {
pParty->dropHeldItem();
Expand Down
46 changes: 23 additions & 23 deletions src/Engine/Objects/Actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,16 @@ void Actor::giveItem(signed int uActorID, ItemId uItemID, unsigned int bGive) {
if (bGive) {
if (pActors[uActorID].carriedItemId == ITEM_NULL)
pActors[uActorID].carriedItemId = uItemID;
else if (pActors[uActorID].items[0].uItemID == ITEM_NULL)
pActors[uActorID].items[0].uItemID = uItemID;
else if (pActors[uActorID].items[1].uItemID == ITEM_NULL)
pActors[uActorID].items[1].uItemID = uItemID;
else if (pActors[uActorID].items[0].itemId == ITEM_NULL)
pActors[uActorID].items[0].itemId = uItemID;
else if (pActors[uActorID].items[1].itemId == ITEM_NULL)
pActors[uActorID].items[1].itemId = uItemID;
} else {
if (pActors[uActorID].carriedItemId == uItemID)
pActors[uActorID].carriedItemId = ITEM_NULL;
else if (pActors[uActorID].items[0].uItemID == uItemID)
else if (pActors[uActorID].items[0].itemId == uItemID)
pActors[uActorID].items[0].Reset();
else if (pActors[uActorID].items[1].uItemID == uItemID)
else if (pActors[uActorID].items[1].itemId == uItemID)
pActors[uActorID].items[1].Reset();
}
}
Expand Down Expand Up @@ -193,11 +193,11 @@ void Actor::SetRandomGoldIfTheresNoItem() {
int v2; // edi@1

v2 = 0;
if (this->items[3].uItemID == ITEM_NULL) {
if (this->items[3].itemId == ITEM_NULL) {
if (this->monsterInfo.goldDiceRolls) {
v2 = grng->randomDice(this->monsterInfo.goldDiceRolls, this->monsterInfo.goldDiceSides);
if (v2) {
this->items[3].uItemID = ITEM_GOLD_SMALL;
this->items[3].itemId = ITEM_GOLD_SMALL;
this->items[3].goldAmount = v2;
}
}
Expand Down Expand Up @@ -1836,10 +1836,10 @@ void Actor::Die(unsigned int uActorID) {

ItemGen drop;
drop.Reset();
drop.uItemID = itemDropForMonsterType(monsterTypeForMonsterId(actor->monsterInfo.id));
drop.itemId = itemDropForMonsterType(monsterTypeForMonsterId(actor->monsterInfo.id));

if (grng->random(100) < 20 && drop.uItemID != ITEM_NULL) {
SpriteObject::dropItemAt(pItemTable->pItems[drop.uItemID].uSpriteID,
if (grng->random(100) < 20 && drop.itemId != ITEM_NULL) {
SpriteObject::dropItemAt(pItemTable->pItems[drop.itemId].uSpriteID,
actor->pos + Vec3f(0, 0, 16), grng->random(200) + 200, 1, true, 0, &drop);
}

Expand Down Expand Up @@ -3144,8 +3144,8 @@ int Actor::DamageMonsterFromParty(Pid a1, unsigned int uActorID_Monster, const V
if (pMonster->buffs[ACTOR_BUFF_SHIELD].Active())
uDamageAmount /= 2;
IsAdditionalDamagePossible = true;
if (projectileSprite->containing_item.uItemID != ITEM_NULL &&
projectileSprite->containing_item.special_enchantment == ITEM_ENCHANTMENT_OF_CARNAGE) {
if (projectileSprite->containing_item.itemId != ITEM_NULL &&
projectileSprite->containing_item.specialEnchantment == ITEM_ENCHANTMENT_OF_CARNAGE) {
attackElement = DAMAGE_FIRE;
} else if (!character->characterHitOrMiss(pMonster, v61, skillLevel)) {
character->playReaction(SPEECH_ATTACK_MISS);
Expand Down Expand Up @@ -3574,30 +3574,30 @@ void Actor::LootActor() {
}
if (this->carriedItemId != ITEM_NULL) {
Dst.Reset();
Dst.uItemID = this->carriedItemId;
Dst.itemId = this->carriedItemId;

StatusBarItemFound(foundGold, pItemTable->pItems[Dst.uItemID].pUnidentifiedName);
StatusBarItemFound(foundGold, pItemTable->pItems[Dst.itemId].pUnidentifiedName);

if (Dst.isWand()) {
Dst.uNumCharges = grng->random(6) + Dst.GetDamageMod() + 1;
Dst.uMaxCharges = Dst.uNumCharges;
}
if (Dst.isPotion() && Dst.uItemID != ITEM_POTION_BOTTLE) {
if (Dst.isPotion() && Dst.itemId != ITEM_POTION_BOTTLE) {
Dst.potionPower = 2 * grng->random(4) + 2;
}
pItemTable->SetSpecialBonus(&Dst);
if (!pParty->addItemToParty(&Dst)) {
pParty->setHoldingItem(&Dst);
}
this->carriedItemId = ITEM_NULL;
if (this->items[0].uItemID != ITEM_NULL) {
if (this->items[0].itemId != ITEM_NULL) {
if (!pParty->addItemToParty(&this->items[0])) {
pParty->placeHeldItemInInventoryOrDrop();
pParty->setHoldingItem(&this->items[0]);
}
this->items[0].Reset();
}
if (this->items[1].uItemID != ITEM_NULL) {
if (this->items[1].itemId != ITEM_NULL) {
if (!pParty->addItemToParty(&this->items[1])) {
pParty->placeHeldItemInInventoryOrDrop();
pParty->setHoldingItem(&this->items[1]);
Expand All @@ -3608,11 +3608,11 @@ void Actor::LootActor() {
return;
}
if (this->ActorHasItem()) {
if (this->items[3].uItemID != ITEM_NULL) {
if (this->items[3].itemId != ITEM_NULL) {
Dst = this->items[3];
this->items[3].Reset();

StatusBarItemFound(foundGold, pItemTable->pItems[Dst.uItemID].pUnidentifiedName);
StatusBarItemFound(foundGold, pItemTable->pItems[Dst.itemId].pUnidentifiedName);

if (!pParty->addItemToParty(&Dst)) {
pParty->setHoldingItem(&Dst);
Expand All @@ -3623,23 +3623,23 @@ void Actor::LootActor() {
if (grng->random(100) < this->monsterInfo.treasureDropChance && this->monsterInfo.treasureLevel != ITEM_TREASURE_LEVEL_INVALID) {
pItemTable->generateItem(this->monsterInfo.treasureLevel, this->monsterInfo.treasureType, &Dst);

StatusBarItemFound(foundGold, pItemTable->pItems[Dst.uItemID].pUnidentifiedName);
StatusBarItemFound(foundGold, pItemTable->pItems[Dst.itemId].pUnidentifiedName);

if (!pParty->addItemToParty(&Dst)) {
pParty->setHoldingItem(&Dst);
}
itemFound = true;
}
}
if (this->items[0].uItemID != ITEM_NULL) {
if (this->items[0].itemId != ITEM_NULL) {
if (!pParty->addItemToParty(&this->items[0])) {
pParty->placeHeldItemInInventoryOrDrop();
pParty->setHoldingItem(&this->items[0]);
itemFound = true;
}
this->items[0].Reset();
}
if (this->items[1].uItemID != ITEM_NULL) {
if (this->items[1].itemId != ITEM_NULL) {
if (!pParty->addItemToParty(&this->items[1])) {
pParty->placeHeldItemInInventoryOrDrop();
pParty->setHoldingItem(&this->items[1]);
Expand Down
Loading

0 comments on commit 6ebd5c0

Please sign in to comment.