diff options
author | Bendegúz Nagy | 2016-08-26 22:20:42 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | 2a2a9a53b0b6dbd0cb18104b2603b3f7968f9d74 (patch) | |
tree | 272a97d575c65f0932b8c779b830acdfeaa6ad21 | |
parent | 0e0fb9763220f0949925fe8d5c6e0dcbd2a15b14 (diff) | |
download | scummvm-rg350-2a2a9a53b0b6dbd0cb18104b2603b3f7968f9d74.tar.gz scummvm-rg350-2a2a9a53b0b6dbd0cb18104b2603b3f7968f9d74.tar.bz2 scummvm-rg350-2a2a9a53b0b6dbd0cb18104b2603b3f7968f9d74.zip |
DM: Add champion reset, fix ChampionMan::addCandidateChampionToPart while loop condition
-rw-r--r-- | engines/dm/champion.cpp | 6 | ||||
-rw-r--r-- | engines/dm/champion.h | 21 |
2 files changed, 24 insertions, 3 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index 1ef0e8a81d..ec098ee137 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -100,9 +100,9 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) { uint16 prevChampCount = _partyChampionCount; Champion *champ = &_champions[prevChampCount]; - warning("MISSING CODE: Fill champ memory with zero bytes"); + champ->resetToZero(); dispMan._useByteBoxCoordinates = true; - { // block on purpose + { // limit destBox scope Box &destBox = gBoxChampionPortrait; dispMan.blitToBitmap(dispMan.getBitmap(kChampionPortraitsIndice), 256, getChampionPortraitX(championPortraitIndex), getChampionPortraitY(championPortraitIndex), champ->_portrait, 32, destBox._x1, destBox._x2, destBox._y1, destBox._y2, kColorNoTransparency); @@ -207,7 +207,7 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) { thing = dunMan.getSquareFirstThing(mapX, mapY); AL_0_slotIndex_Red = kChampionSlotBackpackLine_1_1; uint16 slotIndex_Green; - while (thing != Thing::_thingNone) { + while (thing != Thing::_thingEndOfList) { ThingType AL_2_thingType = thing.getType(); if ((AL_2_thingType > kSensorThingType) && (thing.getCell() == championObjectsCell)) { int16 objectAllowedSlots = gObjectInfo[dunMan.getObjectInfoIndex(thing)].getAllowedSlots(); diff --git a/engines/dm/champion.h b/engines/dm/champion.h index 96a5ef563a..a3c6f80773 100644 --- a/engines/dm/champion.h +++ b/engines/dm/champion.h @@ -254,6 +254,8 @@ class Skill { public: int16 _temporaryExperience; int32 _experience; + + void resetToZero() { _temporaryExperience = _experience = 0; } }; // @ SKILL class Champion { @@ -318,6 +320,25 @@ public: } } void clearWounds() { _wounds = kChampionWoundNone; } + void resetToZero() { // oh boy > . < + for (int16 i = 0; i < 30; ++i) + _slots[i] = Thing::_thingNone; + for (int16 i = 0; i < 20; ++i) + _skills[i].resetToZero(); + _attributes = _wounds = 0; + memset(_statistics, 0, 7 * 3); + memset(_name, '\0', 8); + memset(_title, '\0', 20); + _dir = kDirNorth; + _cell = kViewCellFronLeft; + _actionIndex = kChampionActionN; + _symbolStep = 0; + memset(_symbols, '\0', 5); + _directionMaximumDamageReceived = _maximumDamageReceived = _poisonEventCount = _enableActionEventIndex = 0; + _hideDamageReceivedIndex = _currHealth = _maxHealth = _currStamina = _maxStamina = _currMana = _maxMana = 0; + _actionDefense = _food = _water = _load = _shieldDefense = 0; + memset(_portrait, 0, 464); + } }; // @ CHAMPION_INCLUDING_PORTRAIT class ChampionMan { |