aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/cloud/onedrive/onedrivestorage.cpp2
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.cpp11
-rw-r--r--backends/saves/default/default-saves.cpp13
-rw-r--r--engines/adl/adl.cpp2
-rw-r--r--engines/adl/detection.cpp6
-rw-r--r--engines/adl/hires4.cpp2
-rw-r--r--engines/dm/champion.cpp150
-rw-r--r--engines/dm/dialog.cpp118
-rw-r--r--engines/dm/dm.cpp117
-rw-r--r--engines/dm/dm.h3
-rw-r--r--engines/dm/dungeonman.cpp2
-rw-r--r--engines/dm/eventman.cpp80
-rw-r--r--engines/dm/eventman.h2
-rw-r--r--engines/dm/gfx.cpp650
-rw-r--r--engines/dm/gfx.h390
-rw-r--r--engines/dm/group.cpp284
-rw-r--r--engines/dm/group.h148
-rw-r--r--engines/dm/inventory.cpp122
-rw-r--r--engines/dm/inventory.h24
-rw-r--r--engines/dm/loadsave.cpp36
-rw-r--r--engines/dm/menus.cpp110
-rw-r--r--engines/dm/movesens.cpp71
-rw-r--r--engines/dm/movesens.h4
-rw-r--r--engines/dm/objectman.cpp18
-rw-r--r--engines/dm/objectman.h1
-rw-r--r--engines/dm/projexpl.cpp22
-rw-r--r--engines/dm/sounds.h7
-rw-r--r--engines/dm/text.cpp23
-rw-r--r--engines/dm/text.h2
-rw-r--r--engines/dm/timeline.cpp10
-rw-r--r--engines/fullpipe/gameloader.cpp10
-rw-r--r--engines/fullpipe/gameloader.h10
-rw-r--r--engines/fullpipe/interaction.cpp6
-rw-r--r--engines/fullpipe/inventory.cpp11
-rw-r--r--engines/fullpipe/inventory.h1
-rw-r--r--engines/fullpipe/lift.cpp6
-rw-r--r--engines/fullpipe/module.mk1
-rw-r--r--engines/fullpipe/motion.cpp5
-rw-r--r--engines/fullpipe/objects.h2
-rw-r--r--engines/fullpipe/scenes/scene04.cpp4
-rw-r--r--engines/fullpipe/scenes/scene16.cpp2
-rw-r--r--engines/fullpipe/scenes/scene18and19.cpp2
-rw-r--r--engines/fullpipe/scenes/scene25.cpp2
-rw-r--r--engines/fullpipe/scenes/scene28.cpp19
-rw-r--r--engines/fullpipe/scenes/scene34.cpp2
-rw-r--r--engines/fullpipe/scenes/scene35.cpp4
-rw-r--r--engines/fullpipe/stateloader.cpp15
-rw-r--r--engines/fullpipe/statesaver.cpp161
-rw-r--r--engines/fullpipe/statics.cpp8
-rw-r--r--engines/fullpipe/utils.cpp51
-rw-r--r--engines/fullpipe/utils.h35
-rw-r--r--engines/sci/engine/script_patches.cpp31
-rw-r--r--engines/sherlock/debugger.cpp23
-rw-r--r--engines/sherlock/debugger.h5
-rw-r--r--engines/titanic/core/dont_save_file_item.h5
-rw-r--r--engines/titanic/star_control/fpoint.cpp9
-rw-r--r--engines/titanic/star_control/fpoint.h19
-rw-r--r--engines/xeen/combat.cpp11
-rw-r--r--engines/xeen/debugger.cpp31
-rw-r--r--engines/xeen/debugger.h1
-rw-r--r--engines/xeen/dialogs_char_info.cpp8
-rw-r--r--engines/xeen/dialogs_items.cpp7
-rw-r--r--engines/xeen/dialogs_options.cpp5
-rw-r--r--engines/xeen/dialogs_quests.cpp2
-rw-r--r--engines/xeen/dialogs_spells.cpp10
-rw-r--r--engines/xeen/files.cpp60
-rw-r--r--engines/xeen/files.h40
-rw-r--r--engines/xeen/interface.cpp20
-rw-r--r--engines/xeen/map.cpp12
-rw-r--r--engines/xeen/music.cpp262
-rw-r--r--engines/xeen/music.h47
-rw-r--r--engines/xeen/screen.cpp2
-rw-r--r--engines/xeen/scripts.cpp5
-rw-r--r--engines/xeen/sound.cpp56
-rw-r--r--engines/xeen/sound.h55
-rw-r--r--engines/xeen/sprites.cpp4
-rw-r--r--engines/xeen/sprites.h3
-rw-r--r--engines/xeen/town.cpp98
-rw-r--r--engines/xeen/worldofxeen/darkside_cutscenes.cpp42
-rw-r--r--engines/xeen/worldofxeen/worldofxeen.cpp2
-rw-r--r--engines/xeen/xeen.cpp18
-rw-r--r--engines/xeen/xeen.h2
-rw-r--r--gui/themes/translations.datbin582141 -> 587437 bytes
-rwxr-xr-x[-rw-r--r--]po/hu_HU.po2
-rw-r--r--po/nl_NL.po161
-rw-r--r--po/uk_UA.po216
86 files changed, 2305 insertions, 1756 deletions
diff --git a/backends/cloud/onedrive/onedrivestorage.cpp b/backends/cloud/onedrive/onedrivestorage.cpp
index 3ffdcc67f8..8799f3d69f 100644
--- a/backends/cloud/onedrive/onedrivestorage.cpp
+++ b/backends/cloud/onedrive/onedrivestorage.cpp
@@ -196,7 +196,7 @@ void OneDriveStorage::infoInnerCallback(StorageInfoCallback outerCallback, Netwo
Common::JSONObject info = json->asObject();
Common::String uid, name, email;
- uint64 quotaUsed = 0, quotaAllocated = 26843545600L; // 25 GB, because I actually don't know any way to find out the real one
+ uint64 quotaUsed = 0, quotaAllocated = 26843545600LL; // 25 GB, because I actually don't know any way to find out the real one
if (Networking::CurlJsonRequest::jsonContainsObject(info, "createdBy", "OneDriveStorage::infoInnerCallback")) {
Common::JSONObject createdBy = info.getVal("createdBy")->asObject();
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index 7ea1860d93..33c82b9fd6 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -348,6 +348,17 @@ void OpenGLSdlGraphicsManager::notifyVideoExpose() {
void OpenGLSdlGraphicsManager::notifyResize(const uint width, const uint height) {
#if SDL_VERSION_ATLEAST(2, 0, 0)
+ // We sometime get outdated resize events from SDL2. So check that the size we get
+ // is the actual current window size. If not ignore the resize.
+ // The issue for example occurs when switching from fullscreen to windowed mode or
+ // when switching between different fullscreen resolutions because SDL_DestroyWindow
+ // for a fullscreen window that doesn't have the SDL_WINDOW_FULLSCREEN_DESKTOP flag
+ // causes a SDL_WINDOWEVENT_RESIZED event with the old resolution to be sent, and this
+ // event is processed after recreating the window at the new resolution.
+ int currentWidth, currentHeight;
+ getWindowDimensions(&currentWidth, &currentHeight);
+ if (width != currentWidth || height != currentHeight)
+ return;
setActualScreenSize(width, height);
_eventSource->resetKeyboadEmulation(width - 1, height - 1);
#else
diff --git a/backends/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp
index 8a7fba46f7..a958974209 100644
--- a/backends/saves/default/default-saves.cpp
+++ b/backends/saves/default/default-saves.cpp
@@ -181,6 +181,16 @@ bool DefaultSaveFileManager::removeSavefile(const Common::String &filename) {
assureCached(getSavePath());
if (getError().getCode() != Common::kNoError)
return false;
+
+#ifdef USE_LIBCURL
+ // Update file's timestamp
+ Common::HashMap<Common::String, uint32> timestamps = loadTimestamps();
+ Common::HashMap<Common::String, uint32>::iterator it = timestamps.find(filename);
+ if (it != timestamps.end()) {
+ timestamps.erase(it);
+ saveTimestamps(timestamps);
+ }
+#endif
// Obtain node if exists.
SaveFileCache::const_iterator file = _saveFileCache.find(filename);
@@ -330,7 +340,8 @@ Common::HashMap<Common::String, uint32> DefaultSaveFileManager::loadTimestamps()
//parse timestamp
uint32 timestamp = buffer.asUint64();
if (buffer == "" || timestamp == 0) break;
- timestamps[filename] = timestamp;
+ if (timestamps.contains(filename))
+ timestamps[filename] = timestamp;
}
delete file;
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp
index 9afb2c6700..62f07ad639 100644
--- a/engines/adl/adl.cpp
+++ b/engines/adl/adl.cpp
@@ -673,7 +673,7 @@ Common::Error AdlEngine::loadGameState(int slot) {
// NOTE: _state.curPicture is part of the save state in the original engine. We
// reconstruct it instead. This is believed to be safe for at least hires 0-2, but
// this may need to be re-evaluated for later games.
- _state.curPicture = _state.rooms[_state.room].curPicture;
+ _state.curPicture = getCurRoom().curPicture;
size = inFile->readUint32BE();
if (size != _state.items.size())
diff --git a/engines/adl/detection.cpp b/engines/adl/detection.cpp
index 10812d79ea..2d568b28d7 100644
--- a/engines/adl/detection.cpp
+++ b/engines/adl/detection.cpp
@@ -145,11 +145,13 @@ static const AdlGameDescription gameDescriptions[] = {
"hires4", 0,
{
{ "ULYS1A.XFD", 0, "26365d2b06509fd21e7a7919e33f7199", 92160 },
- // FIXME: Add sides 1B and 2C
+ { "ULYS1B.XFD", 0, "37919c72a4103e6f897ee7daa8261d1d", 92160 },
+ // Load 'N' Go Software release XAG-0646 appears to be missing the second disk
+ { "ULYS2C.XFD", 0, "ff33830246e65dc71c954acb7fd5621a", 92160 },
AD_LISTEND
},
Common::EN_ANY,
- Common::kPlatformAtariST, // FIXME
+ Common::kPlatformAtari8Bit,
ADGF_UNSTABLE,
GUIO2(GAMEOPTION_COLOR_DEFAULT_ON, GAMEOPTION_SCANLINES)
},
diff --git a/engines/adl/hires4.cpp b/engines/adl/hires4.cpp
index ddfc868e9a..3775a2d1eb 100644
--- a/engines/adl/hires4.cpp
+++ b/engines/adl/hires4.cpp
@@ -261,7 +261,7 @@ void HiRes4Engine_Atari::adjustDataBlockPtr(byte &track, byte &sector, byte &off
Engine *HiRes4Engine_create(OSystem *syst, const AdlGameDescription *gd) {
switch (gd->desc.platform) {
- case Common::kPlatformAtariST:
+ case Common::kPlatformAtari8Bit:
return new HiRes4Engine_Atari(syst, gd);
default:
error("Unsupported platform");
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp
index cc7a4ed876..b6c0e7d18e 100644
--- a/engines/dm/champion.cpp
+++ b/engines/dm/champion.cpp
@@ -51,7 +51,7 @@ void Champion::resetToZero() {
memset(_name, '\0', 8);
memset(_title, '\0', 20);
_dir = kDMDirNorth;
- _cell = k0_ViewCellFronLeft;
+ _cell = kDMViewCellFronLeft;
_actionIndex = kDMActionN;
_symbolStep = 0;
memset(_symbols, '\0', 5);
@@ -86,7 +86,7 @@ void ChampionMan::initConstants() {
Box(281, 299, 15, 28)
};
- static Color championColor[4] = {(Color)7, (Color)11, (Color)8, (Color)14};
+ static Color championColor[4] = {kDMColorLightGreen, kDMColorYellow, kDMColorRed, kDMColorBlue};
int16 lightPowerToLightAmount[16] = {0, 5, 12, 24, 33, 40, 46, 51, 59, 68, 76, 82, 89, 94, 97, 100};
uint16 slotMasks[38] = { // @ G0038_ai_Graphic562_SlotMasks
/* 30 for champion inventory, 8 for chest */
@@ -263,10 +263,10 @@ int16 ChampionMan::getDecodedValue(char *string, uint16 characterCount) {
void ChampionMan::drawHealthOrStaminaOrManaValue(int16 posY, int16 currVal, int16 maxVal) {
Common::String tmp = getStringFromInteger(currVal, true, 3);
- _vm->_textMan->printToViewport(55, posY, k13_ColorLightestGray, tmp.c_str());
- _vm->_textMan->printToViewport(73, posY, k13_ColorLightestGray, "/");
+ _vm->_textMan->printToViewport(55, posY, kDMColorLightestGray, tmp.c_str());
+ _vm->_textMan->printToViewport(73, posY, kDMColorLightestGray, "/");
tmp = getStringFromInteger(maxVal, true, 3);
- _vm->_textMan->printToViewport(79, posY, k13_ColorLightestGray, tmp.c_str());
+ _vm->_textMan->printToViewport(79, posY, kDMColorLightestGray, tmp.c_str());
}
uint16 ChampionMan::getHandSlotIndex(uint16 slotBoxIndex) {
@@ -503,10 +503,10 @@ void ChampionMan::drawChangedObjectIcons() {
}
}
- if (invMan._panelContent == k4_PanelContentChest) {
+ if (invMan._panelContent == kDMPanelContentChest) {
thing = invMan._chestSlots;
for (int16 slotIndex = 0; slotIndex < 8; ++slotIndex, thing++) {
- drawViewport |= (hasObjectIconInSlotBoxChanged(slotIndex + k38_SlotBoxChestFirstSlot, *thing) ? 1 : 0);
+ drawViewport |= (hasObjectIconInSlotBoxChanged(slotIndex + kDMSlotBoxChestFirstSlot, *thing) ? 1 : 0);
}
}
@@ -1108,7 +1108,7 @@ void ChampionMan::championPoison(int16 champIndex, uint16 attack) {
Champion *curChampion = &_champions[champIndex];
addPendingDamageAndWounds_getDamage(champIndex, MAX(1, attack >> 6), kDMWoundNone, kDMAttackTypeNormal);
setFlag(curChampion->_attributes, kDMAttributeStatistics);
- if ((_vm->indexToOrdinal(champIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal) && (_vm->_inventoryMan->_panelContent == k0_PanelContentFoodWaterPoisoned)) {
+ if ((_vm->indexToOrdinal(champIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal) && (_vm->_inventoryMan->_panelContent == kDMPanelContentFoodWaterPoisoned)) {
setFlag(curChampion->_attributes, kDMAttributePanel);
}
@@ -1390,18 +1390,18 @@ void ChampionMan::applyAndDrawPendingDamageAndWounds() {
setFlag(championPtr->_attributes, kDMAttributeWounds);
}
- int16 textPosX = championIndex * k69_ChampionStatusBoxSpacing;
+ int16 textPosX = championIndex * kDMChampionStatusBoxSpacing;
int16 textPosY;
Box blitBox;
- blitBox._y1 = 0;
+ blitBox._rect.top = 0;
_vm->_eventMan->showMouse();
if (_vm->indexToOrdinal(championIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal) {
- blitBox._y2 = 28;
- blitBox._x1 = textPosX + 7;
- blitBox._x2 = blitBox._x1 + 31; /* Box is over the champion portrait in the status box */
- _vm->_displayMan->blitToScreen(_vm->_displayMan->getNativeBitmapOrGraphic(k16_damageToChampionBig), &blitBox, k16_byteWidth, k10_ColorFlesh, 29);
+ blitBox._rect.bottom = 28;
+ blitBox._rect.left = textPosX + 7;
+ blitBox._rect.right = blitBox._rect.left + 31; /* Box is over the champion portrait in the status box */
+ _vm->_displayMan->blitToScreen(_vm->_displayMan->getNativeBitmapOrGraphic(k16_damageToChampionBig), &blitBox, k16_byteWidth, kDMColorFlesh, 29);
// Check the number of digits and sets the position accordingly.
if (pendingDamage < 10) // 1 digit
textPosX += 21;
@@ -1412,10 +1412,10 @@ void ChampionMan::applyAndDrawPendingDamageAndWounds() {
textPosY = 16;
} else {
- blitBox._y2 = 6;
- blitBox._x1 = textPosX;
- blitBox._x2 = blitBox._x1 + 47; /* Box is over the champion name in the status box */
- _vm->_displayMan->blitToScreen(_vm->_displayMan->getNativeBitmapOrGraphic(k15_damageToChampionSmallIndice), &blitBox, k24_byteWidth, k10_ColorFlesh, 7);
+ blitBox._rect.bottom = 6;
+ blitBox._rect.left = textPosX;
+ blitBox._rect.right = blitBox._rect.left + 47; /* Box is over the champion name in the status box */
+ _vm->_displayMan->blitToScreen(_vm->_displayMan->getNativeBitmapOrGraphic(k15_damageToChampionSmallIndice), &blitBox, k24_byteWidth, kDMColorFlesh, 7);
// Check the number of digits and sets the position accordingly.
if (pendingDamage < 10) // 1 digit
textPosX += 19;
@@ -1426,7 +1426,7 @@ void ChampionMan::applyAndDrawPendingDamageAndWounds() {
textPosY = 5;
}
- _vm->_textMan->printToLogicalScreen(textPosX, textPosY, k15_ColorWhite, k8_ColorRed, getStringFromInteger(pendingDamage, false, 3).c_str());
+ _vm->_textMan->printToLogicalScreen(textPosX, textPosY, kDMColorWhite, kDMColorRed, getStringFromInteger(pendingDamage, false, 3).c_str());
int16 eventIndex = championPtr->_hideDamageReceivedIndex;
if (eventIndex == -1) {
@@ -1492,7 +1492,7 @@ void ChampionMan::championKill(uint16 champIndex) {
unpoison(champIndex);
_vm->_displayMan->_useByteBoxCoordinates = false;
- _vm->_displayMan->fillScreenBox(_boxChampionIcons[curChampionIconIndex], k0_ColorBlack);
+ _vm->_displayMan->fillScreenBox(_boxChampionIcons[curChampionIconIndex], kDMColorBlack);
drawChampionState((ChampionIndex)champIndex);
ChampionIndex aliveChampionIndex;
@@ -1685,7 +1685,7 @@ void ChampionMan::applyTimeEffects() {
}
setFlag(championPtr->_attributes, kDMAttributeStatistics);
if (_vm->indexToOrdinal(championIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal) {
- if (_vm->_pressingMouth || _vm->_pressingEye || (_vm->_inventoryMan->_panelContent == k0_PanelContentFoodWaterPoisoned)) {
+ if (_vm->_pressingMouth || _vm->_pressingEye || (_vm->_inventoryMan->_panelContent == kDMPanelContentFoodWaterPoisoned)) {
setFlag(championPtr->_attributes, kDMAttributePanel);
}
}
@@ -1875,12 +1875,12 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) {
championPtr->resetToZero();
// Strangerke - TODO: Check if the new code is possible to run on the older version (example: the portraits could be missing in the data)
_vm->_displayMan->_useByteBoxCoordinates = true;
- _vm->_displayMan->blitToBitmap(_vm->_displayMan->getNativeBitmapOrGraphic(k26_ChampionPortraitsIndice), championPtr->_portrait, _boxChampionPortrait, getChampionPortraitX(championPortraitIndex), getChampionPortraitY(championPortraitIndex), k128_byteWidth, k16_byteWidth, kM1_ColorNoTransparency, 87, 29);
+ _vm->_displayMan->blitToBitmap(_vm->_displayMan->getNativeBitmapOrGraphic(k26_ChampionPortraitsIndice), championPtr->_portrait, _boxChampionPortrait, getChampionPortraitX(championPortraitIndex), getChampionPortraitY(championPortraitIndex), k128_byteWidth, k16_byteWidth, kDMColorNoTransparency, 87, 29);
championPtr->_actionIndex = kDMActionNone;
championPtr->_enableActionEventIndex = -1;
championPtr->_hideDamageReceivedIndex = -1;
championPtr->_dir = _vm->_dungeonMan->_partyDir;
- uint16 viewCell = k0_ViewCellFronLeft;
+ uint16 viewCell = kDMViewCellFronLeft;
while (getIndexInCell(_vm->normalizeModulo4(viewCell + _vm->_dungeonMan->_partyDir)) != kDMChampionNone)
viewCell++;
@@ -2064,24 +2064,24 @@ void ChampionMan::drawChampionBarGraphs(ChampionIndex champIndex) {
// Strangerke - TO CHECK: if portraits, maybe the old (assembly) code is required for older versions
Box box;
- box._x1 = champIndex * k69_ChampionStatusBoxSpacing + 46;
- box._x2 = box._x1 + 3;
- box._y1 = 2;
- box._y2 = 26;
+ box._rect.left = champIndex * kDMChampionStatusBoxSpacing + 46;
+ box._rect.right = box._rect.left + 3;
+ box._rect.top = 2;
+ box._rect.bottom = 26;
for (int16 barGraphIndex = 0; barGraphIndex < 3; barGraphIndex++) {
int16 barGraphHeight = barGraphHeights[barGraphIndex];
if (barGraphHeight < 25) {
- box._y1 = 2;
- box._y2 = 27 - barGraphHeight;
- _vm->_displayMan->fillScreenBox(box, k12_ColorDarkestGray);
+ box._rect.top = 2;
+ box._rect.bottom = 27 - barGraphHeight;
+ _vm->_displayMan->fillScreenBox(box, kDMColorDarkestGray);
}
if (barGraphHeight) {
- box._y1 = 27 - barGraphHeight;
- box._y2 = 26;
+ box._rect.top = 27 - barGraphHeight;
+ box._rect.bottom = 26;
_vm->_displayMan->fillScreenBox(box, _championColor[champIndex]);
}
- box._x1 += 7;
- box._x2 += 7;
+ box._rect.left += 7;
+ box._rect.right += 7;
}
_vm->_eventMan->hideMouse();
}
@@ -2116,7 +2116,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
static Box boxMouth = Box(55, 72, 12, 29); // @ G0048_s_Graphic562_Box_Mouth
static Box boxEye = Box(11, 28, 12, 29); // @ G0049_s_Graphic562_Box_Eye
- int16 championStatusBoxX = champIndex * k69_ChampionStatusBoxSpacing;
+ int16 championStatusBoxX = champIndex * kDMChampionStatusBoxSpacing;
Champion *curChampion = &_champions[champIndex];
uint16 championAttributes = curChampion->_attributes;
if (!getFlag(championAttributes, kDMAttributeNameTitle | kDMAttributeStatistics | kDMAttributeLoad | kDMAttributeIcon | kDMAttributePanel | kDMAttributeStatusBox | kDMAttributeWounds | kDMAttributeViewport | kDMAttributeActionHand))
@@ -2127,12 +2127,12 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
_vm->_eventMan->showMouse();
if (getFlag(championAttributes, kDMAttributeStatusBox)) {
Box box;
- box._y1 = 0;
- box._y2 = 28;
- box._x1 = championStatusBoxX;
- box._x2 = box._x1 + 66;
+ box._rect.top = 0;
+ box._rect.bottom = 28;
+ box._rect.left = championStatusBoxX;
+ box._rect.right = box._rect.left + 66;
if (curChampion->_currHealth) {
- _vm->_displayMan->fillScreenBox(box, k12_ColorDarkestGray);
+ _vm->_displayMan->fillScreenBox(box, kDMColorDarkestGray);
int16 nativeBitmapIndices[3];
for (uint16 i = 0; i < 3; ++i)
nativeBitmapIndices[i] = 0;
@@ -2148,7 +2148,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
nativeBitmapIndices[borderCount++] = k37_BorderPartyShieldIndice;
while (borderCount--)
- _vm->_displayMan->blitToScreen(_vm->_displayMan->getNativeBitmapOrGraphic(nativeBitmapIndices[borderCount]), &box, k40_byteWidth, k10_ColorFlesh, 29);
+ _vm->_displayMan->blitToScreen(_vm->_displayMan->getNativeBitmapOrGraphic(nativeBitmapIndices[borderCount]), &box, k40_byteWidth, kDMColorFlesh, 29);
if (isInventoryChampion) {
_vm->_inventoryMan->drawStatusBoxPortrait(champIndex);
@@ -2156,8 +2156,8 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
} else
setFlag(championAttributes, kDMAttributeNameTitle | kDMAttributeStatistics | kDMAttributeWounds | kDMAttributeActionHand);
} else {
- _vm->_displayMan->blitToScreen(_vm->_displayMan->getNativeBitmapOrGraphic(k8_StatusBoxDeadChampion), &box, k40_byteWidth, kM1_ColorNoTransparency, 29);
- _vm->_textMan->printToLogicalScreen(championStatusBoxX + 1, 5, k13_ColorLightestGray, k1_ColorDarkGary, curChampion->_name);
+ _vm->_displayMan->blitToScreen(_vm->_displayMan->getNativeBitmapOrGraphic(k8_StatusBoxDeadChampion), &box, k40_byteWidth, kDMColorNoTransparency, 29);
+ _vm->_textMan->printToLogicalScreen(championStatusBoxX + 1, 5, kDMColorLightestGray, kDMColorDarkGary, curChampion->_name);
_vm->_menuMan->drawActionIcon(champIndex);
clearFlag(curChampion->_attributes, kDMAttributeNameTitle | kDMAttributeStatistics | kDMAttributeLoad | kDMAttributeIcon | kDMAttributePanel | kDMAttributeStatusBox | kDMAttributeWounds | kDMAttributeViewport | kDMAttributeActionHand);
@@ -2172,7 +2172,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
}
if (getFlag(championAttributes, kDMAttributeNameTitle)) {
- Color nameColor = (champIndex == _leaderIndex) ? k9_ColorGold : k13_ColorLightestGray;
+ Color nameColor = (champIndex == _leaderIndex) ? kDMColorGold : kDMColorLightestGray;
if (isInventoryChampion) {
char *championName = curChampion->_name;
_vm->_textMan->printToViewport(3, 7, nameColor, championName);
@@ -2185,12 +2185,12 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
setFlag(championAttributes, kDMAttributeViewport);
} else {
Box box;
- box._y1 = 0;
- box._y2 = 6;
- box._x1 = championStatusBoxX;
- box._x2 = box._x1 + 42;
- _vm->_displayMan->fillScreenBox(box, k1_ColorDarkGary);
- _vm->_textMan->printToLogicalScreen(championStatusBoxX + 1, 5, nameColor, k1_ColorDarkGary, curChampion->_name);
+ box._rect.top = 0;
+ box._rect.bottom = 6;
+ box._rect.left = championStatusBoxX;
+ box._rect.right = box._rect.left + 42;
+ _vm->_displayMan->fillScreenBox(box, kDMColorDarkGary);
+ _vm->_textMan->printToLogicalScreen(championStatusBoxX + 1, 5, nameColor, kDMColorDarkGary, curChampion->_name);
}
}
if (getFlag(championAttributes, kDMAttributeStatistics)) {
@@ -2203,7 +2203,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
else
nativeBitmapIndex = k33_SlotBoxNormalIndice;
- _vm->_displayMan->blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(nativeBitmapIndex), boxMouth, k16_byteWidth, k12_ColorDarkestGray, 18);
+ _vm->_displayMan->blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(nativeBitmapIndex), boxMouth, k16_byteWidth, kDMColorDarkestGray, 18);
nativeBitmapIndex = k33_SlotBoxNormalIndice;
for (int i = kDMStatStrength; i <= kDMStatAntifire; i++) {
if ((curChampion->_statistics[i][kDMStatCurrent] < curChampion->_statistics[i][kDMStatMaximum])) {
@@ -2211,7 +2211,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
break;
}
}
- _vm->_displayMan->blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(nativeBitmapIndex), boxEye, k16_byteWidth, k12_ColorDarkestGray, 18);
+ _vm->_displayMan->blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(nativeBitmapIndex), boxEye, k16_byteWidth, kDMColorDarkestGray, 18);
setFlag(championAttributes, kDMAttributeViewport);
}
}
@@ -2226,11 +2226,11 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
uint16 maxLoad = getMaximumLoad(curChampion);
Color loadColor;
if (curChampion->_load > maxLoad)
- loadColor = k8_ColorRed;
+ loadColor = kDMColorRed;
else if (((long)curChampion->_load << 3) > ((long)maxLoad * 5))
- loadColor = k11_ColorYellow;
+ loadColor = kDMColorYellow;
else
- loadColor = k13_ColorLightestGray;
+ loadColor = kDMColorLightestGray;
switch (_vm->getGameLanguage()) { // localized
default:
@@ -2261,7 +2261,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
uint16 championIconIndex = getChampionIconIndex(curChampion->_cell, _vm->_dungeonMan->_partyDir);
if (getFlag(championAttributes, kDMAttributeIcon) && (_vm->_eventMan->_useChampionIconOrdinalAsMousePointerBitmap != _vm->indexToOrdinal(championIconIndex))) {
_vm->_displayMan->fillScreenBox(_boxChampionIcons[championIconIndex], _championColor[champIndex]);
- _vm->_displayMan->blitToBitmap(_vm->_displayMan->getNativeBitmapOrGraphic(k28_ChampionIcons), _vm->_displayMan->_bitmapScreen, _boxChampionIcons[championIconIndex], getChampionIconIndex(curChampion->_dir, _vm->_dungeonMan->_partyDir) * 19, 0, k40_byteWidth, k160_byteWidthScreen, k12_ColorDarkestGray, 14, k200_heightScreen);
+ _vm->_displayMan->blitToBitmap(_vm->_displayMan->getNativeBitmapOrGraphic(k28_ChampionIcons), _vm->_displayMan->_bitmapScreen, _boxChampionIcons[championIconIndex], getChampionIconIndex(curChampion->_dir, _vm->_dungeonMan->_partyDir) * 19, 0, k40_byteWidth, k160_byteWidthScreen, kDMColorDarkestGray, 14, k200_heightScreen);
}
if (getFlag(championAttributes, kDMAttributePanel) && isInventoryChampion) {
if (_vm->_pressingMouth)
@@ -2319,10 +2319,10 @@ void ChampionMan::drawSlot(uint16 champIndex, int16 slotIndex) {
SlotBox *slotBox = &_vm->_objectMan->_slotBoxes[slotBoxIndex];
Box box;
- box._x1 = slotBox->_x - 1;
- box._y1 = slotBox->_y - 1;
- box._x2 = box._x1 + 17;
- box._y2 = box._y1 + 17;
+ box._rect.left = slotBox->_x - 1;
+ box._rect.top = slotBox->_y - 1;
+ box._rect.right = box._rect.left + 17;
+ box._rect.bottom = box._rect.top + 17;
if (!isInventoryChamp)
_vm->_eventMan->hideMouse();
@@ -2363,11 +2363,11 @@ void ChampionMan::drawSlot(uint16 champIndex, int16 slotIndex) {
if (isInventoryChamp) {
_vm->_displayMan->blitToBitmap(_vm->_displayMan->getNativeBitmapOrGraphic(nativeBitmapIndex),
_vm->_displayMan->_bitmapViewport, box, 0, 0, 16, k112_byteWidthViewport,
- k12_ColorDarkestGray, _vm->_displayMan->getPixelHeight(nativeBitmapIndex), k136_heightViewport);
+ kDMColorDarkestGray, _vm->_displayMan->getPixelHeight(nativeBitmapIndex), k136_heightViewport);
} else {
_vm->_displayMan->blitToBitmap(_vm->_displayMan->getNativeBitmapOrGraphic(nativeBitmapIndex),
_vm->_displayMan->_bitmapScreen, box, 0, 0, 16, k160_byteWidthScreen,
- k12_ColorDarkestGray, _vm->_displayMan->getPixelHeight(nativeBitmapIndex), k136_heightViewport);
+ kDMColorDarkestGray, _vm->_displayMan->getPixelHeight(nativeBitmapIndex), k136_heightViewport);
}
}
@@ -2385,15 +2385,15 @@ void ChampionMan::renameChampion(Champion *champ) {
static const char reincarnateSpecialCharacters[6] = {',', '.', ';', ':', ' '};
Box displayBox;
- displayBox._y1 = 3;
- displayBox._y2 = 8;
- displayBox._x1 = 3;
- displayBox._x2 = displayBox._x1 + 167;
-
- _vm->_displayMan->fillBoxBitmap(_vm->_displayMan->_bitmapViewport, displayBox, k12_ColorDarkestGray, k112_byteWidthViewport, k136_heightViewport);
- _vm->_displayMan->blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k27_PanelRenameChampionIndice), _vm->_inventoryMan->_boxPanel, k72_byteWidth, k4_ColorCyan, 73);
- _vm->_textMan->printToViewport(177, 58, k13_ColorLightestGray, "_______");
- _vm->_textMan->printToViewport(105, 76, k13_ColorLightestGray, "___________________");
+ displayBox._rect.top = 3;
+ displayBox._rect.bottom = 8;
+ displayBox._rect.left = 3;
+ displayBox._rect.right = displayBox._rect.left + 167;
+
+ _vm->_displayMan->fillBoxBitmap(_vm->_displayMan->_bitmapViewport, displayBox, kDMColorDarkestGray, k112_byteWidthViewport, k136_heightViewport);
+ _vm->_displayMan->blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k27_PanelRenameChampionIndice), _vm->_inventoryMan->_boxPanel, k72_byteWidth, kDMColorCyan, 73);
+ _vm->_textMan->printToViewport(177, 58, kDMColorLightestGray, "_______");
+ _vm->_textMan->printToViewport(105, 76, kDMColorLightestGray, "___________________");
_vm->_eventMan->showMouse();
_vm->_displayMan->drawViewport(k0_viewportNotDungeonView);
_vm->_eventMan->setMousePointerToNormal(k0_pointerArrow);
@@ -2410,7 +2410,7 @@ void ChampionMan::renameChampion(Champion *champ) {
bool championTitleIsFull = ((renamedChampionStringMode == k2_RENAME_CHAMPION_TITLE) && (curCharacterIndex == 19));
if (!championTitleIsFull) {
_vm->_eventMan->showMouse();
- _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, k9_ColorGold, k12_ColorDarkestGray, underscoreCharacterString, k200_heightScreen);
+ _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, kDMColorGold, kDMColorDarkestGray, underscoreCharacterString, k200_heightScreen);
_vm->_eventMan->hideMouse();
}
@@ -2495,7 +2495,7 @@ void ChampionMan::renameChampion(Champion *champ) {
if (!championTitleIsFull) {
renameChampionInputCharacterString[0] = curCharacter;
_vm->_eventMan->showMouse();
- _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, k13_ColorLightestGray, k12_ColorDarkestGray, renameChampionInputCharacterString, k200_heightScreen);
+ _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, kDMColorLightestGray, kDMColorDarkestGray, renameChampionInputCharacterString, k200_heightScreen);
_vm->_eventMan->hideMouse();
renamedChampionString[curCharacterIndex++] = curCharacter;
renamedChampionString[curCharacterIndex] = '\0';
@@ -2512,7 +2512,7 @@ void ChampionMan::renameChampion(Champion *champ) {
} else if (curCharacter == '\r') { // Carriage return
if ((renamedChampionStringMode == k1_RENAME_CHAMPION_NAME) && (curCharacterIndex > 0)) {
_vm->_eventMan->showMouse();
- _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, k13_ColorLightestGray, k12_ColorDarkestGray, underscoreCharacterString, k200_heightScreen);
+ _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, kDMColorLightestGray, kDMColorDarkestGray, underscoreCharacterString, k200_heightScreen);
_vm->_eventMan->hideMouse();
renamedChampionStringMode = k2_RENAME_CHAMPION_TITLE;
renamedChampionString = champ->_title;
@@ -2526,7 +2526,7 @@ void ChampionMan::renameChampion(Champion *champ) {
if (!championTitleIsFull) {
_vm->_eventMan->showMouse();
- _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, k13_ColorLightestGray, k12_ColorDarkestGray, underscoreCharacterString, k200_heightScreen);
+ _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, textPosX, textPosY, kDMColorLightestGray, kDMColorDarkestGray, underscoreCharacterString, k200_heightScreen);
_vm->_eventMan->hideMouse();
}
if (curCharacterIndex == 0) {
diff --git a/engines/dm/dialog.cpp b/engines/dm/dialog.cpp
index 47888090f9..af38bcd0ee 100644
--- a/engines/dm/dialog.cpp
+++ b/engines/dm/dialog.cpp
@@ -46,7 +46,7 @@ void DialogMan::dialogDraw(const char *msg1, const char *msg2, const char *choic
_vm->_displayMan->loadIntoBitmap(k0_dialogBoxGraphicIndice, _vm->_displayMan->_bitmapViewport);
//Strangerke: the version should be replaced by a ScummVM/RogueVM (?) string
// TODO: replace with ScummVM version string
- _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, 192, 7, k2_ColorLightGray, k1_ColorDarkGary, "V2.2", k136_heightViewport);
+ _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, 192, 7, kDMColorLightGray, kDMColorDarkGary, "V2.2", k136_heightViewport);
int16 choiceCount = 1;
if (choice2)
choiceCount++;
@@ -61,16 +61,16 @@ void DialogMan::dialogDraw(const char *msg1, const char *msg2, const char *choic
_vm->_displayMan->startEndFadeToPalette(_vm->_displayMan->_blankBuffer);
if (clearScreen)
- _vm->_displayMan->fillScreen(k0_ColorBlack);
+ _vm->_displayMan->fillScreen(kDMColorBlack);
_vm->_displayMan->_useByteBoxCoordinates = false;
if (choiceCount == 1) {
- _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapViewport, _vm->_displayMan->_bitmapViewport, constBox1, 0, 64, k112_byteWidthViewport, k112_byteWidthViewport, kM1_ColorNoTransparency, k136_heightViewport, k136_heightViewport);
- _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapViewport, _vm->_displayMan->_bitmapViewport, constBox2, 0, 39, k112_byteWidthViewport, k112_byteWidthViewport, kM1_ColorNoTransparency, k136_heightViewport, k136_heightViewport);
- _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapViewport, _vm->_displayMan->_bitmapViewport, constBox3, 0, 14, k112_byteWidthViewport, k112_byteWidthViewport, kM1_ColorNoTransparency, k136_heightViewport, k136_heightViewport);
+ _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapViewport, _vm->_displayMan->_bitmapViewport, constBox1, 0, 64, k112_byteWidthViewport, k112_byteWidthViewport, kDMColorNoTransparency, k136_heightViewport, k136_heightViewport);
+ _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapViewport, _vm->_displayMan->_bitmapViewport, constBox2, 0, 39, k112_byteWidthViewport, k112_byteWidthViewport, kDMColorNoTransparency, k136_heightViewport, k136_heightViewport);
+ _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapViewport, _vm->_displayMan->_bitmapViewport, constBox3, 0, 14, k112_byteWidthViewport, k112_byteWidthViewport, kDMColorNoTransparency, k136_heightViewport, k136_heightViewport);
printCenteredChoice(_vm->_displayMan->_bitmapViewport, choice1, 112, 114);
} else if (choiceCount == 2) {
- _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapViewport, _vm->_displayMan->_bitmapViewport, dialog2ChoicesPatch, 102, 52, k112_byteWidthViewport, k112_byteWidthViewport, kM1_ColorNoTransparency, k136_heightViewport, k136_heightViewport);
+ _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapViewport, _vm->_displayMan->_bitmapViewport, dialog2ChoicesPatch, 102, 52, k112_byteWidthViewport, k112_byteWidthViewport, kDMColorNoTransparency, k136_heightViewport, k136_heightViewport);
printCenteredChoice(_vm->_displayMan->_bitmapViewport, choice1, 112, 77);
printCenteredChoice(_vm->_displayMan->_bitmapViewport, choice2, 112, 114);
} else if (choiceCount == 3) {
@@ -78,7 +78,7 @@ void DialogMan::dialogDraw(const char *msg1, const char *msg2, const char *choic
printCenteredChoice(_vm->_displayMan->_bitmapViewport, choice2, 59, 114);
printCenteredChoice(_vm->_displayMan->_bitmapViewport, choice3, 166, 114);
} else if (choiceCount == 4) {
- _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapViewport, _vm->_displayMan->_bitmapViewport, dialog4ChoicesPatch, 102, 99, k112_byteWidthViewport, k112_byteWidthViewport, kM1_ColorNoTransparency, k136_heightViewport, k136_heightViewport);
+ _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapViewport, _vm->_displayMan->_bitmapViewport, dialog4ChoicesPatch, 102, 99, k112_byteWidthViewport, k112_byteWidthViewport, kDMColorNoTransparency, k136_heightViewport, k136_heightViewport);
printCenteredChoice(_vm->_displayMan->_bitmapViewport, choice1, 59, 77);
printCenteredChoice(_vm->_displayMan->_bitmapViewport, choice2, 166, 77);
printCenteredChoice(_vm->_displayMan->_bitmapViewport, choice3, 59, 114);
@@ -93,14 +93,14 @@ void DialogMan::dialogDraw(const char *msg1, const char *msg2, const char *choic
if (isMessageOnTwoLines(msg1, L1312_ac_StringPart1, L1313_ac_StringPart2)) {
textPosY = 21;
textPosX = 113 - ((strlen(L1312_ac_StringPart1) * 6) >> 1);
- _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, k11_ColorYellow, k5_ColorLightBrown, L1312_ac_StringPart1, k136_heightViewport);
+ _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, kDMColorYellow, kDMColorLightBrown, L1312_ac_StringPart1, k136_heightViewport);
textPosY += 8;
textPosX = 113 - ((strlen(L1313_ac_StringPart2) * 6) >> 1);
- _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, k11_ColorYellow, k5_ColorLightBrown, L1313_ac_StringPart2, k136_heightViewport);
+ _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, kDMColorYellow, kDMColorLightBrown, L1313_ac_StringPart2, k136_heightViewport);
textPosY += 8;
} else {
textPosX = 113 - ((strlen(msg1) * 6) >> 1);
- _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, k11_ColorYellow, k5_ColorLightBrown, msg1, k136_heightViewport);
+ _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, kDMColorYellow, kDMColorLightBrown, msg1, k136_heightViewport);
textPosY += 8;
}
}
@@ -109,23 +109,19 @@ void DialogMan::dialogDraw(const char *msg1, const char *msg2, const char *choic
char L1313_ac_StringPart2[70];
if (isMessageOnTwoLines(msg2, L1312_ac_StringPart1, L1313_ac_StringPart2)) {
textPosX = 113 - ((strlen(L1312_ac_StringPart1) * 6) >> 1);
- _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, k9_ColorGold, k5_ColorLightBrown, L1312_ac_StringPart1, k136_heightViewport);
+ _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, kDMColorGold, kDMColorLightBrown, L1312_ac_StringPart1, k136_heightViewport);
textPosY += 8;
textPosX = 113 - ((strlen(L1313_ac_StringPart2) * 6) >> 1);
- _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, k9_ColorGold, k5_ColorLightBrown, L1313_ac_StringPart2, k136_heightViewport);
+ _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, kDMColorGold, kDMColorLightBrown, L1313_ac_StringPart2, k136_heightViewport);
} else {
textPosX = 113 - ((strlen(msg2) * 6) >> 1);
- _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, k9_ColorGold, k5_ColorLightBrown, msg2, k136_heightViewport);
+ _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, textPosX, textPosY, kDMColorGold, kDMColorLightBrown, msg2, k136_heightViewport);
}
}
if (screenDialog) {
- Box displayBox;
- displayBox._y1 = 33;
- displayBox._y2 = 168;
- displayBox._x1 = 47;
- displayBox._x2 = 270;
+ Box displayBox(47, 270, 33, 168);
_vm->_eventMan->showMouse();
- _vm->_displayMan->blitToScreen(_vm->_displayMan->_bitmapViewport, &displayBox, k112_byteWidthViewport, kM1_ColorNoTransparency, k136_heightViewport);
+ _vm->_displayMan->blitToScreen(_vm->_displayMan->_bitmapViewport, &displayBox, k112_byteWidthViewport, kDMColorNoTransparency, k136_heightViewport);
_vm->_eventMan->hideMouse();
} else {
_vm->_displayMan->drawViewport(k0_viewportNotDungeonView);
@@ -142,7 +138,7 @@ void DialogMan::dialogDraw(const char *msg1, const char *msg2, const char *choic
void DialogMan::printCenteredChoice(byte *bitmap, const char *str, int16 posX, int16 posY) {
if (str) {
posX -= (strlen(str) * 6) >> 1;
- _vm->_textMan->printTextToBitmap(bitmap, k112_byteWidthViewport, posX, posY, k9_ColorGold, k5_ColorLightBrown, str, k136_heightViewport);
+ _vm->_textMan->printTextToBitmap(bitmap, k112_byteWidthViewport, posX, posY, kDMColorGold, kDMColorLightBrown, str, k136_heightViewport);
}
}
@@ -187,64 +183,64 @@ int16 DialogMan::getChoice(uint16 choiceCount, uint16 dialogSetIndex, int16 driv
} while (_selectedDialogChoice == 99);
_vm->_displayMan->_useByteBoxCoordinates = false;
Box boxA = _vm->_eventMan->_primaryMouseInput[_selectedDialogChoice - 1]._hitbox;
- boxA._x1 -= 3;
- boxA._x2 += 3;
- boxA._y1 -= 3;
- boxA._y2 += 4;
+ boxA._rect.left -= 3;
+ boxA._rect.right += 3;
+ boxA._rect.top -= 3;
+ boxA._rect.bottom += 4;
_vm->_eventMan->showMouse();
_vm->_displayMan->_drawFloorAndCeilingRequested = true;
- Box boxB(0, 0, boxA._x2 - boxA._x1 + 3, boxA._y2 - boxA._y1 + 3);
+ Box boxB(0, 0, boxA._rect.right - boxA._rect.left + 3, boxA._rect.bottom - boxA._rect.top + 3);
_vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapScreen, _vm->_displayMan->_bitmapViewport,
- boxB, boxA._x1, boxA._y1, k160_byteWidthScreen, k160_byteWidthScreen, kM1_ColorNoTransparency, 200, 25);
+ boxB, boxA._rect.left, boxA._rect.top, k160_byteWidthScreen, k160_byteWidthScreen, kDMColorNoTransparency, 200, 25);
_vm->delay(1);
boxB = boxA;
- boxB._y2 = boxB._y1;
- _vm->_displayMan->fillScreenBox(boxB, k5_ColorLightBrown);
+ boxB._rect.bottom = boxB._rect.top;
+ _vm->_displayMan->fillScreenBox(boxB, kDMColorLightBrown);
boxB = boxA;
- boxB._x2 = boxB._x1;
- boxB._y2--;
- _vm->_displayMan->fillScreenBox(boxB, k5_ColorLightBrown);
+ boxB._rect.right = boxB._rect.left;
+ boxB._rect.bottom--;
+ _vm->_displayMan->fillScreenBox(boxB, kDMColorLightBrown);
boxB = boxA;
- boxB._y2--;
- boxB._y1 = boxB._y2;
- boxB._x1 -= 2;
- _vm->_displayMan->fillScreenBox(boxB, k0_ColorBlack);
+ boxB._rect.bottom--;
+ boxB._rect.top = boxB._rect.bottom;
+ boxB._rect.left -= 2;
+ _vm->_displayMan->fillScreenBox(boxB, kDMColorBlack);
boxB = boxA;
- boxB._x1 = boxB._x2;
- _vm->_displayMan->fillScreenBox(boxB, k0_ColorBlack);
+ boxB._rect.left = boxB._rect.right;
+ _vm->_displayMan->fillScreenBox(boxB, kDMColorBlack);
_vm->delay(2);
boxB = boxA;
- boxB._y1++;
- boxB._y2 = boxB._y1;
- boxB._x2 -= 2;
- _vm->_displayMan->fillScreenBox(boxB, k5_ColorLightBrown);
+ boxB._rect.top++;
+ boxB._rect.bottom = boxB._rect.top;
+ boxB._rect.right -= 2;
+ _vm->_displayMan->fillScreenBox(boxB, kDMColorLightBrown);
boxB = boxA;
- boxB._x1++;
- boxB._x2 = boxB._x1;
- boxB._y2--;
- _vm->_displayMan->fillScreenBox(boxB, k5_ColorLightBrown);
+ boxB._rect.left++;
+ boxB._rect.right = boxB._rect.left;
+ boxB._rect.bottom--;
+ _vm->_displayMan->fillScreenBox(boxB, kDMColorLightBrown);
boxB = boxA;
- boxB._x2--;
- boxB._x1 = boxB._x2;
- _vm->_displayMan->fillScreenBox(boxB, k0_ColorBlack);
+ boxB._rect.right--;
+ boxB._rect.left = boxB._rect.right;
+ _vm->_displayMan->fillScreenBox(boxB, kDMColorBlack);
boxB = boxA;
- boxB._y1 = boxB._y2 = boxB._y2 - 2;
- boxB._x1++;
- _vm->_displayMan->fillScreenBox(boxB, k0_ColorBlack);
+ boxB._rect.top = boxB._rect.bottom = boxB._rect.bottom - 2;
+ boxB._rect.left++;
+ _vm->_displayMan->fillScreenBox(boxB, kDMColorBlack);
boxB = boxA;
- boxB._y1 = boxB._y2 = boxB._y2 + 2;
- boxB._x1--;
- boxB._x2 += 2;
- _vm->_displayMan->fillScreenBox(boxB, k13_ColorLightestGray);
+ boxB._rect.top = boxB._rect.bottom = boxB._rect.bottom + 2;
+ boxB._rect.left--;
+ boxB._rect.right += 2;
+ _vm->_displayMan->fillScreenBox(boxB, kDMColorLightestGray);
boxB = boxA;
- boxB._x1 = boxB._x2 = boxB._x2 + 3;
- boxB._y2 += 2;
- _vm->_displayMan->fillScreenBox(boxB, k13_ColorLightestGray);
+ boxB._rect.left = boxB._rect.right = boxB._rect.right + 3;
+ boxB._rect.bottom += 2;
+ _vm->_displayMan->fillScreenBox(boxB, kDMColorLightestGray);
_vm->delay(2);
- boxA._x2 += 3;
- boxA._y2 += 3;
+ boxA._rect.right += 3;
+ boxA._rect.bottom += 3;
_vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapViewport, _vm->_displayMan->_bitmapScreen,
- boxA, 0, 0, k160_byteWidthScreen, k160_byteWidthScreen, kM1_ColorNoTransparency, 25, k200_heightScreen);
+ boxA, 0, 0, k160_byteWidthScreen, k160_byteWidthScreen, kDMColorNoTransparency, 25, k200_heightScreen);
_vm->_eventMan->hideMouse();
_vm->_eventMan->_primaryMouseInput = primaryMouseInputBackup;
_vm->_eventMan->_secondaryMouseInput = secondaryMouseInputBackup;
diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp
index f8d8844cea..d9ffd32298 100644
--- a/engines/dm/dm.cpp
+++ b/engines/dm/dm.cpp
@@ -138,7 +138,6 @@ DMEngine::DMEngine(OSystem *syst, const DMADGameDescription *desc) : Engine(syst
_stopWaitingForPlayerInput = true;
_gameTimeTicking = false;
_restartGameAllowed = false;
- _gameId = 0;
_pressingEye = false;
_stopPressingEye = false;
_pressingMouth = false;
@@ -200,7 +199,7 @@ bool DMEngine::hasFeature(EngineFeature f) const {
Common::Error DMEngine::loadGameState(int slot) {
if (loadgame(slot) != kDMLoadgameFailure) {
- _displayMan->fillScreen(k0_ColorBlack);
+ _displayMan->fillScreen(kDMColorBlack);
_displayMan->startEndFadeToPalette(_displayMan->_palDungeonView[0]);
_newGameFl = k0_modeLoadSavedGame;
@@ -313,14 +312,14 @@ void DMEngine::startGame() {
_displayMan->startEndFadeToPalette(_displayMan->_paletteTopAndBottomScreen);
_displayMan->_useByteBoxCoordinates = false;
delay(1);
- _displayMan->fillScreenBox(boxScreenTop, k0_ColorBlack);
- _displayMan->fillScreenBox(boxScreenRight, k0_ColorBlack);
- _displayMan->fillScreenBox(boxScreenBottom, k0_ColorBlack);
+ _displayMan->fillScreenBox(boxScreenTop, kDMColorBlack);
+ _displayMan->fillScreenBox(boxScreenRight, kDMColorBlack);
+ _displayMan->fillScreenBox(boxScreenBottom, kDMColorBlack);
} else {
_displayMan->_useByteBoxCoordinates = false;
- _displayMan->fillScreenBox(boxScreenTop, k0_ColorBlack);
- _displayMan->fillScreenBox(boxScreenRight, k0_ColorBlack);
- _displayMan->fillScreenBox(boxScreenBottom, k0_ColorBlack);
+ _displayMan->fillScreenBox(boxScreenTop, kDMColorBlack);
+ _displayMan->fillScreenBox(boxScreenRight, kDMColorBlack);
+ _displayMan->fillScreenBox(boxScreenBottom, kDMColorBlack);
}
_displayMan->buildPaletteChangeCopperList(_displayMan->_palDungeonView[0], _displayMan->_paletteTopAndBottomScreen);
@@ -416,7 +415,7 @@ void DMEngine::gameloop() {
if (!_inventoryMan->_inventoryChampionOrdinal && !_championMan->_partyIsSleeping) {
Box box(0, 223, 0, 135);
- _displayMan->fillBoxBitmap(_displayMan->_bitmapViewport, box, k0_ColorBlack, k112_byteWidthViewport, k136_heightViewport); // (possibly dummy code)
+ _displayMan->fillBoxBitmap(_displayMan->_bitmapViewport, box, kDMColorBlack, k112_byteWidthViewport, k136_heightViewport); // (possibly dummy code)
_displayMan->drawDungeon(_dungeonMan->_partyDir, _dungeonMan->_partyMapX, _dungeonMan->_partyMapY);
if (_setMousePointerToObjectInMainLoop) {
_setMousePointerToObjectInMainLoop = false;
@@ -519,13 +518,13 @@ void DMEngine::processEntrance() {
_displayMan->_useByteBoxCoordinates = false;
Box displayBox(0, 100, 0, 160);
for (uint16 idx = 1; idx < 4; idx++) {
- _displayMan->blitToBitmap(_entranceDoorAnimSteps[0], _entranceDoorAnimSteps[idx], displayBox, idx << 2, 0, k64_byteWidth, k64_byteWidth, kM1_ColorNoTransparency, 161, 161);
- displayBox._x2 -= 4;
+ _displayMan->blitToBitmap(_entranceDoorAnimSteps[0], _entranceDoorAnimSteps[idx], displayBox, idx << 2, 0, k64_byteWidth, k64_byteWidth, kDMColorNoTransparency, 161, 161);
+ displayBox._rect.right -= 4;
}
- displayBox._x2 = 127;
+ displayBox._rect.right = 127;
for (uint16 idx = 5; idx < 8; idx++) {
- displayBox._x1 += 4;
- _displayMan->blitToBitmap(_entranceDoorAnimSteps[4], _entranceDoorAnimSteps[idx], displayBox, 0, 0, k64_byteWidth, k64_byteWidth, kM1_ColorNoTransparency, 161, 161);
+ displayBox._rect.left += 4;
+ _displayMan->blitToBitmap(_entranceDoorAnimSteps[4], _entranceDoorAnimSteps[idx], displayBox, 0, 0, k64_byteWidth, k64_byteWidth, kDMColorNoTransparency, 161, 161);
}
do {
@@ -622,39 +621,39 @@ void DMEngine::endGame(bool doNotDrawCreditsOnly) {
if (doNotDrawCreditsOnly) {
if (_gameWon) {
// Strangerke: Related to portraits. Game data could be missing for earlier versions of the game.
- _displayMan->fillScreen(k12_ColorDarkestGray);
+ _displayMan->fillScreen(kDMColorDarkestGray);
for (int16 championIndex = kDMChampionFirst; championIndex < _championMan->_partyChampionCount; championIndex++) {
int16 textPosY = championIndex * 48;
Champion *curChampion = &_championMan->_champions[championIndex];
- _displayMan->blitToScreen(_displayMan->getNativeBitmapOrGraphic(k208_wallOrn_43_champMirror), &championMirrorBox, k32_byteWidth, k10_ColorFlesh, 43);
- _displayMan->blitToScreen(curChampion->_portrait, &championPortraitBox, k16_byteWidth, k1_ColorDarkGary, 29);
- _textMan->printEndGameString(87, textPosY += 14, k9_ColorGold, curChampion->_name);
+ _displayMan->blitToScreen(_displayMan->getNativeBitmapOrGraphic(k208_wallOrn_43_champMirror), &championMirrorBox, k32_byteWidth, kDMColorFlesh, 43);
+ _displayMan->blitToScreen(curChampion->_portrait, &championPortraitBox, k16_byteWidth, kDMColorDarkGary, 29);
+ _textMan->printEndGameString(87, textPosY += 14, kDMColorGold, curChampion->_name);
int textPosX = (6 * strlen(curChampion->_name)) + 87;
char championTitleFirstCharacter = curChampion->_title[0];
if ((championTitleFirstCharacter != ',') && (championTitleFirstCharacter != ';') && (championTitleFirstCharacter != '-'))
textPosX += 6;
- _textMan->printEndGameString(textPosX, textPosY++, k9_ColorGold, curChampion->_title);
+ _textMan->printEndGameString(textPosX, textPosY++, kDMColorGold, curChampion->_title);
for (int16 idx = kDMSkillFighter; idx <= kDMSkillWizard; idx++) {
uint16 skillLevel = MIN<uint16>(16, _championMan->getSkillLevel(championIndex, idx | (kDMIgnoreObjectModifiers | kDMIgnoreTemporaryExperience)));
if (skillLevel == 1)
continue;
Common::String displStr = Common::String::format("%s %s", _inventoryMan->_skillLevelNames[skillLevel - 2], _championMan->_baseSkillName[idx]);
- _textMan->printEndGameString(105, textPosY = textPosY + 8, k13_ColorLightestGray, displStr.c_str());
+ _textMan->printEndGameString(105, textPosY = textPosY + 8, kDMColorLightestGray, displStr.c_str());
}
- championMirrorBox._y1 += 48;
- championMirrorBox._y2 += 48;
- championPortraitBox._y1 += 48;
- championPortraitBox._y1 += 48;
+ championMirrorBox._rect.top += 48;
+ championMirrorBox._rect.bottom += 48;
+ championPortraitBox._rect.top += 48;
+ championPortraitBox._rect.top += 48;
}
_displayMan->startEndFadeToPalette(_displayMan->_paletteTopAndBottomScreen);
_engineShouldQuit = true;
return;
}
T0444017:
- _displayMan->fillScreen(k0_ColorBlack);
- _displayMan->blitToScreen(_displayMan->getNativeBitmapOrGraphic(k6_theEndIndice), &theEndBox, k40_byteWidth, kM1_ColorNoTransparency, 14);
+ _displayMan->fillScreen(kDMColorBlack);
+ _displayMan->blitToScreen(_displayMan->getNativeBitmapOrGraphic(k6_theEndIndice), &theEndBox, k40_byteWidth, kDMColorNoTransparency, 14);
for (uint16 i = 0; i < 16; ++i)
darkBluePalette[i] = D01_RGB_DARK_BLUE;
uint16 curPalette[16];
@@ -668,19 +667,19 @@ T0444017:
if (_restartGameAllowed) {
_displayMan->_useByteBoxCoordinates = false;
- _displayMan->fillScreenBox(restartOuterBox, k12_ColorDarkestGray);
- _displayMan->fillScreenBox(restartInnerBox, k0_ColorBlack);
+ _displayMan->fillScreenBox(restartOuterBox, kDMColorDarkestGray);
+ _displayMan->fillScreenBox(restartInnerBox, kDMColorBlack);
switch (getGameLanguage()) { // localized
default:
case Common::EN_ANY:
- _textMan->printToLogicalScreen(110, 154, k4_ColorCyan, k0_ColorBlack, "RESTART THIS GAME");
+ _textMan->printToLogicalScreen(110, 154, kDMColorCyan, kDMColorBlack, "RESTART THIS GAME");
break;
case Common::DE_DEU:
- _textMan->printToLogicalScreen(110, 154, k4_ColorCyan, k0_ColorBlack, "DIESES SPIEL NEU STARTEN");
+ _textMan->printToLogicalScreen(110, 154, kDMColorCyan, kDMColorBlack, "DIESES SPIEL NEU STARTEN");
break;
case Common::FR_FRA:
- _textMan->printToLogicalScreen(110, 154, k4_ColorCyan, k0_ColorBlack, "RECOMMENCER CE JEU");
+ _textMan->printToLogicalScreen(110, 154, kDMColorCyan, kDMColorBlack, "RECOMMENCER CE JEU");
break;
}
@@ -696,7 +695,7 @@ T0444017:
_eventMan->showMouse();
if (_restartGameRequest) {
_displayMan->startEndFadeToPalette(darkBluePalette);
- _displayMan->fillScreen(k0_ColorBlack);
+ _displayMan->fillScreen(kDMColorBlack);
_displayMan->startEndFadeToPalette(_displayMan->_palDungeonView[0]);
_newGameFl = k0_modeLoadSavedGame;
if (loadgame(1) != kDMLoadgameFailure) {
@@ -712,7 +711,7 @@ T0444017:
_displayMan->startEndFadeToPalette(darkBluePalette);
}
Box box(0, 319, 0, 199);
- _displayMan->blitToScreen(_displayMan->getNativeBitmapOrGraphic(k5_creditsGraphicIndice), &box, k160_byteWidthScreen, kM1_ColorNoTransparency, k200_heightScreen);
+ _displayMan->blitToScreen(_displayMan->getNativeBitmapOrGraphic(k5_creditsGraphicIndice), &box, k160_byteWidthScreen, kDMColorNoTransparency, k200_heightScreen);
_displayMan->startEndFadeToPalette(_displayMan->_palCredits);
_eventMan->waitForMouseOrKeyActivity();
@@ -767,11 +766,11 @@ void DMEngine::drawEntrance() {
_savedScreenForOpenEntranceDoors = new byte[k200_heightScreen * k160_byteWidthScreen * 2];
memcpy(_savedScreenForOpenEntranceDoors, _displayMan->_bitmapScreen, 320 * 200);
- _displayMan->_useByteBoxCoordinates = false, _displayMan->blitToBitmap(_displayMan->_bitmapScreen, _entranceDoorAnimSteps[8], doorsUpperHalfBox, 0, 30, k160_byteWidthScreen, k128_byteWidth, kM1_ColorNoTransparency, 200, 161);
- _displayMan->_useByteBoxCoordinates = false, _displayMan->blitToBitmap(_displayMan->_bitmapScreen, _entranceDoorAnimSteps[8], doorsLowerHalfBox, 0, 111, k160_byteWidthScreen, k128_byteWidth, kM1_ColorNoTransparency, 200, 161);
+ _displayMan->_useByteBoxCoordinates = false, _displayMan->blitToBitmap(_displayMan->_bitmapScreen, _entranceDoorAnimSteps[8], doorsUpperHalfBox, 0, 30, k160_byteWidthScreen, k128_byteWidth, kDMColorNoTransparency, 200, 161);
+ _displayMan->_useByteBoxCoordinates = false, _displayMan->blitToBitmap(_displayMan->_bitmapScreen, _entranceDoorAnimSteps[8], doorsLowerHalfBox, 0, 111, k160_byteWidthScreen, k128_byteWidth, kDMColorNoTransparency, 200, 161);
- _displayMan->blitToScreen(_entranceDoorAnimSteps[0], &closedDoorLeftBox, k64_byteWidth, kM1_ColorNoTransparency, 161);
- _displayMan->blitToScreen(_entranceDoorAnimSteps[4], &closedDoorRightBox, k64_byteWidth, kM1_ColorNoTransparency, 161);
+ _displayMan->blitToScreen(_entranceDoorAnimSteps[0], &closedDoorLeftBox, k64_byteWidth, kDMColorNoTransparency, 161);
+ _displayMan->blitToScreen(_entranceDoorAnimSteps[4], &closedDoorRightBox, k64_byteWidth, kDMColorNoTransparency, 161);
_displayMan->startEndFadeToPalette(palEntrance);
}
@@ -790,17 +789,17 @@ void DMEngine::openEntranceDoors() {
_sound->play(k02_soundDOOR_RATTLE, 145, 0x40, 0x40);
}
- _displayMan->blitToScreen(_savedScreenForOpenEntranceDoors, &screenBox, 160, kM1_ColorNoTransparency, 200);
+ _displayMan->blitToScreen(_savedScreenForOpenEntranceDoors, &screenBox, 160, kDMColorNoTransparency, 200);
_displayMan->blitToBitmap(leftDoorBitmap, _displayMan->_bitmapScreen, leftDoorBox, leftDoorBlitFrom, 0, 64, k160_byteWidthScreen,
- kM1_ColorNoTransparency, 161, k200_heightScreen);
+ kDMColorNoTransparency, 161, k200_heightScreen);
_displayMan->blitToBitmap(rightDoorBitmap, _displayMan->_bitmapScreen, rightDoorBox, 0, 0, 64, k160_byteWidthScreen,
- kM1_ColorNoTransparency, 161, k200_heightScreen);
+ kDMColorNoTransparency, 161, k200_heightScreen);
_eventMan->discardAllInput();
_displayMan->updateScreen();
- leftDoorBox._x2 -= 4;
+ leftDoorBox._rect.right -= 4;
leftDoorBlitFrom += 4;
- rightDoorBox._x1 += 4;
+ rightDoorBox._rect.left += 4;
delay(3);
}
@@ -827,16 +826,16 @@ void DMEngine::drawTittle() {
blitPalette[i] = D01_RGB_DARK_BLUE;
_displayMan->startEndFadeToPalette(blitPalette);
- _displayMan->fillScreen(k0_ColorBlack);
+ _displayMan->fillScreen(kDMColorBlack);
// uncomment this to draw 'Presents'
//_displayMan->f132_blitToBitmap(L1384_puc_Bitmap_Title, _displayMan->_g348_bitmapScreen, G0005_s_Graphic562_Box_Title_Presents, 0, 137, k160_byteWidthScreen, k160_byteWidthScreen, kM1_ColorNoTransparency, k200_heightScreen, k200_heightScreen);
blitPalette[15] = D09_RGB_WHITE;
_displayMan->startEndFadeToPalette(blitPalette);
byte *masterStrikesBack = titleSteps;
- _displayMan->blitToBitmap(bitmapTitle, masterStrikesBack, boxTitleStrikesBackSource, 0, 80, k160_byteWidthScreen, k160_byteWidthScreen, kM1_ColorNoTransparency, 200, 57);
+ _displayMan->blitToBitmap(bitmapTitle, masterStrikesBack, boxTitleStrikesBackSource, 0, 80, k160_byteWidthScreen, k160_byteWidthScreen, kDMColorNoTransparency, 200, 57);
titleSteps += 320 * 57;
byte *bitmapDungeonChaos = titleSteps; /* Unreferenced on Atari ST */
- _displayMan->blitToBitmap(bitmapTitle, bitmapDungeonChaos, boxTitleDungeonChaos, 0, 0, k160_byteWidthScreen, k160_byteWidthScreen, kM1_ColorNoTransparency, 200, 80);
+ _displayMan->blitToBitmap(bitmapTitle, bitmapDungeonChaos, boxTitleDungeonChaos, 0, 0, k160_byteWidthScreen, k160_byteWidthScreen, kDMColorNoTransparency, 200, 80);
titleSteps += 320 * 80;
bitmapTitle = bitmapDungeonChaos;
uint16 destinationHeight = 12;
@@ -856,7 +855,7 @@ void DMEngine::drawTittle() {
}
blitPalette[15] = D01_RGB_DARK_BLUE;
_displayMan->startEndFadeToPalette(blitPalette);
- _displayMan->fillScreen(k0_ColorBlack);
+ _displayMan->fillScreen(kDMColorBlack);
blitPalette[3] = D05_RGB_DARK_GOLD;
blitPalette[4] = D02_RGB_LIGHT_BROWN;
blitPalette[5] = D06_RGB_GOLD;
@@ -869,11 +868,11 @@ void DMEngine::drawTittle() {
delay(1);
for (int16 i = 0; i < 18; i++) {
delay(2);
- Box box(blitCoordinates[i]);
- _displayMan->blitToBitmap(shrinkedTitle[i], _displayMan->_bitmapScreen, box, 0, 0, blitCoordinates[i][4], k160_byteWidthScreen, kM1_ColorNoTransparency, blitCoordinates[i][3] - blitCoordinates[i][2] + 1, k200_heightScreen);
+ Box box(blitCoordinates[i][0], blitCoordinates[i][1], blitCoordinates[i][2], blitCoordinates[i][3]);
+ _displayMan->blitToBitmap(shrinkedTitle[i], _displayMan->_bitmapScreen, box, 0, 0, blitCoordinates[i][4], k160_byteWidthScreen, kDMColorNoTransparency, blitCoordinates[i][3] - blitCoordinates[i][2] + 1, k200_heightScreen);
}
delay(25);
- _displayMan->blitToBitmap(masterStrikesBack, _displayMan->_bitmapScreen, boxTitleStrikesBackDestination, 0, 0, k160_byteWidthScreen, k160_byteWidthScreen, k0_ColorBlack, 57, k200_heightScreen);
+ _displayMan->blitToBitmap(masterStrikesBack, _displayMan->_bitmapScreen, boxTitleStrikesBackDestination, 0, 0, k160_byteWidthScreen, k160_byteWidthScreen, kDMColorBlack, 57, k200_heightScreen);
blitPalette[10] = D00_RGB_BLACK;
blitPalette[12] = D07_RGB_RED;
_displayMan->startEndFadeToPalette(blitPalette);
@@ -908,7 +907,7 @@ void DMEngine::fuseSequence() {
Thing lordChaosThing = _groupMan->groupGetThing(lordChaosMapX, lordChaosMapY);
Group *lordGroup = (Group*)_dungeonMan->getThingData(lordChaosThing);
lordGroup->_health[0] = 10000;
- _dungeonMan->setGroupCells(lordGroup, k255_CreatureTypeSingleCenteredCreature, _dungeonMan->_partyMapIndex);
+ _dungeonMan->setGroupCells(lordGroup, kDMCreatureTypeSingleCenteredCreature, _dungeonMan->_partyMapIndex);
_dungeonMan->setGroupDirections(lordGroup, returnOppositeDir(_dungeonMan->_partyDir), _dungeonMan->_partyMapIndex);
bool removeFluxcagesFromLordChaosSquare = true;
@@ -937,28 +936,28 @@ void DMEngine::fuseSequence() {
}
fuseSequenceUpdate();
for (int16 attackId = 55; attackId <= 255; attackId += 40) {
- _projexpl->createExplosion(Thing::_explFireBall, attackId, lordChaosMapX, lordChaosMapY, k255_CreatureTypeSingleCenteredCreature);
+ _projexpl->createExplosion(Thing::_explFireBall, attackId, lordChaosMapX, lordChaosMapY, kDMCreatureTypeSingleCenteredCreature);
fuseSequenceUpdate();
}
_sound->requestPlay(k17_soundBUZZ, lordChaosMapX, lordChaosMapY, kDMSoundModePlayIfPrioritized);
- lordGroup->_type = k25_CreatureTypeLordOrder;
+ lordGroup->_type = kDMCreatureTypeLordOrder;
fuseSequenceUpdate();
for (int16 attackId = 55; attackId <= 255; attackId += 40) {
- _projexpl->createExplosion(Thing::_explHarmNonMaterial, attackId, lordChaosMapX, lordChaosMapY, k255_CreatureTypeSingleCenteredCreature);
+ _projexpl->createExplosion(Thing::_explHarmNonMaterial, attackId, lordChaosMapX, lordChaosMapY, kDMCreatureTypeSingleCenteredCreature);
fuseSequenceUpdate();
}
for (int16 cycleCount = 3; cycleCount > 0; cycleCount--) {
for (int16 switchCount = 4; switchCount > 0; switchCount--) {
_sound->requestPlay(k17_soundBUZZ, lordChaosMapX, lordChaosMapY, kDMSoundModePlayIfPrioritized);
- lordGroup->_type = (switchCount & 0x0001) ? k25_CreatureTypeLordOrder : k23_CreatureTypeLordChaos;
+ lordGroup->_type = (switchCount & 0x0001) ? kDMCreatureTypeLordOrder : kDMCreatureTypeLordChaos;
for (int16 fuseSequenceUpdateCount = cycleCount - 1; fuseSequenceUpdateCount >= 0; fuseSequenceUpdateCount--)
fuseSequenceUpdate();
}
}
- _projexpl->createExplosion(Thing::_explFireBall, 255, lordChaosMapX, lordChaosMapY, k255_CreatureTypeSingleCenteredCreature);
- _projexpl->createExplosion(Thing::_explHarmNonMaterial, 255, lordChaosMapX, lordChaosMapY, k255_CreatureTypeSingleCenteredCreature);
+ _projexpl->createExplosion(Thing::_explFireBall, 255, lordChaosMapX, lordChaosMapY, kDMCreatureTypeSingleCenteredCreature);
+ _projexpl->createExplosion(Thing::_explHarmNonMaterial, 255, lordChaosMapX, lordChaosMapY, kDMCreatureTypeSingleCenteredCreature);
fuseSequenceUpdate();
- lordGroup->_type = k26_CreatureTypeGreyLord;
+ lordGroup->_type = kDMCreatureTypeGreyLord;
fuseSequenceUpdate();
_displayMan->_doNotDrawFluxcagesDuringEndgame = true;
fuseSequenceUpdate();
@@ -990,7 +989,7 @@ void DMEngine::fuseSequence() {
if (decodedString[1] == textFirstChar) {
_textMan->clearAllRows();
decodedString[1] = '\n'; /* New line */
- _textMan->printMessage(k15_ColorWhite, &decodedString[1]);
+ _textMan->printMessage(kDMColorWhite, &decodedString[1]);
fuseSequenceUpdate();
delay(780);
textFirstChar++;
@@ -1000,7 +999,7 @@ void DMEngine::fuseSequence() {
}
for (int16 attackId = 55; attackId <= 255; attackId += 40) {
- _projexpl->createExplosion(Thing::_explHarmNonMaterial, attackId, lordChaosMapX, lordChaosMapY, k255_CreatureTypeSingleCenteredCreature);
+ _projexpl->createExplosion(Thing::_explHarmNonMaterial, attackId, lordChaosMapX, lordChaosMapY, kDMCreatureTypeSingleCenteredCreature);
fuseSequenceUpdate();
}
diff --git a/engines/dm/dm.h b/engines/dm/dm.h
index 0a73c05ff0..c346fa0874 100644
--- a/engines/dm/dm.h
+++ b/engines/dm/dm.h
@@ -148,6 +148,8 @@ enum MapIndice {
#define kDMMaskDecodeEvenIfInvisible 0x8000 // @ MASK0x8000_DECODE_EVEN_IF_INVISIBLE
#define kDMMaskMergeCycles 0x8000 // @ MASK0x8000_MERGE_CYCLES
+#define kDMSlotBoxChestFirstSlot 38 // @ C38_SLOT_BOX_CHEST_FIRST_SLOT
+
struct DMADGameDescription {
ADGameDescription _desc;
@@ -304,7 +306,6 @@ public:
bool _stopWaitingForPlayerInput; // @ G0321_B_StopWaitingForPlayerInput
bool _gameTimeTicking; // @ G0301_B_GameTimeTicking
bool _restartGameAllowed; // @ G0524_B_RestartGameAllowed
- int32 _gameId; // @ G0525_l_GameID, probably useless here
bool _pressingEye; // @ G0331_B_PressingEye
bool _stopPressingEye; // @ G0332_B_StopPressingEye
bool _pressingMouth; // @ G0333_B_PressingMouth
diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp
index f6cd250f6d..349388c822 100644
--- a/engines/dm/dungeonman.cpp
+++ b/engines/dm/dungeonman.cpp
@@ -1535,7 +1535,7 @@ void DungeonMan::setGroupDirections(Group *group, int16 dir, uint16 mapIndex) {
}
bool DungeonMan::isCreatureAllowedOnMap(Thing thing, uint16 mapIndex) {
- int16 creatureType = ((Group *)getThingData(thing))->_type;
+ CreatureType creatureType = ((Group *)getThingData(thing))->_type;
Map *map = &_dungeonMaps[mapIndex];
byte *allowedCreatureType = _dungeonMapData[mapIndex][map->_width] + map->_height + 1;
for (int16 L0234_i_Counter = map->_creatureTypeCount; L0234_i_Counter > 0; L0234_i_Counter--) {
diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp
index 65aae1debf..e98f108166 100644
--- a/engines/dm/eventman.cpp
+++ b/engines/dm/eventman.cpp
@@ -458,9 +458,9 @@ void EventManager::setPointerToObject(byte *bitmap) {
memset(L0051_puc_Bitmap, 0, 32 * 18);
_vm->_displayMan->blitToBitmapShrinkWithPalChange(bitmap, _mousePointerTempBuffer, 16, 16, 16, 16, palChangesMousepointerOjbectIconShadow);
- _vm->_displayMan->blitToBitmap(_mousePointerTempBuffer, L0051_puc_Bitmap, boxMousePointerObjectShadow, 0, 0, 8, 16, kM1_ColorNoTransparency, 16, 18);
+ _vm->_displayMan->blitToBitmap(_mousePointerTempBuffer, L0051_puc_Bitmap, boxMousePointerObjectShadow, 0, 0, 8, 16, kDMColorNoTransparency, 16, 18);
_vm->_displayMan->blitToBitmapShrinkWithPalChange(bitmap, _mousePointerTempBuffer, 16, 16, 16, 16, palChangesMousePointerIcon);
- _vm->_displayMan->blitToBitmap(_mousePointerTempBuffer, L0051_puc_Bitmap, boxMousePointerObject, 0, 0, 8, 16, k0_ColorBlack, 16, 18);
+ _vm->_displayMan->blitToBitmap(_mousePointerTempBuffer, L0051_puc_Bitmap, boxMousePointerObject, 0, 0, 8, 16, kDMColorBlack, 16, 18);
_preventBuildPointerScreenArea = false;
buildpointerScreenArea(_mousePos.x, _mousePos.y);
@@ -472,7 +472,7 @@ void EventManager::mouseDropChampionIcon() {
_useChampionIconOrdinalAsMousePointerBitmap = _vm->indexToOrdinal(kDMChampionNone);
_mousePointerBitmapUpdated = true;
bool useByteBoxCoordinatesBackup = _vm->_displayMan->_useByteBoxCoordinates;
- _vm->_displayMan->blitToScreen(_mousePointerOriginalColorsChampionIcon, &_vm->_championMan->_boxChampionIcons[championIconIndex << 2], 16, k12_ColorDarkestGray, 18);
+ _vm->_displayMan->blitToScreen(_mousePointerOriginalColorsChampionIcon, &_vm->_championMan->_boxChampionIcons[championIconIndex << 2], 16, kDMColorDarkestGray, 18);
_vm->_displayMan->_useByteBoxCoordinates = useByteBoxCoordinatesBackup;
_preventBuildPointerScreenArea = false;
}
@@ -862,20 +862,20 @@ void EventManager::processCommandQueue() {
if (cmdType == kDMCommandFreezeGame) {
_vm->_gameTimeTicking = false;
_vm->_menuMan->drawDisabledMenu();
- _vm->_displayMan->fillBitmap(_vm->_displayMan->_bitmapViewport, k0_ColorBlack, 112, 136);
+ _vm->_displayMan->fillBitmap(_vm->_displayMan->_bitmapViewport, kDMColorBlack, 112, 136);
switch (_vm->getGameLanguage()) { // localized
default:
case Common::EN_ANY:
- _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, 81, 69, k4_ColorCyan, k0_ColorBlack,
+ _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, 81, 69, kDMColorCyan, kDMColorBlack,
"GAME FROZEN", k136_heightViewport);
break;
case Common::DE_DEU:
- _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, 66, 69, k4_ColorCyan, k0_ColorBlack,
+ _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, 66, 69, kDMColorCyan, kDMColorBlack,
"SPIEL ANGEHALTEN", k136_heightViewport);
break;
case Common::FR_FRA:
- _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, 84, 69, k4_ColorCyan, k0_ColorBlack,
+ _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, 84, 69, kDMColorCyan, kDMColorBlack,
"JEU BLOQUE", k136_heightViewport);
break;
}
@@ -976,7 +976,7 @@ void EventManager::commandMoveParty(CommandType cmdType) {
}
uint16 movementArrowIdx = cmdType - kDMCommandMoveForward;
Box *highlightBox = &boxMovementArrows[movementArrowIdx];
- commandHighlightBoxEnable(highlightBox->_x1, highlightBox->_x2, highlightBox->_y1, highlightBox->_y2);
+ commandHighlightBoxEnable(highlightBox->_rect.left, highlightBox->_rect.right, highlightBox->_rect.top, highlightBox->_rect.bottom);
int16 partyMapX = _vm->_dungeonMan->_partyMapX;
int16 partyMapY = _vm->_dungeonMan->_partyMapY;
@@ -1172,7 +1172,7 @@ void EventManager::commandProcessType80ClickInDungeonView(int16 posX, int16 posY
if (_vm->_championMan->_leaderEmptyHanded) {
Junk *junkPtr = (Junk*)_vm->_dungeonMan->getSquareFirstThingData(mapX, mapY);
- if ((((Door*)junkPtr)->hasButton()) && _vm->_dungeonMan->_dungeonViewClickableBoxes[k5_ViewCellDoorButtonOrWallOrn].isPointInside(posX, posY - 33)) {
+ if ((((Door*)junkPtr)->hasButton()) && _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn].isPointInside(posX, posY - 33)) {
_vm->_stopWaitingForPlayerInput = true;
_vm->_sound->requestPlay(k01_soundSWITCH, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, kDMSoundModePlayIfPrioritized);
_vm->_moveSens->addEvent(k10_TMEventTypeDoor, mapX, mapY, kDMCellNorthWest, kDMSensorEffectToggle, _vm->_gameTime + 1);
@@ -1183,9 +1183,9 @@ void EventManager::commandProcessType80ClickInDungeonView(int16 posX, int16 posY
}
if (_vm->_championMan->_leaderEmptyHanded) {
- for (uint16 currViewCell = k0_ViewCellFronLeft; currViewCell < k5_ViewCellDoorButtonOrWallOrn + 1; currViewCell++) {
+ for (uint16 currViewCell = kDMViewCellFronLeft; currViewCell < kDMViewCellDoorButtonOrWallOrn + 1; currViewCell++) {
if (_vm->_dungeonMan->_dungeonViewClickableBoxes[currViewCell].isPointInside(posX, posY - 33)) {
- if (currViewCell == k5_ViewCellDoorButtonOrWallOrn) {
+ if (currViewCell == kDMViewCellDoorButtonOrWallOrn) {
if (!_vm->_dungeonMan->_isFacingAlcove)
commandProcessType80ClickInDungeonViewTouchFrontWall();
} else
@@ -1198,15 +1198,15 @@ void EventManager::commandProcessType80ClickInDungeonView(int16 posX, int16 posY
Thing thingHandObject = _vm->_championMan->_leaderHandObject;
Junk *junkPtr = (Junk*)_vm->_dungeonMan->getThingData(thingHandObject);
if (_vm->_dungeonMan->_squareAheadElement == kDMElementTypeWall) {
- for (uint16 currViewCell = k0_ViewCellFronLeft; currViewCell < k1_ViewCellFrontRight + 1; currViewCell++) {
+ for (uint16 currViewCell = kDMViewCellFronLeft; currViewCell < kDMViewCellFrontRight + 1; currViewCell++) {
if (boxObjectPiles[currViewCell].isPointInside(posX, posY)) {
- processType80_clickInDungeonViewDropLeaderHandObject(currViewCell);
+ clickInDungeonViewDropLeaderHandObject(currViewCell);
return;
}
}
- if (_vm->_dungeonMan->_dungeonViewClickableBoxes[k5_ViewCellDoorButtonOrWallOrn].isPointInside(posX, posY - 33)) {
+ if (_vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn].isPointInside(posX, posY - 33)) {
if (_vm->_dungeonMan->_isFacingAlcove)
- processType80_clickInDungeonViewDropLeaderHandObject(k4_ViewCellAlcove);
+ clickInDungeonViewDropLeaderHandObject(kDMViewCellAlcove);
else {
if (_vm->_dungeonMan->_isFacingFountain) {
uint16 iconIdx = _vm->_objectMan->getIconIndex(thingHandObject);
@@ -1229,9 +1229,9 @@ void EventManager::commandProcessType80ClickInDungeonView(int16 posX, int16 posY
if (isLeaderHandObjThrown(posX, posY))
return;
- for (uint16 currViewCell = k0_ViewCellFronLeft; currViewCell < k3_ViewCellBackLeft + 1; currViewCell++) {
+ for (uint16 currViewCell = kDMViewCellFronLeft; currViewCell < kDMViewCellBackLeft + 1; currViewCell++) {
if (boxObjectPiles[currViewCell].isPointInside(posX, posY)) {
- processType80_clickInDungeonViewDropLeaderHandObject(currViewCell);
+ clickInDungeonViewDropLeaderHandObject(currViewCell);
return;
}
}
@@ -1255,13 +1255,13 @@ void EventManager::commandProcessCommands160To162ClickInResurrectReincarnatePane
}
champMan._partyChampionCount--;
Box box;
- box._y1 = 0;
- box._y2 = 28;
- box._x1 = championIndex * k69_ChampionStatusBoxSpacing;
- box._x2 = box._x1 + 66;
+ box._rect.top = 0;
+ box._rect.bottom = 28;
+ box._rect.left = championIndex * kDMChampionStatusBoxSpacing;
+ box._rect.right = box._rect.left + 66;
dispMan._useByteBoxCoordinates = false;
- dispMan.fillScreenBox(box, k0_ColorBlack);
- dispMan.fillScreenBox(_vm->_championMan->_boxChampionIcons[champMan.getChampionIconIndex(champ->_cell, dunMan._partyDir) * 2], k0_ColorBlack);
+ dispMan.fillScreenBox(box, kDMColorBlack);
+ dispMan.fillScreenBox(_vm->_championMan->_boxChampionIcons[champMan.getChampionIconIndex(champ->_cell, dunMan._partyDir) * 2], kDMColorBlack);
_vm->_menuMan->drawEnabledMenus();
showMouse();
return;
@@ -1334,14 +1334,14 @@ void EventManager::commandProcess81ClickInPanel(int16 x, int16 y) {
CommandType commandType;
switch (invMan._panelContent) {
- case k4_PanelContentChest:
+ case kDMPanelContentChest:
if (champMan._leaderIndex == kDMChampionNone) // if no leader
return;
commandType = getCommandTypeFromMouseInput(_mouseInputPanelChest, Common::Point(x, y), kDMMouseButtonLeft);
if (commandType != kDMCommandNone)
_vm->_championMan->clickOnSlotBox(commandType - kDMCommandClickOnSlotBoxChampion0StatusBoxReadyHand);
break;
- case k5_PanelContentResurrectReincarnate:
+ case kDMPanelContentResurrectReincarnate:
if (!champMan._leaderEmptyHanded)
break;
commandType = getCommandTypeFromMouseInput(_mouseInputPanelResurrectReincarnateCancel, Common::Point(x, y), kDMMouseButtonLeft);
@@ -1359,7 +1359,7 @@ void EventManager::processType80_clickInDungeonView_grabLeaderHandObject(uint16
int16 mapX = _vm->_dungeonMan->_partyMapX;
int16 mapY = _vm->_dungeonMan->_partyMapY;
- if (viewCell >= k2_ViewCellBackRight) {
+ if (viewCell >= kDMViewCellBackRight) {
mapX += _vm->_dirIntoStepCountEast[_vm->_dungeonMan->_partyDir], mapY += _vm->_dirIntoStepCountNorth[_vm->_dungeonMan->_partyDir];
Thing groupThing = _vm->_groupMan->groupGetThing(mapX, mapY);
if ((groupThing != Thing::_endOfList) &&
@@ -1378,17 +1378,17 @@ void EventManager::processType80_clickInDungeonView_grabLeaderHandObject(uint16
_vm->_stopWaitingForPlayerInput = true;
}
-void EventManager::processType80_clickInDungeonViewDropLeaderHandObject(uint16 viewCell) {
+void EventManager::clickInDungeonViewDropLeaderHandObject(uint16 viewCell) {
if (_vm->_championMan->_leaderIndex == kDMChampionNone)
return;
int16 mapX = _vm->_dungeonMan->_partyMapX;
int16 mapY = _vm->_dungeonMan->_partyMapY;
- bool droppingIntoAnAlcove = (viewCell == k4_ViewCellAlcove);
+ bool droppingIntoAnAlcove = (viewCell == kDMViewCellAlcove);
if (droppingIntoAnAlcove)
- viewCell = k2_ViewCellBackRight;
+ viewCell = kDMViewCellBackRight;
- if (viewCell > k1_ViewCellFrontRight)
+ if (viewCell > kDMViewCellFrontRight)
mapX += _vm->_dirIntoStepCountEast[_vm->_dungeonMan->_partyDir], mapY += _vm->_dirIntoStepCountNorth[_vm->_dungeonMan->_partyDir];
uint16 currCell = _vm->normalizeModulo4(_vm->_dungeonMan->_partyDir + viewCell);
@@ -1417,17 +1417,17 @@ bool EventManager::hasPendingClick(Common::Point& point, MouseButton button) {
}
void EventManager::drawSleepScreen() {
- _vm->_displayMan->fillBitmap(_vm->_displayMan->_bitmapViewport, k0_ColorBlack, 112, 136);
+ _vm->_displayMan->fillBitmap(_vm->_displayMan->_bitmapViewport, kDMColorBlack, 112, 136);
switch (_vm->getGameLanguage()) { // localized
default:
case Common::EN_ANY:
- _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, 93, 69, k4_ColorCyan, k0_ColorBlack, "WAKE UP", k136_heightViewport);
+ _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, 93, 69, kDMColorCyan, kDMColorBlack, "WAKE UP", k136_heightViewport);
break;
case Common::DE_DEU:
- _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, 96, 69, k4_ColorCyan, k0_ColorBlack, "WECKEN", k136_heightViewport);
+ _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, 96, 69, kDMColorCyan, kDMColorBlack, "WECKEN", k136_heightViewport);
break;
case Common::FR_FRA:
- _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, 72, 69, k4_ColorCyan, k0_ColorBlack, "REVEILLEZ-VOUS", k136_heightViewport);
+ _vm->_textMan->printTextToBitmap(_vm->_displayMan->_bitmapViewport, k112_byteWidthViewport, 72, 69, kDMColorCyan, kDMColorBlack, "REVEILLEZ-VOUS", k136_heightViewport);
break;
}
}
@@ -1479,10 +1479,10 @@ void EventManager::mouseProcessCommands125To128_clickOnChampionIcon(uint16 champ
memset(tmpBitmap, 0, 32 * 18);
Box *curChampionIconBox = &_vm->_championMan->_boxChampionIcons[champIconIndex];
- _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapScreen, tmpBitmap, championIconShadowBox, curChampionIconBox->_x1, curChampionIconBox->_y1, k160_byteWidthScreen, k16_byteWidth, k0_ColorBlack, 200, 18);
+ _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapScreen, tmpBitmap, championIconShadowBox, curChampionIconBox->_rect.left, curChampionIconBox->_rect.top, k160_byteWidthScreen, k16_byteWidth, kDMColorBlack, 200, 18);
_vm->_displayMan->blitToBitmapShrinkWithPalChange(tmpBitmap, _mousePointerOriginalColorsChampionIcon, 32, 18, 32, 18, mousePointerIconShadowBox);
- _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapScreen, _mousePointerOriginalColorsChampionIcon, championIconBox, curChampionIconBox->_x1, curChampionIconBox->_y1, k160_byteWidthScreen, k16_byteWidth, k0_ColorBlack, 200, 18);
- _vm->_displayMan->fillScreenBox(*curChampionIconBox, k0_ColorBlack);
+ _vm->_displayMan->blitToBitmap(_vm->_displayMan->_bitmapScreen, _mousePointerOriginalColorsChampionIcon, championIconBox, curChampionIconBox->_rect.left, curChampionIconBox->_rect.top, k160_byteWidthScreen, k16_byteWidth, kDMColorBlack, 200, 18);
+ _vm->_displayMan->fillScreenBox(*curChampionIconBox, kDMColorBlack);
_useChampionIconOrdinalAsMousePointerBitmap = _vm->indexToOrdinal(champIconIndex);
} else {
_mousePointerBitmapUpdated = true;
@@ -1499,7 +1499,7 @@ void EventManager::mouseProcessCommands125To128_clickOnChampionIcon(uint16 champ
setFlag(_vm->_championMan->_champions[championIndex]._attributes, kDMAttributeIcon);
_vm->_championMan->drawChampionState((ChampionIndex)championIndex);
} else
- _vm->_displayMan->fillScreenBox(_vm->_championMan->_boxChampionIcons[championIconIndex], k0_ColorBlack);
+ _vm->_displayMan->fillScreenBox(_vm->_championMan->_boxChampionIcons[championIconIndex], kDMColorBlack);
_vm->_championMan->_champions[championCellIndex]._cell = (ViewCell)_vm->normalizeModulo4(champIconIndex + _vm->_dungeonMan->_partyDir);
setFlag(_vm->_championMan->_champions[championCellIndex]._attributes, kDMAttributeIcon);
@@ -1587,7 +1587,7 @@ void EventManager::commandProcessTypes101To108_clickInSpellSymbolsArea(CommandTy
uint16 symbolIndex = cmdType - kDMCommandClickInSpellAreaSymbol1;
Box *highlightBox = &spellSymbolsAndDelete[symbolIndex];
- commandHighlightBoxEnable(highlightBox->_x1, highlightBox->_x2, highlightBox->_y1, highlightBox->_y2);
+ commandHighlightBoxEnable(highlightBox->_rect.left, highlightBox->_rect.right, highlightBox->_rect.top, highlightBox->_rect.bottom);
_vm->delay(1);
highlightBoxDisable();
@@ -1665,7 +1665,7 @@ void EventManager::commandHighlightBoxEnable(int16 x1, int16 x2, int16 y1, int16
void EventManager::highlightBoxDisable() {
if (_highlightBoxEnabled == true) {
- highlightScreenBox(_highlightScreenBox._x1, _highlightScreenBox._x2, _highlightScreenBox._y1, _highlightScreenBox._y2);
+ highlightScreenBox(_highlightScreenBox._rect.left, _highlightScreenBox._rect.right, _highlightScreenBox._rect.top, _highlightScreenBox._rect.bottom);
_highlightBoxEnabled = false;
}
}
diff --git a/engines/dm/eventman.h b/engines/dm/eventman.h
index ac0ed7459e..7558ece938 100644
--- a/engines/dm/eventman.h
+++ b/engines/dm/eventman.h
@@ -272,7 +272,7 @@ public:
void commandProcessCommands160To162ClickInResurrectReincarnatePanel(CommandType commandType); // @ F0282_CHAMPION_ProcessCommands160To162_ClickInResurrectReincarnatePanel
void commandProcess81ClickInPanel(int16 x, int16 y); // @ F0378_COMMAND_ProcessType81_ClickInPanel
void processType80_clickInDungeonView_grabLeaderHandObject(uint16 viewCell); // @ F0373_COMMAND_ProcessType80_ClickInDungeonView_GrabLeaderHandObject
- void processType80_clickInDungeonViewDropLeaderHandObject(uint16 viewCell); // @ F0374_COMMAND_ProcessType80_ClickInDungeonView_DropLeaderHandObject
+ void clickInDungeonViewDropLeaderHandObject(uint16 viewCell); // @ F0374_COMMAND_ProcessType80_ClickInDungeonView_DropLeaderHandObject
bool hasPendingClick(Common::Point &point, MouseButton button); // @ F0360_COMMAND_ProcessPendingClick
void drawSleepScreen(); // @ F0379_COMMAND_DrawSleepScreen
diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp
index 875d3c780c..a629c56cd9 100644
--- a/engines/dm/gfx.cpp
+++ b/engines/dm/gfx.cpp
@@ -41,6 +41,22 @@
#include "dm/text.h"
namespace DM {
+
+DoorFrames::DoorFrames(Frame f1, Frame f2_1, Frame f2_2, Frame f2_3,
+ Frame f3_1, Frame f3_2, Frame f3_3,
+ Frame f4_1, Frame f4_2, Frame f4_3) {
+ _closedOrDestroyed = f1;
+ _vertical[0] = f2_1;
+ _vertical[1] = f2_2;
+ _vertical[2] = f2_3;
+ _leftHorizontal[0] = f3_1;
+ _leftHorizontal[1] = f3_2;
+ _leftHorizontal[2] = f3_3;
+ _rightHorizontal[0] = f4_1;
+ _rightHorizontal[1] = f4_2;
+ _rightHorizontal[2] = f4_3;
+}
+
DisplayMan::DisplayMan(DMEngine *dmEngine) : _vm(dmEngine) {
_bitmapScreen = nullptr;
_bitmaps = nullptr;
@@ -475,7 +491,7 @@ void DisplayMan::setUpScreens(uint16 width, uint16 height) {
delete[] _tmpBitmap;
delete[] _bitmapScreen;
_bitmapScreen = new byte[_screenWidth * _screenHeight];
- fillScreen(k0_ColorBlack);
+ fillScreen(kDMColorBlack);
_tmpBitmap = new byte[_screenWidth * _screenHeight];
}
@@ -509,17 +525,17 @@ void DisplayMan::initializeGraphicData() {
_derivedBitmaps[i] = nullptr;
}
- _derivedBitmapByteCount[k0_DerivedBitmapViewport] = 112 * 136;
- _derivedBitmapByteCount[k1_DerivedBitmapThievesEyeVisibleArea] = 48 * 95;
- _derivedBitmapByteCount[k2_DerivedBitmapDamageToCreatureMedium] = 32 * 37;
- _derivedBitmapByteCount[k3_DerivedBitmapDamageToCreatureSmall] = 24 * 37;
+ _derivedBitmapByteCount[kDMDerivedBitmapViewport] = 112 * 136;
+ _derivedBitmapByteCount[kDMDerivedBitmapThievesEyeVisibleArea] = 48 * 95;
+ _derivedBitmapByteCount[kDMDerivedBitmapDamageToCreatureMedium] = 32 * 37;
+ _derivedBitmapByteCount[kDMDerivedBitmapDamageToCreatureSmall] = 24 * 37;
for (int16 doorOrnamentIndex = k15_DoorOrnDestroyedMask; doorOrnamentIndex <= k16_DoorOrnThivesEyeMask; doorOrnamentIndex++) {
_currMapDoorOrnInfo[doorOrnamentIndex].nativeIndice = doorOrnamentIndex + (k301_DoorMaskDestroyedIndice - k15_DoorOrnDestroyedMask);
_currMapDoorOrnInfo[doorOrnamentIndex].coordinateSet = 1;
- _derivedBitmapByteCount[doorOrnamentIndex * 2 + k68_DerivedBitmapFirstDoorOrnament_D3] = 24 * 41;
- _derivedBitmapByteCount[doorOrnamentIndex * 2 + k69_DerivedBitmapFirstDoorOrnament_D2] = 32 * 61;
+ _derivedBitmapByteCount[doorOrnamentIndex * 2 + kDMDerivedBitmapFirstDoorOrnamentD3] = 24 * 41;
+ _derivedBitmapByteCount[doorOrnamentIndex * 2 + kDMDerivedBitmapFirstDoorOrnamentD2] = 32 * 61;
}
_currMapFloorOrnInfo[k15_FloorOrnFootprints].nativeIndice = k241_FloorOrn_15_D3L_footprints;
@@ -528,7 +544,7 @@ void DisplayMan::initializeGraphicData() {
ObjectAspect *objectAspect = _objectAspects209;
int16 derivedBitmapIndex;
for (int16 objectAspectIndex = 0; objectAspectIndex < k85_ObjAspectCount; ++objectAspectIndex, ++objectAspect) {
- derivedBitmapIndex = k104_DerivedBitmapFirstObject + objectAspect->_firstDerivedBitmapRelativeIndex;
+ derivedBitmapIndex = kDMDerivedBitmapFirstObject + objectAspect->_firstDerivedBitmapRelativeIndex;
_derivedBitmapByteCount[derivedBitmapIndex++] = getScaledBitmapByteCount(objectAspect->_byteWidth, objectAspect->_height, k16_Scale_D3);
_derivedBitmapByteCount[derivedBitmapIndex++] = getScaledBitmapByteCount(objectAspect->_byteWidth, objectAspect->_height, k20_Scale_D2);
@@ -550,7 +566,7 @@ void DisplayMan::initializeGraphicData() {
ProjectileAspect *projectileAspect = _projectileAspect;
for (int16 projectileAspectIndex = 0; projectileAspectIndex < k14_ProjectileAspectCount; projectileAspectIndex++, projectileAspect++) {
if (!getFlag(projectileAspect->_graphicInfo, k0x0100_ProjectileScaleWithKineticEnergyMask)) {
- derivedBitmapIndex = k282_DerivedBitmapFirstProjectile + projectileAspect->_firstDerivedBitmapRelativeIndex;
+ derivedBitmapIndex = kDMDerivedBitmapFirstProjectile + projectileAspect->_firstDerivedBitmapRelativeIndex;
for (int16 projectileScaleIndex = 0; projectileScaleIndex < 6; projectileScaleIndex++) {
int16 bitmapByteCount = getScaledBitmapByteCount(projectileAspect->_byteWidth, projectileAspect->_height, _projectileScales[projectileScaleIndex]);
@@ -570,17 +586,17 @@ void DisplayMan::initializeGraphicData() {
_palChangesProjectile[1] = _palChangesFloorOrnD2;
_palChangesProjectile[2] = _palChangesProjectile[3] = _palChangesNoChanges;
- derivedBitmapIndex = k438_DerivedBitmapFirstExplosion;
+ derivedBitmapIndex = kDMDerivedBitmapFirstExplosion;
ExplosionAspect *expAsp = _explosionAspects;
for (uint16 expAspIndex = 0; expAspIndex < k4_ExplosionAspectCount; ++expAspIndex, expAsp++) {
for (int16 scale = 4; scale < 32; scale += 2)
_derivedBitmapByteCount[derivedBitmapIndex++] = getScaledBitmapByteCount(expAsp->_byteWidth, expAsp->_height, scale);
- if (expAspIndex == k3_ExplosionAspectSmoke)
+ if (expAspIndex == kDMExplosionAspectSmoke)
_derivedBitmapByteCount[derivedBitmapIndex++] = expAsp->_byteWidth * expAsp->_height;
}
- derivedBitmapIndex = k495_DerivedBitmapFirstCreature;
+ derivedBitmapIndex = kDMDerivedBitmapFirstCreature;
CreatureAspect *creatureAsp;
for (int16 creatureIndex = 0; creatureIndex < k27_CreatureTypeCount; creatureIndex++) {
creatureAsp = &_creatureAspects219[creatureIndex];
@@ -594,22 +610,22 @@ void DisplayMan::initializeGraphicData() {
int16 creatureFrontBitmapD2PixelCount = getScaledBitmapByteCount(creatureAsp->_byteWidthFront, creatureAsp->_heightFront, k20_Scale_D2);
_derivedBitmapByteCount[derivedBitmapIndex++] = creatureFrontBitmapD2PixelCount;
- if (getFlag(creatureGraphicInfo, k0x0008_CreatureInfoGraphicMaskSide)) {
+ if (getFlag(creatureGraphicInfo, kDMCreatureMaskSide)) {
_derivedBitmapByteCount[derivedBitmapIndex++] = getScaledBitmapByteCount(creatureAsp->_byteWidthSide, creatureAsp->_heightSide, k16_Scale_D3);
_derivedBitmapByteCount[derivedBitmapIndex++] = getScaledBitmapByteCount(creatureAsp->_byteWidthSide, creatureAsp->_heightSide, k20_Scale_D2);
}
- if (getFlag(creatureGraphicInfo, k0x0010_CreatureInfoGraphicMaskBack)) {
+ if (getFlag(creatureGraphicInfo, kDMCreatureMaskBack)) {
_derivedBitmapByteCount[derivedBitmapIndex++] = creatureFrontBitmapD3PixelCount;
_derivedBitmapByteCount[derivedBitmapIndex++] = creatureFrontBitmapD2PixelCount;
}
- if (getFlag(creatureGraphicInfo, k0x0020_CreatureInfoGraphicMaskAttack)) {
+ if (getFlag(creatureGraphicInfo, kDMCreatureMaskAttack)) {
_derivedBitmapByteCount[derivedBitmapIndex++] = getScaledBitmapByteCount(creatureAsp->_byteWidthAttack, creatureAsp->_heightAttack, k16_Scale_D3);
_derivedBitmapByteCount[derivedBitmapIndex++] = getScaledBitmapByteCount(creatureAsp->_byteWidthAttack, creatureAsp->_heightAttack, k20_Scale_D2);
}
- int16 additionalFronGraphicCount = getFlag(creatureGraphicInfo, k0x0003_CreatureInfoGraphicMaskAdditional);
+ int16 additionalFronGraphicCount = getFlag(creatureGraphicInfo, kDMCreatureMaskAdditional);
if (additionalFronGraphicCount) {
do {
_derivedBitmapByteCount[derivedBitmapIndex++] = creatureAsp->_byteWidthFront * creatureAsp->_heightFront;
@@ -691,12 +707,12 @@ void DisplayMan::unpackGraphics() {
loadFNT1intoBitmap(k557_FontGraphicIndice, _bitmaps[k557_FontGraphicIndice]);
}
-void DisplayMan::loadFNT1intoBitmap(uint16 index, byte * destBitmap) {
+void DisplayMan::loadFNT1intoBitmap(uint16 index, byte *destBitmap) {
uint8 *data = _packedBitmaps + _packedItemPos[index];
for (uint16 i = 0; i < 6; i++) {
for (uint16 w = 0; w < 128; ++w) {
- *destBitmap++ = k0_ColorBlack;
+ *destBitmap++ = kDMColorBlack;
uint16 nextByte = *data++;
for (int16 pixel = 4; pixel >= 0; --pixel) {
@@ -714,10 +730,10 @@ void DisplayMan::allocateFlippedWallBitmaps() {
_bitmapWallD0RFlipped = new byte[32 * 136];
}
-void DisplayMan::drawDoorBitmap(Frame* frame) {
+void DisplayMan::drawDoorBitmap(Frame *frame) {
if (frame->_srcByteWidth) {
blitToBitmap(_tmpBitmap, _bitmapViewport, frame->_box, frame->_srcX, frame->_srcY,
- frame->_srcByteWidth, k112_byteWidthViewport, k10_ColorFlesh, frame->_srcHeight, k136_heightViewport);
+ frame->_srcByteWidth, k112_byteWidthViewport, kDMColorFlesh, frame->_srcHeight, k136_heightViewport);
}
}
@@ -725,7 +741,7 @@ void DisplayMan::drawDoorFrameBitmapFlippedHorizontally(byte *bitmap, Frame *fra
if (frame->_srcByteWidth) {
flipBitmapHorizontal(bitmap, frame->_srcByteWidth, frame->_srcHeight);
blitToBitmap(bitmap, _bitmapViewport, frame->_box, frame->_srcX, frame->_srcY,
- frame->_srcByteWidth, k112_byteWidthViewport, k10_ColorFlesh, frame->_srcHeight, k136_heightViewport);
+ frame->_srcByteWidth, k112_byteWidthViewport, kDMColorFlesh, frame->_srcHeight, k136_heightViewport);
}
}
@@ -753,12 +769,12 @@ void DisplayMan::drawDoorButton(int16 doorButtonOrdinal, DoorButton doorButton)
if (doorButton == kDMDoorButtonD1C) {
bitmap = getNativeBitmapOrGraphic(nativeBitmapIndex);
- _vm->_dungeonMan->_dungeonViewClickableBoxes[k5_ViewCellDoorButtonOrWallOrn]._x1 = coordSetRedEagle[0];
- _vm->_dungeonMan->_dungeonViewClickableBoxes[k5_ViewCellDoorButtonOrWallOrn]._x2 = coordSetRedEagle[1];
- _vm->_dungeonMan->_dungeonViewClickableBoxes[k5_ViewCellDoorButtonOrWallOrn]._y1 = coordSetRedEagle[2];
- _vm->_dungeonMan->_dungeonViewClickableBoxes[k5_ViewCellDoorButtonOrWallOrn]._y2 = coordSetRedEagle[3];
+ _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn]._rect.left = coordSetRedEagle[0];
+ _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn]._rect.right = coordSetRedEagle[1];
+ _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn]._rect.top = coordSetRedEagle[2];
+ _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn]._rect.bottom = coordSetRedEagle[3];
} else {
- doorButtonOrdinal = k102_DerivedBitmapFirstDoorButton + (doorButtonOrdinal * 2) + ((doorButton != kDMDoorButtonD3R) ? 0 : (int16)doorButton - 1);
+ doorButtonOrdinal = kDMDerivedBitmapFirstDoorButton + (doorButtonOrdinal * 2) + ((doorButton != kDMDoorButtonD3R) ? 0 : (int16)doorButton - 1);
if (!isDerivedBitmapInCache(doorButtonOrdinal)) {
uint16 *coordSetBlueGoat = doorButtonCoordSets[coordSet][kDMDoorButtonD1C];
byte *bitmapNative = getNativeBitmapOrGraphic(nativeBitmapIndex);
@@ -773,12 +789,13 @@ void DisplayMan::drawDoorButton(int16 doorButtonOrdinal, DoorButton doorButton)
}
bitmap = getDerivedBitmap(doorButtonOrdinal);
}
- blitToBitmap(bitmap, _bitmapViewport, *(Box *)coordSetRedEagle, 0, 0,
- coordSetRedEagle[4], k112_byteWidthViewport, k10_ColorFlesh, coordSetRedEagle[5], k136_heightViewport);
+ Box blitBox(coordSetRedEagle[0], coordSetRedEagle[1], coordSetRedEagle[2], coordSetRedEagle[3]);
+ blitToBitmap(bitmap, _bitmapViewport, blitBox, 0, 0,
+ coordSetRedEagle[4], k112_byteWidthViewport, kDMColorFlesh, coordSetRedEagle[5], k136_heightViewport);
}
}
-void DisplayMan::viewportSetPalette(uint16* middleScreenPalette, uint16* topAndBottomScreen) {
+void DisplayMan::viewportSetPalette(uint16 *middleScreenPalette, uint16 *topAndBottomScreen) {
if (middleScreenPalette && topAndBottomScreen)
buildPaletteChangeCopperList(middleScreenPalette, topAndBottomScreen);
@@ -788,7 +805,7 @@ void DisplayMan::viewportSetPalette(uint16* middleScreenPalette, uint16* topAndB
void DisplayMan::viewportBlitToScreen() {
Box box(0, 223, 33, 168);
- blitToBitmap(_bitmapViewport, _bitmapScreen, box, 0, 0, k112_byteWidthViewport, k160_byteWidthScreen, kM1_ColorNoTransparency,
+ blitToBitmap(_bitmapViewport, _bitmapScreen, box, 0, 0, k112_byteWidthViewport, k160_byteWidthScreen, kDMColorNoTransparency,
k136_heightViewport, k200_heightScreen);
}
@@ -846,27 +863,27 @@ void DisplayMan::blitToBitmap(byte *srcBitmap, byte *destBitmap, const Box &box,
uint16 destByteWidth, Color transparent, int16 srcHeight, int16 destHight) {
uint16 srcWidth = srcByteWidth * 2;
uint16 destWidth = destByteWidth * 2;
- for (uint16 y = 0; y < box._y2 + 1 - box._y1; ++y) { // + 1 for inclusive boundaries
- for (uint16 x = 0; x < box._x2 + 1 - box._x1; ++x) { // + 1 for inclusive boundaries
+ for (uint16 y = 0; y < box._rect.bottom + 1 - box._rect.top; ++y) { // + 1 for inclusive boundaries
+ for (uint16 x = 0; x < box._rect.right + 1 - box._rect.left; ++x) { // + 1 for inclusive boundaries
if (srcX + x < srcWidth && y + srcY < srcHeight
- && box._x1 + x < destWidth && y + box._y1 < destHight) {
+ && box._rect.left + x < destWidth && y + box._rect.top < destHight) {
byte srcPixel = srcBitmap[srcWidth * (y + srcY) + srcX + x];
if (srcPixel != transparent)
- destBitmap[destWidth * (y + box._y1) + box._x1 + x] = srcPixel;
+ destBitmap[destWidth * (y + box._rect.top) + box._rect.left + x] = srcPixel;
}
}
}
}
void DisplayMan::fillScreenBox(Box &box, Color color) {
- uint16 width = box._x2 + 1 - box._x1; // + 1 for inclusive boundaries
- for (int16 y = box._y1; y < box._y2 + 1; ++y) // + 1 for inclusive boundaries
- memset(_bitmapScreen + y * _screenWidth + box._x1, color, sizeof(byte) * width);
+ uint16 width = box._rect.right + 1 - box._rect.left; // + 1 for inclusive boundaries
+ for (int16 y = box._rect.top; y < box._rect.bottom + 1; ++y) // + 1 for inclusive boundaries
+ memset(_bitmapScreen + y * _screenWidth + box._rect.left, color, sizeof(byte) * width);
}
void DisplayMan::fillBoxBitmap(byte *destBitmap, Box &box, Color color, int16 byteWidth, int16 height) {
- for (int16 y = box._y1; y < box._y2 + 1; ++y) // + 1 for inclusive boundaries
- memset(destBitmap + y * byteWidth * 2 + box._x1, color, sizeof(byte) * (box._x2 - box._x1 + 1)); // + 1 for inclusive boundaries
+ for (int16 y = box._rect.top; y < box._rect.bottom + 1; ++y) // + 1 for inclusive boundaries
+ memset(destBitmap + y * byteWidth * 2 + box._rect.left, color, sizeof(byte) * (box._rect.right - box._rect.left + 1)); // + 1 for inclusive boundaries
}
void DisplayMan::blitBoxFilledWithMaskedBitmap(byte *src, byte *dest, byte *mask, byte *tmp, Box& box,
@@ -878,8 +895,8 @@ void DisplayMan::blitBoxFilledWithMaskedBitmap(byte *src, byte *dest, byte *mask
byte nextUnitIndex = firstUnitIndex;
bool useMask = !(transparent & k0x0080_BlitDoNotUseMask);
transparent = (Color)(transparent & ~(k0x0080_BlitDoNotUseMask)); // clear flag 0x0080
- for (byte next_y = box._y1; next_y <= box._y2; next_y++) { // '<=' for inclusive boundaries
- for (byte next_x = box._x1; next_x <= box._x2; next_x++) { // '<=' for inclusive boundaries
+ for (byte next_y = box._rect.top; next_y <= box._rect.bottom; next_y++) { // '<=' for inclusive boundaries
+ for (byte next_x = box._rect.left; next_x <= box._rect.right; next_x++) { // '<=' for inclusive boundaries
byte *nextDestPixel = dest + next_y * destByteWidth * 2 + next_x;
byte nextSrcPixel = src[nextUnitIndex];
@@ -924,16 +941,16 @@ byte *DisplayMan::getExplosionBitmap(uint16 explosionAspIndex, uint16 scale, int
int16 pixelWidth = getScaledDimension(explAsp->_byteWidth, scale);
int16 height = getScaledDimension(explAsp->_height, scale);
byte *bitmap;
- int16 derBitmapIndex = (explosionAspIndex * 14) + scale / 2 + k438_DerivedBitmapFirstExplosion - 2;
- if ((scale == 32) && (explosionAspIndex != k3_ExplosionAspectSmoke))
+ int16 derBitmapIndex = (explosionAspIndex * 14) + scale / 2 + kDMDerivedBitmapFirstExplosion - 2;
+ if ((scale == 32) && (explosionAspIndex != kDMExplosionAspectSmoke))
bitmap = getNativeBitmapOrGraphic(explosionAspIndex + k348_FirstExplosionGraphicIndice);
else if (isDerivedBitmapInCache(derBitmapIndex))
bitmap = getDerivedBitmap(derBitmapIndex);
else {
- byte *nativeBitmap = getNativeBitmapOrGraphic(MIN(explosionAspIndex, (uint16)k2_ExplosionAspectPoison) + k348_FirstExplosionGraphicIndice);
+ byte *nativeBitmap = getNativeBitmapOrGraphic(MIN(explosionAspIndex, (uint16)kDMExplosionAspectPoison) + k348_FirstExplosionGraphicIndice);
bitmap = getDerivedBitmap(derBitmapIndex);
blitToBitmapShrinkWithPalChange(nativeBitmap, bitmap, explAsp->_byteWidth, explAsp->_height, pixelWidth * 2, height,
- (explosionAspIndex == k3_ExplosionAspectSmoke) ? _palChangeSmoke : _palChangesNoChanges);
+ (explosionAspIndex == kDMExplosionAspectSmoke) ? _palChangeSmoke : _palChangesNoChanges);
addDerivedBitmap(derBitmapIndex);
}
@@ -1072,15 +1089,15 @@ void DisplayMan::drawFloorOrnament(uint16 floorOrnOrdinal, ViewFloor viewFloorIn
} else
bitmap = getNativeBitmapOrGraphic(nativeBitmapIndex);
- blitToBitmap(bitmap, _bitmapViewport,
- *(Box *)coordSets, 0, 0, coordSets[4], k112_byteWidthViewport, k10_ColorFlesh, coordSets[5], k136_heightViewport);
+ Box blitBox(coordSets[0], coordSets[1], coordSets[2], coordSets[3]);
+ blitToBitmap(bitmap, _bitmapViewport, blitBox, 0, 0, coordSets[4], k112_byteWidthViewport, kDMColorFlesh, coordSets[5], k136_heightViewport);
}
if (drawFootprints)
drawFloorOrnament(_vm->indexToOrdinal(k15_FloorOrnFootprints), viewFloorIndex);
}
-void DisplayMan::drawDoor(uint16 doorThingIndex, DoorState doorState, int16* doorNativeBitmapIndices, int16 byteCount, DoorOrnament doorOrnament, DoorFrames* doorFrames) {
+void DisplayMan::drawDoor(uint16 doorThingIndex, DoorState doorState, int16 *doorNativeBitmapIndices, int16 byteCount, DoorOrnament doorOrnament, DoorFrames *doorFrames) {
if (doorState == kDMDoorStateOpen)
return;
@@ -1160,7 +1177,7 @@ void DisplayMan::drawDoorOrnament(int16 doorOrnOrdinal, DoorOrnament doorOrnamen
byteWidth = k48_byteWidth;
height = 88;
} else {
- height = k68_DerivedBitmapFirstDoorOrnament_D3 + (height * 2) + doorOrnament;
+ height = kDMDerivedBitmapFirstDoorOrnamentD3 + (height * 2) + doorOrnament;
if (!isDerivedBitmapInCache(height)) {
uint16 *coordSetRedEagle = &doorOrnCoordSets[coordSetGreenToad][kDMDoorOrnamentD1LCR][0];
byte *nativeBitmap = getNativeBitmapOrGraphic(nativeBitmapIndex);
@@ -1178,7 +1195,7 @@ void DisplayMan::drawDoorOrnament(int16 doorOrnOrdinal, DoorOrnament doorOrnamen
}
Box box(coordSetOrangeElk[0], coordSetOrangeElk[1], coordSetOrangeElk[2], coordSetOrangeElk[3]);
- blitToBitmap(blitBitmap, _tmpBitmap, box, 0, 0, coordSetOrangeElk[4], byteWidth, k9_ColorGold, coordSetOrangeElk[5], height);
+ blitToBitmap(blitBitmap, _tmpBitmap, box, 0, 0, coordSetOrangeElk[4], byteWidth, kDMColorGold, coordSetOrangeElk[5], height);
}
void DisplayMan::drawCeilingPit(int16 nativeBitmapIndex, Frame *frame, int16 mapX, int16 mapY, bool flipHorizontal) {
@@ -1214,14 +1231,14 @@ void DisplayMan::drawWallSetBitmapWithoutTransparency(byte *bitmap, Frame &f) {
if (!f._srcByteWidth)
return;
- blitToBitmap(bitmap, _bitmapViewport, f._box, f._srcX, f._srcY, f._srcByteWidth, k112_byteWidthViewport, kM1_ColorNoTransparency, f._srcHeight, k136_heightViewport);
+ blitToBitmap(bitmap, _bitmapViewport, f._box, f._srcX, f._srcY, f._srcByteWidth, k112_byteWidthViewport, kDMColorNoTransparency, f._srcHeight, k136_heightViewport);
}
void DisplayMan::drawWallSetBitmap(byte *bitmap, Frame &f) {
if (!f._srcByteWidth)
return;
- blitToBitmap(bitmap, _bitmapViewport, f._box, f._srcX, f._srcY, f._srcByteWidth, k112_byteWidthViewport, k10_ColorFlesh, f._srcHeight, k136_heightViewport);
+ blitToBitmap(bitmap, _bitmapViewport, f._box, f._srcX, f._srcY, f._srcByteWidth, k112_byteWidthViewport, kDMColorFlesh, f._srcHeight, k136_heightViewport);
}
@@ -1245,7 +1262,7 @@ void DisplayMan::drawSquareD3L(Direction dir, int16 posX, int16 posY) {
);
uint16 squareAspect[5];
- int16 order;
+ CellOrder order;
bool skip = false;
_vm->_dungeonMan->setSquareAspect(squareAspect, dir, posX, posY);
switch (squareAspect[kDMSquareAspectElement]) {
@@ -1254,31 +1271,31 @@ void DisplayMan::drawSquareD3L(Direction dir, int16 posX, int16 posY) {
drawFloorPitOrStairsBitmap(_stairsNativeBitmapIndexUpFrontD3L, frameStairsUpFrontD3L);
else
drawFloorPitOrStairsBitmap(_stairsNativeBitmapIndexDownFrontD3L, frameStairsDownFrontD3L);
- order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight;
+ order = kDMCellOrderBackLeftBackRightFrontLeftFrontRight;
/* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD3L);
break;
case kDMElementTypeWall:
- drawWallSetBitmap(_bitmapWallSetD3LCR, _frameWalls163[k1_ViewSquare_D3L]);
+ drawWallSetBitmap(_bitmapWallSetD3LCR, _frameWalls163[kDMViewSquareD3L]);
isDrawnWallOrnAnAlcove(squareAspect[kDMSquareAspectRightWallOrnOrd], kDMViewWallD3LRight);
if (isDrawnWallOrnAnAlcove(squareAspect[kDMSquareFrontWallOrnOrd], kDMViewWallD3LFront))
- order = k0x0000_CellOrder_Alcove;
+ order = kDMCellOrderAlcove;
else
return;
break;
case kDMElementTypeDoorSide:
case kDMElementTypeStairsSide:
- order = k0x0321_CellOrder_BackLeft_BackRight_FrontRight;
+ order = kDMCellOrderBackLeftBackRightFrontRight;
/* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD3L);
break;
case kDMElementTypeDoorFront:
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD3L);
- drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k1_ViewSquare_D3L, k0x0218_CellOrder_DoorPass1_BackLeft_BackRight);
+ drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD3L, kDMCellOrderDoorPass1BackLeftBackRight);
drawWallSetBitmap(_bitmapWallSetDoorFrameLeftD3L, doorFrameLeftD3L);
drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState],
_doorNativeBitmapIndexFrontD3LCR, getBitmapByteCount(48, 41), kDMDoorOrnamentD3LCR, &doorFrameD3L);
- order = k0x0349_CellOrder_DoorPass2_FrontLeft_FrontRight;
+ order = kDMCellOrderDoorPass2FrontLeftFrontRight;
break;
case kDMElementTypePit:
if (!squareAspect[kDMSquareAspectPitInvisible])
@@ -1286,7 +1303,7 @@ void DisplayMan::drawSquareD3L(Direction dir, int16 posX, int16 posY) {
// no break on purpose
case kDMElementTypeTeleporter:
case kDMElementTypeCorridor:
- order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight;
+ order = kDMCellOrderBackLeftBackRightFrontLeftFrontRight;
/* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD3L);
break;
@@ -1296,10 +1313,10 @@ void DisplayMan::drawSquareD3L(Direction dir, int16 posX, int16 posY) {
}
if (!skip)
- drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k1_ViewSquare_D3L, order);
+ drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD3L, order);
if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible])
- drawField(&_fieldAspects188[k1_ViewSquare_D3L], _frameWalls163[k1_ViewSquare_D3L]._box);
+ drawField(&_fieldAspects188[kDMViewSquareD3L], _frameWalls163[kDMViewSquareD3L]._box);
}
void DisplayMan::drawSquareD3R(Direction dir, int16 posX, int16 posY) {
@@ -1321,7 +1338,7 @@ void DisplayMan::drawSquareD3R(Direction dir, int16 posX, int16 posY) {
Frame(180, 197, 28, 67, 24, 41, 24, 0) /* Right Horizontal Closed three fourth */
);
- int16 order;
+ CellOrder order = kDMCellOrderNone;
uint16 squareAspect[5];
bool skip = false;
@@ -1333,27 +1350,27 @@ void DisplayMan::drawSquareD3R(Direction dir, int16 posX, int16 posY) {
else
drawFloorPitOrStairsBitmapFlippedHorizontally(_stairsNativeBitmapIndexDownFrontD3L, frameStairsDownFrontD3R);
- order = k0x4312_CellOrder_BackRight_BackLeft_FrontRight_FrontLeft;
+ order = kDMCellOrderBackRightBackLeftFrontRightFrontLeft;
/* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD3R);
break;
case kDMElementTypeWall:
- drawWallSetBitmap(_bitmapWallSetD3LCR, _frameWalls163[k2_ViewSquare_D3R]);
+ drawWallSetBitmap(_bitmapWallSetD3LCR, _frameWalls163[kDMViewSquareD3R]);
isDrawnWallOrnAnAlcove(squareAspect[kDMSquareAspectLeftWallOrnOrd], kDMViewWallD3RLeft);
if (isDrawnWallOrnAnAlcove(squareAspect[kDMSquareFrontWallOrnOrd], kDMViewWallD3RFront))
- order = k0x0000_CellOrder_Alcove;
+ order = kDMCellOrderAlcove;
else
return;
break;
case kDMElementTypeDoorSide:
case kDMElementTypeStairsSide:
- order = k0x0412_CellOrder_BackRight_BackLeft_FrontLeft;
+ order = kDMCellOrderBackRightBackLeftFrontLeft;
/* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD3R);
break;
case kDMElementTypeDoorFront:
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD3R);
- drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k2_ViewSquare_D3R, k0x0128_CellOrder_DoorPass1_BackRight_BackLeft);
+ drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD3R, kDMCellOrderDoorPass1BackRightBackLeft);
memmove(_tmpBitmap, _bitmapWallSetDoorFrameLeftD3L, 32 * 44);
drawDoorFrameBitmapFlippedHorizontally(_tmpBitmap, &doorFrameRightD3R);
if (((Door *)_vm->_dungeonMan->_thingData[kDMThingTypeDoor])[squareAspect[kDMSquareAspectDoorThingIndex]].hasButton())
@@ -1369,7 +1386,7 @@ void DisplayMan::drawSquareD3R(Direction dir, int16 posX, int16 posY) {
// No break on purpose
case kDMElementTypeTeleporter:
case kDMElementTypeCorridor:
- order = k0x4312_CellOrder_BackRight_BackLeft_FrontRight_FrontLeft;
+ order = kDMCellOrderBackRightBackLeftFrontRightFrontLeft;
/* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD3R);
break;
@@ -1379,10 +1396,10 @@ void DisplayMan::drawSquareD3R(Direction dir, int16 posX, int16 posY) {
}
if (!skip)
- drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k2_ViewSquare_D3R, order);
+ drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD3R, order);
if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible])
- drawField(&_fieldAspects188[k2_ViewSquare_D3R], _frameWalls163[k2_ViewSquare_D3R]._box);
+ drawField(&_fieldAspects188[kDMViewSquareD3R], _frameWalls163[kDMViewSquareD3R]._box);
}
void DisplayMan::drawSquareD3C(Direction dir, int16 posX, int16 posY) {
@@ -1406,7 +1423,7 @@ void DisplayMan::drawSquareD3C(Direction dir, int16 posX, int16 posY) {
);
uint16 squareAspect[5];
- int16 order;
+ CellOrder order;
bool skip = false;
_vm->_dungeonMan->setSquareAspect(squareAspect, dir, posX, posY);
@@ -1417,20 +1434,20 @@ void DisplayMan::drawSquareD3C(Direction dir, int16 posX, int16 posY) {
else
drawFloorPitOrStairsBitmap(_stairsNativeBitmapIndexDownFrontD3C, frameStairsDownFrontD3C);
- order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight;
+ order = kDMCellOrderBackLeftBackRightFrontLeftFrontRight;
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD3C); /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
break;
case kDMElementTypeWall:
- drawWallSetBitmapWithoutTransparency(_bitmapWallSetD3LCR, _frameWalls163[k0_ViewSquare_D3C]);
+ drawWallSetBitmapWithoutTransparency(_bitmapWallSetD3LCR, _frameWalls163[kDMViewSquareD3C]);
if (isDrawnWallOrnAnAlcove(squareAspect[kDMSquareFrontWallOrnOrd], kDMViewWallD3CFront))
- order = k0x0000_CellOrder_Alcove;
+ order = kDMCellOrderAlcove;
else
return;
break;
case kDMElementTypeDoorFront:
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD3C);
- drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k0_ViewSquare_D3C, k0x0218_CellOrder_DoorPass1_BackLeft_BackRight);
+ drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD3C, kDMCellOrderDoorPass1BackLeftBackRight);
drawWallSetBitmap(_bitmapWallSetDoorFrameLeftD3C, doorFrameLeftD3C);
memmove(_tmpBitmap, _bitmapWallSetDoorFrameLeftD3C, 32 * 44);
drawDoorFrameBitmapFlippedHorizontally(_tmpBitmap, &doorFrameRightD3C);
@@ -1439,7 +1456,7 @@ void DisplayMan::drawSquareD3C(Direction dir, int16 posX, int16 posY) {
drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState],
_doorNativeBitmapIndexFrontD3LCR, getBitmapByteCount(48, 41), kDMDoorOrnamentD3LCR, &doorFrameD3C);
- order = k0x0349_CellOrder_DoorPass2_FrontLeft_FrontRight;
+ order = kDMCellOrderDoorPass2FrontLeftFrontRight;
break;
case kDMElementTypePit:
if (!squareAspect[kDMSquareAspectPitInvisible])
@@ -1447,7 +1464,7 @@ void DisplayMan::drawSquareD3C(Direction dir, int16 posX, int16 posY) {
// No break on purpose
case kDMElementTypeTeleporter:
case kDMElementTypeCorridor:
- order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight;
+ order = kDMCellOrderBackLeftBackRightFrontLeftFrontRight;
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD3C); /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
break;
default:
@@ -1456,10 +1473,10 @@ void DisplayMan::drawSquareD3C(Direction dir, int16 posX, int16 posY) {
}
if (!skip)
- drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k0_ViewSquare_D3C, order);
+ drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD3C, order);
if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible])
- drawField(&_fieldAspects188[k0_ViewSquare_D3C], _frameWalls163[k0_ViewSquare_D3C]._box);
+ drawField(&_fieldAspects188[kDMViewSquareD3C], _frameWalls163[kDMViewSquareD3C]._box);
}
void DisplayMan::drawSquareD2L(Direction dir, int16 posX, int16 posY) {
@@ -1483,7 +1500,7 @@ void DisplayMan::drawSquareD2L(Direction dir, int16 posX, int16 posY) {
Frame(40, 63, 24, 82, 32, 61, 32, 0) /* Right Horizontal Closed three fourth */
);
- int16 order;
+ CellOrder order;
uint16 squareAspect[5];
bool skip = false;
@@ -1495,14 +1512,14 @@ void DisplayMan::drawSquareD2L(Direction dir, int16 posX, int16 posY) {
else
drawFloorPitOrStairsBitmap(_stairsNativeBitmapIndexDownFrontD2L, frameStairsDownFrontD2L);
- order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight;
+ order = kDMCellOrderBackLeftBackRightFrontLeftFrontRight;
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD2L); /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
break;
case kDMElementTypeWall:
- drawWallSetBitmap(_bitmapWallSetD2LCR, _frameWalls163[k4_ViewSquare_D2L]);
+ drawWallSetBitmap(_bitmapWallSetD2LCR, _frameWalls163[kDMViewSquareD2L]);
isDrawnWallOrnAnAlcove(squareAspect[kDMSquareAspectRightWallOrnOrd], kDMViewWallD2LRight);
if (isDrawnWallOrnAnAlcove(squareAspect[kDMSquareFrontWallOrnOrd], kDMViewWallD2LFront))
- order = k0x0000_CellOrder_Alcove;
+ order = kDMCellOrderAlcove;
else
return;
break;
@@ -1510,16 +1527,16 @@ void DisplayMan::drawSquareD2L(Direction dir, int16 posX, int16 posY) {
drawFloorPitOrStairsBitmap(_stairsNativeBitmapIndexSideD2L, frameStairsSideD2L);
// No break on purpose
case kDMElementTypeDoorSide:
- order = k0x0342_CellOrder_BackRight_FrontLeft_FrontRight;
+ order = kDMCellOrderBackRightFrontLeftFrontRight;
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD2L); /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
break;
case kDMElementTypeDoorFront:
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD2L);
- drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k4_ViewSquare_D2L, k0x0218_CellOrder_DoorPass1_BackLeft_BackRight);
+ drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD2L, kDMCellOrderDoorPass1BackLeftBackRight);
drawWallSetBitmap(_bitmapWallSetDoorFrameTopD2LCR, doorFrameTopD2L);
drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState], _doorNativeBitmapIndexFrontD2LCR,
getBitmapByteCount(64, 61), kDMDoorOrnamentD2LCR, &doorFrameD2L);
- order = k0x0349_CellOrder_DoorPass2_FrontLeft_FrontRight;
+ order = kDMCellOrderDoorPass2FrontLeftFrontRight;
break;
case kDMElementTypePit:
drawFloorPitOrStairsBitmap(squareAspect[kDMSquareAspectPitInvisible] ? k57_FloorPir_Invisible_D2L_GraphicIndice : k51_FloorPit_D2L_GraphicIndice,
@@ -1527,7 +1544,7 @@ void DisplayMan::drawSquareD2L(Direction dir, int16 posX, int16 posY) {
// No break on purpose
case kDMElementTypeTeleporter:
case kDMElementTypeCorridor:
- order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight;
+ order = kDMCellOrderBackLeftBackRightFrontLeftFrontRight;
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD2L); /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
break;
@@ -1538,11 +1555,11 @@ void DisplayMan::drawSquareD2L(Direction dir, int16 posX, int16 posY) {
if (!skip) {
drawCeilingPit(k63_ceilingPit_D2L_GraphicIndice, &FrameCeilingPitD2L, posX, posY, false);
- drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k4_ViewSquare_D2L, order);
+ drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD2L, order);
}
if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible])
- drawField(&_fieldAspects188[k4_ViewSquare_D2L], _frameWalls163[k4_ViewSquare_D2L]._box);
+ drawField(&_fieldAspects188[kDMViewSquareD2L], _frameWalls163[kDMViewSquareD2L]._box);
}
void DisplayMan::drawSquareD2R(Direction dir, int16 posX, int16 posY) {
@@ -1563,10 +1580,10 @@ void DisplayMan::drawSquareD2R(Direction dir, int16 posX, int16 posY) {
Frame(160, 183, 24, 82, 32, 61, 8, 0), /* Left Horizontal Closed three fourth */
Frame(216, 223, 24, 82, 32, 61, 32, 0), /* Right Horizontal Closed one fourth */
Frame(208, 223, 24, 82, 32, 61, 32, 0), /* Right Horizontal Closed half */
- Frame(200, 223, 24, 82, 32, 61, 32, 0) /* Right Horizontal Closed three fourth */
+ Frame(200, 223, 24, 82, 32, 61, 32, 0) /* Right Horizontal Closed three fourth */
);
- int16 order;
+ CellOrder order;
uint16 squareAspect[5];
bool skip = false;
@@ -1578,16 +1595,16 @@ void DisplayMan::drawSquareD2R(Direction dir, int16 posX, int16 posY) {
else
drawFloorPitOrStairsBitmapFlippedHorizontally(_stairsNativeBitmapIndexDownFrontD2L, frameStairsDownFrontD2R);
- order = k0x4312_CellOrder_BackRight_BackLeft_FrontRight_FrontLeft;
+ order = kDMCellOrderBackRightBackLeftFrontRightFrontLeft;
/* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD2R);
drawCeilingPit(k63_ceilingPit_D2L_GraphicIndice, &frameCeilingPitD2R, posX, posY, true);
break;
case kDMElementTypeWall:
- drawWallSetBitmap(_bitmapWallSetD2LCR, _frameWalls163[k5_ViewSquare_D2R]);
+ drawWallSetBitmap(_bitmapWallSetD2LCR, _frameWalls163[kDMViewSquareD2R]);
isDrawnWallOrnAnAlcove(squareAspect[kDMSquareAspectLeftWallOrnOrd], kDMViewWallD2RLeft);
if (isDrawnWallOrnAnAlcove(squareAspect[kDMSquareFrontWallOrnOrd], kDMViewWallD2RFront))
- order = k0x0000_CellOrder_Alcove;
+ order = kDMCellOrderAlcove;
else
return;
break;
@@ -1595,18 +1612,18 @@ void DisplayMan::drawSquareD2R(Direction dir, int16 posX, int16 posY) {
drawFloorPitOrStairsBitmapFlippedHorizontally(_stairsNativeBitmapIndexSideD2L, frameStairsSideD2R);
// No break on purpose
case kDMElementTypeDoorSide:
- order = k0x0431_CellOrder_BackLeft_FrontRight_FrontLeft;
+ order = kDMCellOrderBackLeftFrontRightFrontLeft;
/* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD2R);
drawCeilingPit(k63_ceilingPit_D2L_GraphicIndice, &frameCeilingPitD2R, posX, posY, true);
break;
case kDMElementTypeDoorFront:
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD2R);
- drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k5_ViewSquare_D2R, k0x0128_CellOrder_DoorPass1_BackRight_BackLeft);
+ drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD2R, kDMCellOrderDoorPass1BackRightBackLeft);
drawWallSetBitmap(_bitmapWallSetDoorFrameTopD2LCR, doorFrameTopD2R);
drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState],
_doorNativeBitmapIndexFrontD2LCR, getBitmapByteCount(64, 61), kDMDoorOrnamentD2LCR, &doorFrameD2R);
- order = k0x0439_CellOrder_DoorPass2_FrontRight_FrontLeft;
+ order = kDMCellOrderDoorPass2FrontRightFrontLeft;
break;
case kDMElementTypePit:
drawFloorPitOrStairsBitmapFlippedHorizontally(
@@ -1614,7 +1631,7 @@ void DisplayMan::drawSquareD2R(Direction dir, int16 posX, int16 posY) {
// No break on purpose
case kDMElementTypeTeleporter:
case kDMElementTypeCorridor:
- order = k0x4312_CellOrder_BackRight_BackLeft_FrontRight_FrontLeft;
+ order = kDMCellOrderBackRightBackLeftFrontRightFrontLeft;
/* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD2R);
drawCeilingPit(k63_ceilingPit_D2L_GraphicIndice, &frameCeilingPitD2R, posX, posY, true);
@@ -1625,10 +1642,10 @@ void DisplayMan::drawSquareD2R(Direction dir, int16 posX, int16 posY) {
}
if (!skip)
- drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k5_ViewSquare_D2R, order);
+ drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD2R, order);
if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible])
- drawField(&_fieldAspects188[k5_ViewSquare_D2R], _frameWalls163[k5_ViewSquare_D2R]._box);
+ drawField(&_fieldAspects188[kDMViewSquareD2R], _frameWalls163[kDMViewSquareD2R]._box);
}
void DisplayMan::drawSquareD2C(Direction dir, int16 posX, int16 posY) {
@@ -1653,7 +1670,7 @@ void DisplayMan::drawSquareD2C(Direction dir, int16 posX, int16 posY) {
Frame(120, 143, 24, 82, 32, 61, 32, 0) /* Right Horizontal Closed three fourth */
);
- int16 order;
+ CellOrder order;
uint16 squareAspect[5];
bool skip = false;
@@ -1665,21 +1682,21 @@ void DisplayMan::drawSquareD2C(Direction dir, int16 posX, int16 posY) {
else
drawFloorPitOrStairsBitmap(_stairsNativeBitmapIndexDownFrontD2C, frameStairsDownFrontD2C);
- order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight;
+ order = kDMCellOrderBackLeftBackRightFrontLeftFrontRight;
/* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD2C);
drawCeilingPit(k64_ceilingPitD2C_GraphicIndice, &frameCeilingPitD2C, posX, posY, false);
break;
case kDMElementTypeWall:
- drawWallSetBitmapWithoutTransparency(_bitmapWallSetD2LCR, _frameWalls163[k3_ViewSquare_D2C]);
+ drawWallSetBitmapWithoutTransparency(_bitmapWallSetD2LCR, _frameWalls163[kDMViewSquareD2C]);
if (isDrawnWallOrnAnAlcove(squareAspect[kDMSquareFrontWallOrnOrd], kDMViewWallD2CFront))
- order = k0x0000_CellOrder_Alcove;
+ order = kDMCellOrderAlcove;
else
return;
break;
case kDMElementTypeDoorFront:
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD2C);
- drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k3_ViewSquare_D2C, k0x0218_CellOrder_DoorPass1_BackLeft_BackRight);
+ drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD2C, kDMCellOrderDoorPass1BackLeftBackRight);
drawWallSetBitmap(_bitmapWallSetDoorFrameTopD2LCR, doorFrameTopD2C);
drawWallSetBitmap(_bitmapWallSetDoorFrameLeftD2C, doorFrameLeftD2C);
memcpy(_tmpBitmap, _bitmapWallSetDoorFrameLeftD2C, 48 * 65);
@@ -1689,14 +1706,14 @@ void DisplayMan::drawSquareD2C(Direction dir, int16 posX, int16 posY) {
drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState],
_doorNativeBitmapIndexFrontD2LCR, getBitmapByteCount(64, 61), kDMDoorOrnamentD2LCR, &doorFrameD2C);
- order = k0x0349_CellOrder_DoorPass2_FrontLeft_FrontRight;
+ order = kDMCellOrderDoorPass2FrontLeftFrontRight;
break;
case kDMElementTypePit:
drawFloorPitOrStairsBitmap(squareAspect[kDMSquareAspectPitInvisible] ? k58_FloorPit_invisible_D2C_GraphicIndice : k52_FloorPit_D2C_GraphicIndice, frameFloorPitD2C);
// No break on purpose
case kDMElementTypeTeleporter:
case kDMElementTypeCorridor:
- order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight;
+ order = kDMCellOrderBackLeftBackRightFrontLeftFrontRight;
/* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD2C);
drawCeilingPit(k64_ceilingPitD2C_GraphicIndice, &frameCeilingPitD2C, posX, posY, false);
@@ -1707,10 +1724,10 @@ void DisplayMan::drawSquareD2C(Direction dir, int16 posX, int16 posY) {
}
if (!skip)
- drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k3_ViewSquare_D2C, order);
+ drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD2C, order);
if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible])
- drawField(&_fieldAspects188[k3_ViewSquare_D2C], _frameWalls163[k3_ViewSquare_D2C]._box);
+ drawField(&_fieldAspects188[kDMViewSquareD2C], _frameWalls163[kDMViewSquareD2C]._box);
}
void DisplayMan::drawSquareD1L(Direction dir, int16 posX, int16 posY) {
@@ -1735,7 +1752,7 @@ void DisplayMan::drawSquareD1L(Direction dir, int16 posX, int16 posY) {
Frame(0, 31, 17, 102, 48, 88, 52, 0) /* Right Horizontal Closed three fourth */
);
- int16 order;
+ CellOrder order;
uint16 squareAspect[5];
bool skip = false;
@@ -1747,13 +1764,13 @@ void DisplayMan::drawSquareD1L(Direction dir, int16 posX, int16 posY) {
else
drawFloorPitOrStairsBitmap(_stairsNativeBitmapIndexDownFrontD1L, frameStairsDownFrontD1L);
- order = k0x0032_CellOrder_BackRight_FrontRight;
+ order = kDMCellOrderBackRightFrontRight;
/* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1L);
drawCeilingPit(k65_ceilingPitD1L_GraphicIndice, &frameCeilingPitD1L, posX, posY, false);
break;
case kDMElementTypeWall:
- drawWallSetBitmap(_bitmapWallSetD1LCR, _frameWalls163[k7_ViewSquare_D1L]);
+ drawWallSetBitmap(_bitmapWallSetD1LCR, _frameWalls163[kDMViewSquareD1L]);
isDrawnWallOrnAnAlcove(squareAspect[kDMSquareAspectRightWallOrnOrd], kDMViewWallD1LRight);
return;
case kDMElementTypeStairsSide:
@@ -1763,25 +1780,25 @@ void DisplayMan::drawSquareD1L(Direction dir, int16 posX, int16 posY) {
drawFloorPitOrStairsBitmap(_stairsNativeBitmapIndexDownSideD1L, frameStairsDownSideD1L);
// No break on purpose
case kDMElementTypeDoorSide:
- order = k0x0032_CellOrder_BackRight_FrontRight;
+ order = kDMCellOrderBackRightFrontRight;
/* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1L);
drawCeilingPit(k65_ceilingPitD1L_GraphicIndice, &frameCeilingPitD1L, posX, posY, false);
break;
case kDMElementTypeDoorFront:
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1L);
- drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k7_ViewSquare_D1L, k0x0028_CellOrder_DoorPass1_BackRight);
+ drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD1L, kDMCellOrderDoorPass1BackRight);
drawWallSetBitmap(_bitmapWallSetDoorFrameTopD1LCR, doorFrameTopD1L);
drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState],
_doorNativeBitmapIndexFrontD1LCR, getBitmapByteCount(96, 88), kDMDoorOrnamentD1LCR, &doorFrameD1L);
- order = k0x0039_CellOrder_DoorPass2_FrontRight;
+ order = kDMCellOrderDoorPass2FrontRight;
break;
case kDMElementTypePit:
drawFloorPitOrStairsBitmap(squareAspect[kDMSquareAspectPitInvisible] ? k59_floorPit_invisible_D1L_GraphicIndice : k53_FloorPit_D1L_GraphicIndice, frameFloorPitD1L);
// No break on purpose
case kDMElementTypeTeleporter:
case kDMElementTypeCorridor:
- order = k0x0032_CellOrder_BackRight_FrontRight;
+ order = kDMCellOrderBackRightFrontRight;
/* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1L);
drawCeilingPit(k65_ceilingPitD1L_GraphicIndice, &frameCeilingPitD1L, posX, posY, false);
@@ -1792,10 +1809,10 @@ void DisplayMan::drawSquareD1L(Direction dir, int16 posX, int16 posY) {
}
if (!skip)
- drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k7_ViewSquare_D1L, order);
+ drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD1L, order);
if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible])
- drawField(&_fieldAspects188[k7_ViewSquare_D1L], _frameWalls163[k7_ViewSquare_D1L]._box);
+ drawField(&_fieldAspects188[kDMViewSquareD1L], _frameWalls163[kDMViewSquareD1L]._box);
}
void DisplayMan::drawSquareD1R(Direction dir, int16 posX, int16 posY) {
@@ -1820,7 +1837,7 @@ void DisplayMan::drawSquareD1R(Direction dir, int16 posX, int16 posY) {
Frame(0, 0, 0, 0, 0, 0, 0, 0) /* Right Horizontal Closed three fourth */
);
- int16 order;
+ CellOrder order;
uint16 squareAspect[5];
bool skip = false;
@@ -1832,12 +1849,12 @@ void DisplayMan::drawSquareD1R(Direction dir, int16 posX, int16 posY) {
else
drawFloorPitOrStairsBitmapFlippedHorizontally(_stairsNativeBitmapIndexDownFrontD1L, frameStairsDownFrontD1R);
- order = k0x0041_CellOrder_BackLeft_FrontLeft;
+ order = kDMCellOrderBackLeftFrontLeft;
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1R); /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
drawCeilingPit(k65_ceilingPitD1L_GraphicIndice, &frameCeilingPitD1R, posX, posY, true);
break;
case kDMElementTypeWall:
- drawWallSetBitmap(_bitmapWallSetD1LCR, _frameWalls163[k8_ViewSquare_D1R]);
+ drawWallSetBitmap(_bitmapWallSetD1LCR, _frameWalls163[kDMViewSquareD1R]);
isDrawnWallOrnAnAlcove(squareAspect[kDMSquareAspectLeftWallOrnOrd], kDMViewWallD1RLeft);
return;
case kDMElementTypeStairsSide:
@@ -1848,17 +1865,17 @@ void DisplayMan::drawSquareD1R(Direction dir, int16 posX, int16 posY) {
// No break on purpose
case kDMElementTypeDoorSide:
- order = k0x0041_CellOrder_BackLeft_FrontLeft;
+ order = kDMCellOrderBackLeftFrontLeft;
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1R); /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
drawCeilingPit(k65_ceilingPitD1L_GraphicIndice, &frameCeilingPitD1R, posX, posY, true);
break;
case kDMElementTypeDoorFront:
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1R);
- drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k8_ViewSquare_D1R, k0x0018_CellOrder_DoorPass1_BackLeft);
+ drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD1R, kDMCellOrderDoorPass1BackLeft);
drawWallSetBitmap(_bitmapWallSetDoorFrameTopD1LCR, doorFrameTopD1R);
drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState],
_doorNativeBitmapIndexFrontD1LCR, getBitmapByteCount(96, 88), kDMDoorOrnamentD1LCR, &doorFrameD1R);
- order = k0x0049_CellOrder_DoorPass2_FrontLeft;
+ order = kDMCellOrderDoorPass2FrontLeft;
break;
case kDMElementTypePit:
drawFloorPitOrStairsBitmapFlippedHorizontally(squareAspect[kDMSquareAspectPitInvisible] ? k59_floorPit_invisible_D1L_GraphicIndice
@@ -1866,7 +1883,7 @@ void DisplayMan::drawSquareD1R(Direction dir, int16 posX, int16 posY) {
// No break on purpose
case kDMElementTypeTeleporter:
case kDMElementTypeCorridor:
- order = k0x0041_CellOrder_BackLeft_FrontLeft;
+ order = kDMCellOrderBackLeftFrontLeft;
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1R); /* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
drawCeilingPit(k65_ceilingPitD1L_GraphicIndice, &frameCeilingPitD1R, posX, posY, true);
break;
@@ -1876,10 +1893,10 @@ void DisplayMan::drawSquareD1R(Direction dir, int16 posX, int16 posY) {
}
if (!skip)
- drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k8_ViewSquare_D1R, order);
+ drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD1R, order);
if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible])
- drawField(&_fieldAspects188[k8_ViewSquare_D1R], _frameWalls163[k8_ViewSquare_D1R]._box);
+ drawField(&_fieldAspects188[kDMViewSquareD1R], _frameWalls163[kDMViewSquareD1R]._box);
}
void DisplayMan::drawSquareD1C(Direction dir, int16 posX, int16 posY) {
@@ -1890,7 +1907,7 @@ void DisplayMan::drawSquareD1C(Direction dir, int16 posX, int16 posY) {
static Frame frameCeilingPitD1C = Frame(32, 191, 8, 16, 80, 9, 0, 0); // @ G0156_s_Graphic558_Frame_CeilingPit_D1C
static Box boxThievesEyeVisibleArea(0, 95, 0, 94); // @ G0107_s_Graphic558_Box_ThievesEye_VisibleArea
- int16 order;
+ CellOrder order;
uint16 squareAspect[5];
bool skip = false;
@@ -1902,7 +1919,7 @@ void DisplayMan::drawSquareD1C(Direction dir, int16 posX, int16 posY) {
else
drawFloorPitOrStairsBitmap(_stairsNativeBitmapIndexDownFrontD1C, frameStairsDownFrontD1C);
- order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight;
+ order = kDMCellOrderBackLeftBackRightFrontLeftFrontRight;
/* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1C);
drawCeilingPit(k66_ceilingPitD1C_GraphicIndice, &frameCeilingPitD1C, posX, posY, false);
@@ -1912,29 +1929,29 @@ void DisplayMan::drawSquareD1C(Direction dir, int16 posX, int16 posY) {
_vm->_dungeonMan->_isFacingViAltar = false;
_vm->_dungeonMan->_isFacingFountain = false;
if (_vm->_championMan->_party._event73Count_ThievesEye) {
- isDerivedBitmapInCache(k1_DerivedBitmapThievesEyeVisibleArea);
- blitToBitmap(_bitmapViewport, getDerivedBitmap(k1_DerivedBitmapThievesEyeVisibleArea),
- boxThievesEyeVisibleArea, _boxThievesEyeViewPortVisibleArea._x1, _boxThievesEyeViewPortVisibleArea._y1,
- k112_byteWidthViewport, 48, kM1_ColorNoTransparency, 136, 95);
+ isDerivedBitmapInCache(kDMDerivedBitmapThievesEyeVisibleArea);
+ blitToBitmap(_bitmapViewport, getDerivedBitmap(kDMDerivedBitmapThievesEyeVisibleArea),
+ boxThievesEyeVisibleArea, _boxThievesEyeViewPortVisibleArea._rect.left, _boxThievesEyeViewPortVisibleArea._rect.top,
+ k112_byteWidthViewport, 48, kDMColorNoTransparency, 136, 95);
byte *bitmap = getNativeBitmapOrGraphic(k41_holeInWall_GraphicIndice);
- blitToBitmap(bitmap, getDerivedBitmap(k1_DerivedBitmapThievesEyeVisibleArea),
- boxThievesEyeVisibleArea, 0, 0, 48, 48, k10_ColorFlesh, 95, 95);
+ blitToBitmap(bitmap, getDerivedBitmap(kDMDerivedBitmapThievesEyeVisibleArea),
+ boxThievesEyeVisibleArea, 0, 0, 48, 48, kDMColorFlesh, 95, 95);
}
- drawWallSetBitmapWithoutTransparency(_bitmapWallSetD1LCR, _frameWalls163[k6_ViewSquare_D1C]);
+ drawWallSetBitmapWithoutTransparency(_bitmapWallSetD1LCR, _frameWalls163[kDMViewSquareD1C]);
if (isDrawnWallOrnAnAlcove(squareAspect[kDMSquareFrontWallOrnOrd], kDMViewWallD1CFront))
- drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k6_ViewSquare_D1C, k0x0000_CellOrder_Alcove);
+ drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD1C, kDMCellOrderAlcove);
if (_vm->_championMan->_party._event73Count_ThievesEye) {
- blitToBitmap(getDerivedBitmap(k1_DerivedBitmapThievesEyeVisibleArea),
+ blitToBitmap(getDerivedBitmap(kDMDerivedBitmapThievesEyeVisibleArea),
_bitmapViewport, _boxThievesEyeViewPortVisibleArea, 0, 0,
- 48, k112_byteWidthViewport, k9_ColorGold, 95, k136_heightViewport); /* BUG0_74 */
- addDerivedBitmap(k1_DerivedBitmapThievesEyeVisibleArea);
- releaseBlock(k1_DerivedBitmapThievesEyeVisibleArea | 0x8000);
+ 48, k112_byteWidthViewport, kDMColorGold, 95, k136_heightViewport); /* BUG0_74 */
+ addDerivedBitmap(kDMDerivedBitmapThievesEyeVisibleArea);
+ releaseBlock(kDMDerivedBitmapThievesEyeVisibleArea | 0x8000);
}
return;
case kDMElementTypeDoorFront:
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1C);
- drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k6_ViewSquare_D1C, k0x0218_CellOrder_DoorPass1_BackLeft_BackRight);
+ drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD1C, kDMCellOrderDoorPass1BackLeftBackRight);
drawWallSetBitmap(_bitmapWallSetDoorFrameTopD1LCR, doorFrameTopD1C);
drawWallSetBitmap(_bitmapWallSetDoorFrameLeftD1C, _doorFrameLeftD1C);
drawWallSetBitmap(_bitmapWallSetDoorFrameRightD1C, _doorFrameRightD1C);
@@ -1943,14 +1960,14 @@ void DisplayMan::drawSquareD1C(Direction dir, int16 posX, int16 posY) {
drawDoor(squareAspect[kDMSquareAspectDoorThingIndex], (DoorState)squareAspect[kDMSquareAspectDoorState],
_doorNativeBitmapIndexFrontD1LCR, getBitmapByteCount(96, 88), kDMDoorOrnamentD1LCR, _doorFrameD1C);
- order = k0x0349_CellOrder_DoorPass2_FrontLeft_FrontRight;
+ order = kDMCellOrderDoorPass2FrontLeftFrontRight;
break;
case kDMElementTypePit:
drawFloorPitOrStairsBitmap(squareAspect[kDMSquareAspectPitInvisible] ? k60_floorPitInvisibleD1C_GraphicIndice : k54_FloorPit_D1C_GraphicIndice, frameFloorPitD1C);
// No break on purpose
case kDMElementTypeTeleporter:
case kDMElementTypeCorridor:
- order = k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight;
+ order = kDMCellOrderBackLeftBackRightFrontLeftFrontRight;
/* BUG0_64 Floor ornaments are drawn over open pits. There is no check to prevent drawing floor ornaments over open pits */
drawFloorOrnament(squareAspect[kDMSquareAspectFloorOrn], kDMViewFloorD1C);
drawCeilingPit(k66_ceilingPitD1C_GraphicIndice, &frameCeilingPitD1C, posX, posY, false);
@@ -1961,10 +1978,10 @@ void DisplayMan::drawSquareD1C(Direction dir, int16 posX, int16 posY) {
}
if (!skip)
- drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k6_ViewSquare_D1C, order);
+ drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD1C, order);
if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible])
- drawField(&_fieldAspects188[k6_ViewSquare_D1C], _frameWalls163[k6_ViewSquare_D1C]._box);
+ drawField(&_fieldAspects188[kDMViewSquareD1C], _frameWalls163[kDMViewSquareD1C]._box);
}
void DisplayMan::drawSquareD0L(Direction dir, int16 posX, int16 posY) {
@@ -1976,12 +1993,12 @@ void DisplayMan::drawSquareD0L(Direction dir, int16 posX, int16 posY) {
_vm->_dungeonMan->setSquareAspect(squareAspect, dir, posX, posY);
switch (squareAspect[kDMSquareAspectElement]) {
case kDMElementTypeWall:
- drawWallSetBitmap(bitmapWallSetWallD0L, _frameWalls163[k10_ViewSquare_D0L]);
+ drawWallSetBitmap(bitmapWallSetWallD0L, _frameWalls163[kDMViewSquareD0L]);
break;
case kDMElementTypeCorridor:
case kDMElementTypeTeleporter:
case kDMElementTypeDoorSide:
- drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k10_ViewSquare_D0L, k0x0002_CellOrder_BackRight);
+ drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD0L, kDMCellOrderBackRight);
break;
case kDMElementTypePit:
drawFloorPitOrStairsBitmap(squareAspect[kDMSquareAspectPitInvisible] ? k61_floorPitInvisibleD0L_GraphicIndice : k55_FloorPit_D0L_GraphicIndice, frameFloorPitD0L);
@@ -1995,7 +2012,7 @@ void DisplayMan::drawSquareD0L(Direction dir, int16 posX, int16 posY) {
drawCeilingPit(k67_ceilingPitD0L_grahicIndice, &frameCeilingPitD0L, posX, posY, false);
if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible])
- drawField(&_fieldAspects188[k10_ViewSquare_D0L], _frameWalls163[k10_ViewSquare_D0L]._box);
+ drawField(&_fieldAspects188[kDMViewSquareD0L], _frameWalls163[kDMViewSquareD0L]._box);
}
void DisplayMan::drawSquareD0R(Direction dir, int16 posX, int16 posY) {
@@ -2017,14 +2034,14 @@ void DisplayMan::drawSquareD0R(Direction dir, int16 posX, int16 posY) {
case kDMElementTypeDoorSide:
case kDMElementTypeTeleporter:
drawCeilingPit(k67_ceilingPitD0L_grahicIndice, &frameCeilingPitD0R, posX, posY, true);
- drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k11_ViewSquare_D0R, k0x0001_CellOrder_BackLeft);
+ drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD0R, kDMCellOrderBackLeft);
break;
case kDMElementTypeWall:
- drawWallSetBitmap(_bitmapWallSetWallD0R, _frameWalls163[k11_ViewSquare_D0R]);
+ drawWallSetBitmap(_bitmapWallSetWallD0R, _frameWalls163[kDMViewSquareD0R]);
return;
}
if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible])
- drawField(&_fieldAspects188[k11_ViewSquare_D0R], _frameWalls163[k11_ViewSquare_D0R]._box);
+ drawField(&_fieldAspects188[kDMViewSquareD0R], _frameWalls163[kDMViewSquareD0R]._box);
}
void DisplayMan::drawSquareD0C(Direction dir, int16 posX, int16 posY) {
@@ -2045,8 +2062,8 @@ void DisplayMan::drawSquareD0C(Direction dir, int16 posX, int16 posY) {
if (_vm->_championMan->_party._event73Count_ThievesEye) {
memmove(_tmpBitmap, _bitmapWallSetDoorFrameFront, 32 * 123);
blitToBitmap(getNativeBitmapOrGraphic(k41_holeInWall_GraphicIndice),
- _tmpBitmap, boxThievesEyeHoleInDoorFrame, doorFrameD0C._box._x1 - _boxThievesEyeViewPortVisibleArea._x1,
- 0, 48, 16, k9_ColorGold, 95, 123);
+ _tmpBitmap, boxThievesEyeHoleInDoorFrame, doorFrameD0C._box._rect.left - _boxThievesEyeViewPortVisibleArea._rect.left,
+ 0, 48, 16, kDMColorGold, 95, 123);
drawWallSetBitmap(_tmpBitmap, doorFrameD0C);
} else
drawWallSetBitmap(_bitmapWallSetDoorFrameFront, doorFrameD0C);
@@ -2065,9 +2082,9 @@ void DisplayMan::drawSquareD0C(Direction dir, int16 posX, int16 posY) {
break;
}
drawCeilingPit(k68_ceilingPitD0C_graphicIndice, &frameCeilingPitD0C, posX, posY, false);
- drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, k9_ViewSquare_D0C, k0x0021_CellOrder_BackLeft_BackRight);
+ drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[kDMSquareAspectFirstGroupOrObject]), dir, posX, posY, kDMViewSquareD0C, kDMCellOrderBackLeftBackRight);
if ((squareAspect[kDMSquareAspectElement] == kDMElementTypeTeleporter) && squareAspect[kDMSquareAspectTeleporterVisible])
- drawField(&_fieldAspects188[k9_ViewSquare_D0C], _frameWalls163[k9_ViewSquare_D0C]._box);
+ drawField(&_fieldAspects188[kDMViewSquareD0C], _frameWalls163[kDMViewSquareD0C]._box);
}
void DisplayMan::drawDungeon(Direction dir, int16 posX, int16 posY) {
@@ -2083,7 +2100,7 @@ void DisplayMan::drawDungeon(Direction dir, int16 posX, int16 posY) {
_vm->_dungeonMan->_dungeonViewClickableBoxes[i].setToZero();
for (uint16 i = 0; i < 6; ++i)
- _vm->_dungeonMan->_dungeonViewClickableBoxes[i]._x1 = 255;
+ _vm->_dungeonMan->_dungeonViewClickableBoxes[i]._rect.left = 255;
_useFlippedWallAndFootprintsBitmap = (posX + posY + dir) & 1;
if (_useFlippedWallAndFootprintsBitmap) {
@@ -2111,15 +2128,15 @@ void DisplayMan::drawDungeon(Direction dir, int16 posX, int16 posY) {
int16 tmpPosX = posX;
int16 tmpPosY = posY;
_vm->_dungeonMan->mapCoordsAfterRelMovement(dir, 4, -1, tmpPosX, tmpPosY);
- drawObjectsCreaturesProjectilesExplosions(_vm->_dungeonMan->getSquareFirstObject(tmpPosX, tmpPosY), dir, tmpPosX, tmpPosY, kM2_ViewSquare_D4L, k0x0001_CellOrder_BackLeft);
+ drawObjectsCreaturesProjectilesExplosions(_vm->_dungeonMan->getSquareFirstObject(tmpPosX, tmpPosY), dir, tmpPosX, tmpPosY, kViewSquareD4L, kDMCellOrderBackLeft);
tmpPosX = posX;
tmpPosY = posY;
_vm->_dungeonMan->mapCoordsAfterRelMovement(dir, 4, 1, tmpPosX, tmpPosY);
- drawObjectsCreaturesProjectilesExplosions(_vm->_dungeonMan->getSquareFirstObject(tmpPosX, tmpPosY), dir, tmpPosX, tmpPosY, kM1_ViewSquare_D4R, k0x0001_CellOrder_BackLeft);
+ drawObjectsCreaturesProjectilesExplosions(_vm->_dungeonMan->getSquareFirstObject(tmpPosX, tmpPosY), dir, tmpPosX, tmpPosY, kDMViewSquareD4R, kDMCellOrderBackLeft);
tmpPosX = posX;
tmpPosY = posY;
_vm->_dungeonMan->mapCoordsAfterRelMovement(dir, 4, 0, tmpPosX, tmpPosY);
- drawObjectsCreaturesProjectilesExplosions(_vm->_dungeonMan->getSquareFirstObject(tmpPosX, tmpPosY), dir, tmpPosX, tmpPosY, kM3_ViewSquare_D4C, k0x0001_CellOrder_BackLeft);
+ drawObjectsCreaturesProjectilesExplosions(_vm->_dungeonMan->getSquareFirstObject(tmpPosX, tmpPosY), dir, tmpPosX, tmpPosY, kDMViewSquareD4C, kDMCellOrderBackLeft);
tmpPosX = posX;
tmpPosY = posY;
_vm->_dungeonMan->mapCoordsAfterRelMovement(dir, 3, -1, tmpPosX, tmpPosY);
@@ -2181,7 +2198,7 @@ void DisplayMan::drawDungeon(Direction dir, int16 posX, int16 posY) {
void DisplayMan::drawFloorAndCeiling() {
Box box(0, 223, 0, 36);
- fillBoxBitmap(_bitmapViewport, box, k0_ColorBlack, k112_byteWidthViewport, k136_heightViewport);
+ fillBoxBitmap(_bitmapViewport, box, kDMColorBlack, k112_byteWidthViewport, k136_heightViewport);
_drawFloorAndCeilingRequested = false;
}
@@ -2333,21 +2350,21 @@ void DisplayMan::loadCurrentMapGraphics() {
_useByteBoxCoordinates = true;
copyBitmapAndFlipHorizontal(_bitmapWallD3LCRNative = _bitmapWallSetD3LCR, _tmpBitmap,
- _frameWalls163[k0_ViewSquare_D3C]._srcByteWidth, _frameWalls163[k0_ViewSquare_D3C]._srcHeight);
- fillBitmap(_bitmapWallD3LCRFlipped, k10_ColorFlesh, 64, 51);
- blitToBitmap(_tmpBitmap, _bitmapWallD3LCRFlipped, boxWallD3LCR, 11, 0, 64, 64, kM1_ColorNoTransparency, 51, 51);
+ _frameWalls163[kDMViewSquareD3C]._srcByteWidth, _frameWalls163[kDMViewSquareD3C]._srcHeight);
+ fillBitmap(_bitmapWallD3LCRFlipped, kDMColorFlesh, 64, 51);
+ blitToBitmap(_tmpBitmap, _bitmapWallD3LCRFlipped, boxWallD3LCR, 11, 0, 64, 64, kDMColorNoTransparency, 51, 51);
copyBitmapAndFlipHorizontal(_bitmapWallD2LCRNative = _bitmapWallSetD2LCR, _tmpBitmap,
- _frameWalls163[k3_ViewSquare_D2C]._srcByteWidth, _frameWalls163[k3_ViewSquare_D2C]._srcHeight);
- fillBitmap(_bitmapWallD2LCRFlipped, k10_ColorFlesh, 72, 71);
- blitToBitmap(_tmpBitmap, _bitmapWallD2LCRFlipped, boxWallD2LCR, 8, 0, 72, 72, kM1_ColorNoTransparency, 71, 71);
+ _frameWalls163[kDMViewSquareD2C]._srcByteWidth, _frameWalls163[kDMViewSquareD2C]._srcHeight);
+ fillBitmap(_bitmapWallD2LCRFlipped, kDMColorFlesh, 72, 71);
+ blitToBitmap(_tmpBitmap, _bitmapWallD2LCRFlipped, boxWallD2LCR, 8, 0, 72, 72, kDMColorNoTransparency, 71, 71);
copyBitmapAndFlipHorizontal(_bitmapWallD1LCRNative = _bitmapWallSetD1LCR, _bitmapWallD1LCRFlipped,
- _frameWalls163[k6_ViewSquare_D1C]._srcByteWidth, _frameWalls163[k6_ViewSquare_D1C]._srcHeight);
+ _frameWalls163[kDMViewSquareD1C]._srcByteWidth, _frameWalls163[kDMViewSquareD1C]._srcHeight);
copyBitmapAndFlipHorizontal(_bitmapWallD0LNative = bitmapWallSetWallD0L, _bitmapWallD0RFlipped,
- _frameWalls163[k10_ViewSquare_D0L]._srcByteWidth, _frameWalls163[k10_ViewSquare_D0L]._srcHeight);
+ _frameWalls163[kDMViewSquareD0L]._srcByteWidth, _frameWalls163[kDMViewSquareD0L]._srcHeight);
copyBitmapAndFlipHorizontal(_bitmapWallD0RNative = _bitmapWallSetWallD0R, _bitmapWallD0LFlipped,
- _frameWalls163[k10_ViewSquare_D0L]._srcByteWidth, _frameWalls163[k10_ViewSquare_D0L]._srcHeight);
+ _frameWalls163[kDMViewSquareD0L]._srcByteWidth, _frameWalls163[kDMViewSquareD0L]._srcHeight);
int16 val = _vm->_dungeonMan->_currMap->_wallSet * k18_StairsGraphicCount + k90_FirstStairs;
_stairsNativeBitmapIndexUpFrontD3L = val++;
@@ -2471,14 +2488,14 @@ void DisplayMan::applyCreatureReplColors(int replacedColor, int replacementColor
void DisplayMan::drawFloorPitOrStairsBitmap(uint16 nativeIndex, Frame &f) {
if (f._srcByteWidth)
blitToBitmap(getNativeBitmapOrGraphic(nativeIndex), _bitmapViewport, f._box, f._srcX, f._srcY,
- f._srcByteWidth, k112_byteWidthViewport, k10_ColorFlesh, f._srcHeight, k136_heightViewport);
+ f._srcByteWidth, k112_byteWidthViewport, kDMColorFlesh, f._srcHeight, k136_heightViewport);
}
void DisplayMan::drawFloorPitOrStairsBitmapFlippedHorizontally(uint16 nativeIndex, Frame &f) {
if (f._srcByteWidth) {
copyBitmapAndFlipHorizontal(getNativeBitmapOrGraphic(nativeIndex), _tmpBitmap, f._srcByteWidth, f._srcHeight);
blitToBitmap(_tmpBitmap, _bitmapViewport, f._box, f._srcX, f._srcY, f._srcByteWidth,
- k112_byteWidthViewport, k10_ColorFlesh, f._srcHeight, k136_heightViewport);
+ k112_byteWidthViewport, kDMColorFlesh, f._srcHeight, k136_heightViewport);
}
}
@@ -2514,7 +2531,7 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex
46, 57, 68 /* D1L Right, D1R Left */
};
- static byte g205_WallOrnCoordSets[8][13][6] = { // @ G0205_aaauc_Graphic558_WallOrnamentCoordinateSets
+ static byte wallOrnamentCoordSets[8][13][6] = { // @ G0205_aaauc_Graphic558_WallOrnamentCoordinateSets
/* { X1, X2, Y1, Y2, ByteWidth, Height } */
{
{80, 83, 41, 45, 8, 5}, /* D3L */
@@ -2646,7 +2663,7 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex
int16 wallOrnamentIndex = wallOrnOrd;
int16 ornNativeBitmapIndex = _currMapWallOrnInfo[wallOrnamentIndex].nativeIndice;
int16 wallOrnamentCoordinateSetIndex = _currMapWallOrnInfo[wallOrnamentIndex].coordinateSet;
- byte *ornCoordSet = g205_WallOrnCoordSets[wallOrnamentCoordinateSetIndex][viewWallIndex];
+ byte *ornCoordSet = wallOrnamentCoordSets[wallOrnamentCoordinateSetIndex][viewWallIndex];
bool isAlcove = _vm->_dungeonMan->isWallOrnAnAlcove(wallOrnamentIndex);
unsigned char inscriptionString[70];
bool isInscription = (wallOrnamentIndex == _vm->_dungeonMan->_currMapInscriptionWallOrnIndex);
@@ -2659,7 +2676,7 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex
if (viewWallIndex >= kDMViewWallD1LRight) {
if (viewWallIndex == kDMViewWallD1CFront) {
if (isInscription) {
- blitToBitmap(_bitmapWallSetD1LCR, _bitmapViewport, boxWallPatchBehindInscription, 94, 28, _frameWalls163[k6_ViewSquare_D1C]._srcByteWidth, k112_byteWidthViewport, kM1_ColorNoTransparency, _frameWalls163[k6_ViewSquare_D1C]._srcHeight, k136_heightViewport);
+ blitToBitmap(_bitmapWallSetD1LCR, _bitmapViewport, boxWallPatchBehindInscription, 94, 28, _frameWalls163[kDMViewSquareD1C]._srcByteWidth, k112_byteWidthViewport, kDMColorNoTransparency, _frameWalls163[kDMViewSquareD1C]._srcHeight, k136_heightViewport);
byte *inscrString = inscriptionString;
byte *L0092_puc_Bitmap = getNativeBitmapOrGraphic(k120_InscriptionFont);
int16 textLineIndex = 0;
@@ -2670,19 +2687,21 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex
characterCount++;
}
Frame blitFrame;
- blitFrame._box._x2 = (blitFrame._box._x1 = 112 - (characterCount << 2)) + 7;
- blitFrame._box._y1 = (blitFrame._box._y2 = inscriptionLineY[textLineIndex++]) - 7;
+ blitFrame._box._rect.left = 112 - (characterCount << 2);
+ blitFrame._box._rect.right = blitFrame._box._rect.left + 7;
+ blitFrame._box._rect.bottom = inscriptionLineY[textLineIndex++];
+ blitFrame._box._rect.top = blitFrame._box._rect.bottom - 7;
while (characterCount--) {
- blitToBitmap(L0092_puc_Bitmap, _bitmapViewport, blitFrame._box, *inscrString++ << 3, 0, k144_byteWidth, k112_byteWidthViewport, k10_ColorFlesh, 8, k136_heightViewport);
- blitFrame._box._x1 += 8;
- blitFrame._box._x2 += 8;
+ blitToBitmap(L0092_puc_Bitmap, _bitmapViewport, blitFrame._box, *inscrString++ << 3, 0, k144_byteWidth, k112_byteWidthViewport, kDMColorFlesh, 8, k136_heightViewport);
+ blitFrame._box._rect.left += 8;
+ blitFrame._box._rect.right += 8;
}
} while (*inscrString++ != 129); /* Hexadecimal: 0x81 (Megamax C does not support hexadecimal character constants) */
return isAlcove;
}
ornNativeBitmapIndex++;
- Box tmpBox(ornCoordSet);
- _vm->_dungeonMan->_dungeonViewClickableBoxes[k5_ViewCellDoorButtonOrWallOrn] = tmpBox;
+ Box tmpBox(ornCoordSet[0], ornCoordSet[1], ornCoordSet[2], ornCoordSet[3]);
+ _vm->_dungeonMan->_dungeonViewClickableBoxes[kDMViewCellDoorButtonOrWallOrn] = tmpBox;
_vm->_dungeonMan->_isFacingAlcove = isAlcove;
_vm->_dungeonMan->_isFacingViAltar =
(wallOrnamentIndex == _currMapViAltarIndex);
@@ -2704,19 +2723,20 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex
int16 coordinateSetOffset = 0;
bool flipHorizontal = (viewWallIndex == kDMViewWallD2RLeft) || (viewWallIndex == kDMViewWallD3RLeft);
if (flipHorizontal)
- ornBlitBitmap = g205_WallOrnCoordSets[wallOrnamentCoordinateSetIndex][kDMViewWallD1RLeft];
+ ornBlitBitmap = wallOrnamentCoordSets[wallOrnamentCoordinateSetIndex][kDMViewWallD1RLeft];
else if ((viewWallIndex == kDMViewWallD2LRight) || (viewWallIndex == kDMViewWallD3LRight))
- ornBlitBitmap = g205_WallOrnCoordSets[wallOrnamentCoordinateSetIndex][kDMViewWallD1LRight];
+ ornBlitBitmap = wallOrnamentCoordSets[wallOrnamentCoordinateSetIndex][kDMViewWallD1LRight];
else {
ornNativeBitmapIndex++;
- ornBlitBitmap = g205_WallOrnCoordSets[wallOrnamentCoordinateSetIndex][kDMViewWallD1CFront];
+ ornBlitBitmap = wallOrnamentCoordSets[wallOrnamentCoordinateSetIndex][kDMViewWallD1CFront];
if (viewWallIndex == kDMViewWallD2LFront)
coordinateSetOffset = 6;
else if (viewWallIndex == kDMViewWallD2RFront)
coordinateSetOffset = -6;
}
blitPosX = (ornCoordSet + coordinateSetOffset)[1] - (ornCoordSet + coordinateSetOffset)[0];
- if (!isDerivedBitmapInCache(wallOrnamentIndex = k4_DerivedBitmapFirstWallOrnament + (wallOrnamentIndex << 2) + wallOrnDerivedBitmapIndexIncrement[viewWallIndex])) {
+ wallOrnamentIndex = kDMDerivedBitmapFirstWallOrnament + (wallOrnamentIndex << 2) + wallOrnDerivedBitmapIndexIncrement[viewWallIndex];
+ if (!isDerivedBitmapInCache(wallOrnamentIndex)) {
byte *blitBitmap = getNativeBitmapOrGraphic(ornNativeBitmapIndex);
blitToBitmapShrinkWithPalChange(blitBitmap, getDerivedBitmap(wallOrnamentIndex), ornBlitBitmap[4] << 1, ornBlitBitmap[5], ornCoordSet[4] << 1, ornCoordSet[5], (viewWallIndex <= kDMViewWallD3RFront) ? _palChangesDoorButtonAndWallOrnD3 : _palChangesDoorButtonAndWallOrnD2);
addDerivedBitmap(wallOrnamentIndex);
@@ -2751,15 +2771,14 @@ bool DisplayMan::isDrawnWallOrnAnAlcove(int16 wallOrnOrd, ViewWall viewWallIndex
}
}
- Box tmpBox(ornCoordSet);
- blitToBitmap(ornBlitBitmap, _bitmapViewport, tmpBox,
- blitPosX, 0,
- ornCoordSet[4], k112_byteWidthViewport, k10_ColorFlesh, ornCoordSet[5], k136_heightViewport);
+ Box tmpBox(ornCoordSet[0], ornCoordSet[1], ornCoordSet[2], ornCoordSet[3]);
+ blitToBitmap(ornBlitBitmap, _bitmapViewport, tmpBox, blitPosX, 0,
+ ornCoordSet[4], k112_byteWidthViewport, kDMColorFlesh, ornCoordSet[5], k136_heightViewport);
if ((viewWallIndex == kDMViewWallD1CFront) && _championPortraitOrdinal--) {
blitToBitmap(getNativeBitmapOrGraphic(k26_ChampionPortraitsIndice), _bitmapViewport, boxChampionPortraitOnWall,
(_championPortraitOrdinal & 0x0007) << 5, (_championPortraitOrdinal >> 3) * 29,
- k128_byteWidth, k112_byteWidthViewport, k1_ColorDarkGary, 87, k136_heightViewport); /* A portrait is 32x29 pixels */
+ k128_byteWidth, k112_byteWidthViewport, kDMColorDarkGary, 87, k136_heightViewport); /* A portrait is 32x29 pixels */
}
return isAlcove;
@@ -2800,7 +2819,7 @@ uint32 DisplayMan::getCompressedDataSize(uint16 index) {
return _packedItemPos[index + 1] - _packedItemPos[index];
}
-void DisplayMan::drawField(FieldAspect* fieldAspect, Box& box) {
+void DisplayMan::drawField(FieldAspect *fieldAspect, Box& box) {
byte *bitmapMask = nullptr;
if (fieldAspect->_mask != kMaskFieldAspectNoMask) {
@@ -2812,13 +2831,13 @@ void DisplayMan::drawField(FieldAspect* fieldAspect, Box& box) {
}
}
- isDerivedBitmapInCache(k0_DerivedBitmapViewport);
+ isDerivedBitmapInCache(kDMDerivedBitmapViewport);
byte *bitmap = getNativeBitmapOrGraphic(k73_FieldTeleporterGraphicIndice + fieldAspect->_nativeBitmapRelativeIndex);
- blitBoxFilledWithMaskedBitmap(bitmap, _bitmapViewport, bitmapMask, getDerivedBitmap(k0_DerivedBitmapViewport), box,
+ blitBoxFilledWithMaskedBitmap(bitmap, _bitmapViewport, bitmapMask, getDerivedBitmap(kDMDerivedBitmapViewport), box,
_vm->getRandomNumber(2) + fieldAspect->_baseStartUnitIndex, _vm->getRandomNumber(32), k112_byteWidthViewport,
(Color)fieldAspect->_transparentColor, fieldAspect->_xPos, 0, 136, fieldAspect->_bitplaneWordCount);
- addDerivedBitmap(k0_DerivedBitmapViewport);
- releaseBlock(k0_DerivedBitmapViewport | 0x8000);
+ addDerivedBitmap(kDMDerivedBitmapViewport);
+ releaseBlock(kDMDerivedBitmapViewport | 0x8000);
}
int16 DisplayMan::getScaledBitmapByteCount(int16 byteWidth, int16 height, int16 scale) {
@@ -2830,7 +2849,7 @@ int16 DisplayMan::getScaledDimension(int16 dimension, int16 scale) {
}
void DisplayMan::drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Direction directionParam, int16 mapXpos,
- int16 mapYpos, int16 viewSquareIndex, uint16 orderedViewCellOrdinals) {
+ int16 mapYpos, int16 viewSquareIndex, CellOrder cellOrder) {
int16 AL_0_creatureIndexRed;
#define AL_1_viewSquareExplosionIndex viewSquareIndex
int16 L0126_i_Multiple;
@@ -2847,7 +2866,7 @@ void DisplayMan::drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Dir
#define AL_4_projectileAspect L0127_i_Multiple
#define AL_4_explosionType L0127_i_Multiple
#define AL_4_explosionAspectIndex L0127_i_Multiple
- ObjectAspect* objectAspect;
+ ObjectAspect *objectAspect;
uint32 remainingViewCellOrdinalsToProcess;
byte *coordinateSet;
int16 derivedBitmapIndex = -1;
@@ -2871,10 +2890,10 @@ void DisplayMan::drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Dir
uint16 L0150_ui_Multiple = 0;
#define AL_8_shiftSetIndex L0150_ui_Multiple
#define AL_8_projectileScaleIndex L0150_ui_Multiple
- CreatureAspect* creatureAspectStruct;
- int16 creatureSize;
+ CreatureAspect *creatureAspectStruct = nullptr;
+ int16 creatureSize = 0;
int16 creatureDirectionDelta;
- int16 creatureGraphicInfoGreen;
+ int16 creatureGraphicInfoGreen = 0;
int16 creatureGraphicInfoRed;
int16 creatureAspectInt;
int16 creatureIndexGreen;
@@ -2888,7 +2907,7 @@ void DisplayMan::drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Dir
bool useFlippedHorizontallyCreatureFrontImage;
bool drawCreaturesCompleted; /* Set to true when the last creature that the function should draw is being drawn. This is used to avoid processing the code to draw creatures for the remaining square cells */
int16 doorFrontViewDrawingPass; /* Value 0, 1 or 2 */
- int16 projectilePosX;
+ int16 projectilePosX = 0;
int16 projectileDirection;
int16 projectileAspectType;
int16 projectileBitmapIndexDelta;
@@ -3079,28 +3098,30 @@ void DisplayMan::drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Dir
if (thingParam == Thing::_endOfList)
return;
+ int16 orderedViewCellOrdinals = cellOrder;
Group *group = nullptr;
Thing groupThing = Thing::_none;
bool squareHasExplosion = drawCreaturesCompleted = false;
bool squareHasProjectile = false;
cellCounter = 0;
firstThingToDraw = thingParam;
- if (getFlag(orderedViewCellOrdinals, k0x0008_CellOrder_DoorFront)) { /* If the function call is to draw objects on a door square viewed from the front */
+ if (getFlag(orderedViewCellOrdinals, kDMMaskDoorFront)) { /* If the function call is to draw objects on a door square viewed from the front */
doorFrontViewDrawingPass = (orderedViewCellOrdinals & 0x0001) + 1; /* Two function calls are made in that case to draw objects on both sides of the door frame. The door and its frame are drawn between the two calls. This value indicates the drawing pass so that creatures are drawn in the right order and so that Fluxcages are not drawn twice */
orderedViewCellOrdinals >>= 4; /* Remove the first nibble that was used for the door front view pass */
} else
doorFrontViewDrawingPass = 0; /* The function call is not to draw objects on a door square viewed from the front */
- L0135_B_DrawAlcoveObjects = !(remainingViewCellOrdinalsToProcess = orderedViewCellOrdinals);
+ remainingViewCellOrdinalsToProcess = orderedViewCellOrdinals;
+ L0135_B_DrawAlcoveObjects = !(remainingViewCellOrdinalsToProcess);
AL_10_viewSquareIndexBackup = viewSquareIndex;
viewLane = (ViewLane)((viewSquareIndex + 3) % 3);
bool twoHalfSquareCreaturesFrontView;
- byte *bitmapRedBanana;
- byte *bitmapGreenAnt;
+ byte *bitmapRedBanana = nullptr;
+ byte *bitmapGreenAnt = nullptr;
do {
/* Draw objects */
if (L0135_B_DrawAlcoveObjects) {
- AL_2_viewCell = k4_ViewCellAlcove; /* Index of coordinates to draw objects in alcoves */
+ AL_2_viewCell = kDMViewCellAlcove; /* Index of coordinates to draw objects in alcoves */
cellYellowBear = _vm->returnOppositeDir(directionParam); /* Alcove is on the opposite direction of the viewing direction */
objectShiftIndex = 2;
} else {
@@ -3116,7 +3137,8 @@ void DisplayMan::drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Dir
objectShiftIndex += (cellYellowBear & 0x0001) << 3;
drawProjectileAsObject = false;
do {
- if ((AL_4_thingType = thingParam.getType()) == kDMThingTypeGroup) {
+ AL_4_thingType = thingParam.getType();
+ if (AL_4_thingType == kDMThingTypeGroup) {
groupThing = thingParam;
continue;
}
@@ -3131,7 +3153,7 @@ void DisplayMan::drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Dir
continue;
}
- if ((viewSquareIndex >= k0_ViewSquare_D3C) && (viewSquareIndex <= k9_ViewSquare_D0C) && (thingParam.getCell() == cellYellowBear)) { /* Square where objects are visible and object is located on cell being processed */
+ if ((viewSquareIndex >= kDMViewSquareD3C) && (viewSquareIndex <= kDMViewSquareD0C) && (thingParam.getCell() == cellYellowBear)) { /* Square where objects are visible and object is located on cell being processed */
objectAspect = &(_objectAspects209[_vm->_dungeonMan->_objectInfos[_vm->_dungeonMan->getObjectInfoIndex(thingParam)]._objectAspectIndex]);
AL_4_nativeBitmapIndex = k360_FirstObjectGraphicIndice + objectAspect->_firstNativeBitmapRelativeIndex;
useAlcoveObjectImage = (L0135_B_DrawAlcoveObjects && getFlag(objectAspect->_graphicInfo, k0x0010_ObjectAlcoveMask) && (viewLane == kDMViewLaneCenter));
@@ -3144,11 +3166,11 @@ void DisplayMan::drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Dir
T0115015_DrawProjectileAsObject:
flipHorizontal = getFlag(objectAspect->_graphicInfo, k0x0001_ObjectFlipOnRightMask) &&
!useAlcoveObjectImage &&
- ((viewLane == kDMViewLaneRight) || ((viewLane == kDMViewLaneCenter) && ((AL_2_viewCell == k1_ViewCellFrontRight) || (AL_2_viewCell == k2_ViewCellBackRight))));
+ ((viewLane == kDMViewLaneRight) || ((viewLane == kDMViewLaneCenter) && ((AL_2_viewCell == kDMViewCellFrontRight) || (AL_2_viewCell == kDMViewCellBackRight))));
/* Flip horizontally if object graphic requires it and is not being drawn in an alcove and the object is either on the right lane or on the right column of the center lane */
paddingPixelCount = 0;
- if ((viewSquareIndex == k9_ViewSquare_D0C) || ((viewSquareIndex >= k6_ViewSquare_D1C) && (AL_2_viewCell >= k2_ViewCellBackRight))) {
+ if ((viewSquareIndex == kDMViewSquareD0C) || ((viewSquareIndex >= kDMViewSquareD1C) && (AL_2_viewCell >= kDMViewCellBackRight))) {
drawingGrabbableObject = ((viewLane == kDMViewLaneCenter) && !drawProjectileAsObject); /* If object is in the center lane (only D0C or D1C with condition above) and is not a projectile */
AL_8_shiftSetIndex = k0_ShiftSet_D0BackD1Front;
bitmapRedBanana = getNativeBitmapOrGraphic(AL_4_nativeBitmapIndex); /* Use base graphic, no resizing */
@@ -3160,9 +3182,9 @@ T0115015_DrawProjectileAsObject:
}
} else {
drawingGrabbableObject = false;
- derivedBitmapIndex = k104_DerivedBitmapFirstObject + objectAspect->_firstDerivedBitmapRelativeIndex;
- byte* paletteChanges;
- if ((viewSquareIndex >= k6_ViewSquare_D1C) || ((viewSquareIndex >= k3_ViewSquare_D2C) && (AL_2_viewCell >= k2_ViewCellBackRight))) {
+ derivedBitmapIndex = kDMDerivedBitmapFirstObject + objectAspect->_firstDerivedBitmapRelativeIndex;
+ byte *paletteChanges;
+ if ((viewSquareIndex >= kDMViewSquareD1C) || ((viewSquareIndex >= kDMViewSquareD2C) && (AL_2_viewCell >= kDMViewCellBackRight))) {
derivedBitmapIndex++;
AL_8_shiftSetIndex = k1_ShiftSet_D1BackD2Front;
byteWidth = getScaledDimension(objectAspect->_byteWidth, k20_Scale_D2);
@@ -3184,7 +3206,8 @@ T0115015_DrawProjectileAsObject:
bitmapRedBanana = getDerivedBitmap(derivedBitmapIndex);
else {
bitmapGreenAnt = getNativeBitmapOrGraphic(AL_4_nativeBitmapIndex);
- blitToBitmapShrinkWithPalChange(bitmapGreenAnt, bitmapRedBanana = getDerivedBitmap(derivedBitmapIndex), objectAspect->_byteWidth << 1, objectAspect->_height, byteWidth << 1, heightRedEagle, paletteChanges);
+ bitmapRedBanana = getDerivedBitmap(derivedBitmapIndex);
+ blitToBitmapShrinkWithPalChange(bitmapGreenAnt, bitmapRedBanana, objectAspect->_byteWidth << 1, objectAspect->_height, byteWidth << 1, heightRedEagle, paletteChanges);
if (flipHorizontal)
flipBitmapHorizontal(bitmapRedBanana, getNormalizedByteWidth(byteWidth), heightRedEagle);
@@ -3192,10 +3215,10 @@ T0115015_DrawProjectileAsObject:
}
}
AL_4_xPos = coordinateSet[0];
- boxByteGreen._y2 = coordinateSet[1];
+ boxByteGreen._rect.bottom = coordinateSet[1];
if (!drawProjectileAsObject) { /* If drawing an object that is not a projectile */
AL_4_xPos += shiftSets[AL_8_shiftSetIndex][objectPileShiftSetIndices[objectShiftIndex][0]];
- boxByteGreen._y2 += shiftSets[AL_8_shiftSetIndex][objectPileShiftSetIndices[objectShiftIndex][1]];
+ boxByteGreen._rect.bottom += shiftSets[AL_8_shiftSetIndex][objectPileShiftSetIndices[objectShiftIndex][1]];
objectShiftIndex++; /* The next object drawn will use the next shift values */
if (L0135_B_DrawAlcoveObjects) {
if (objectShiftIndex >= 14)
@@ -3203,13 +3226,13 @@ T0115015_DrawProjectileAsObject:
} else
objectShiftIndex &= 0x000F;
}
- boxByteGreen._y1 = boxByteGreen._y2 - (heightRedEagle - 1);
- if (boxByteGreen._y2 > 135)
- boxByteGreen._y2 = 135;
+ boxByteGreen._rect.top = boxByteGreen._rect.bottom - (heightRedEagle - 1);
+ if (boxByteGreen._rect.bottom > 135)
+ boxByteGreen._rect.bottom = 135;
- boxByteGreen._x2 = MIN(223, AL_4_xPos + byteWidth);
- boxByteGreen._x1 = MAX(0, AL_4_xPos - byteWidth + 1);
- if (boxByteGreen._x1) {
+ boxByteGreen._rect.right = MIN(223, AL_4_xPos + byteWidth);
+ boxByteGreen._rect.left = MAX(0, AL_4_xPos - byteWidth + 1);
+ if (boxByteGreen._rect.left) {
if (flipHorizontal)
AL_4_xPos = paddingPixelCount;
else
@@ -3222,34 +3245,35 @@ T0115015_DrawProjectileAsObject:
Box *AL_6_box = &_vm->_dungeonMan->_dungeonViewClickableBoxes[AL_2_viewCell];
- if (AL_6_box->_x1 == 255) { /* If the grabbable object is the first */
+ if (AL_6_box->_rect.left == 255) { /* If the grabbable object is the first */
*AL_6_box = boxByteGreen;
- if ((heightGreenGoat = AL_6_box->_y2 - AL_6_box->_y1) < 14) { /* If the box is too small then enlarge it a little */
+ heightGreenGoat = AL_6_box->_rect.bottom - AL_6_box->_rect.top;
+ if (heightGreenGoat < 14) { /* If the box is too small then enlarge it a little */
heightGreenGoat = heightGreenGoat >> 1;
- AL_6_box->_y1 += heightGreenGoat - 7;
+ AL_6_box->_rect.top += heightGreenGoat - 7;
if (heightGreenGoat < 4)
- AL_6_box->_y2 -= heightGreenGoat - 3;
+ AL_6_box->_rect.bottom -= heightGreenGoat - 3;
}
} else { /* If there are several grabbable objects then enlarge the box so it includes all objects */
- AL_6_box->_x1 = MIN(AL_6_box->_x1, boxByteGreen._x1);
- AL_6_box->_x2 = MAX(AL_6_box->_x2, boxByteGreen._x2);
- AL_6_box->_y1 = MIN(AL_6_box->_y1, boxByteGreen._y1);
- AL_6_box->_y2 = MAX(AL_6_box->_y2, boxByteGreen._y2);
+ AL_6_box->_rect.left = MIN(AL_6_box->_rect.left, boxByteGreen._rect.left);
+ AL_6_box->_rect.right = MAX(AL_6_box->_rect.right, boxByteGreen._rect.right);
+ AL_6_box->_rect.top = MIN(AL_6_box->_rect.top, boxByteGreen._rect.top);
+ AL_6_box->_rect.bottom = MAX(AL_6_box->_rect.bottom, boxByteGreen._rect.bottom);
}
bitmapRedBanana = bitmapGreenAnt;
_vm->_dungeonMan->_pileTopObject[AL_2_viewCell] = thingParam; /* The object is at the top of the pile */
}
- blitToBitmap(bitmapRedBanana, _bitmapViewport, boxByteGreen, AL_4_xPos, 0, getNormalizedByteWidth(byteWidth), k112_byteWidthViewport, k10_ColorFlesh, heightRedEagle, k136_heightViewport);
+ blitToBitmap(bitmapRedBanana, _bitmapViewport, boxByteGreen, AL_4_xPos, 0, getNormalizedByteWidth(byteWidth), k112_byteWidthViewport, kDMColorFlesh, heightRedEagle, k136_heightViewport);
if (drawProjectileAsObject)
goto T0115171_BackFromT0115015_DrawProjectileAsObject;
}
} while ((thingParam = _vm->_dungeonMan->getNextThing(thingParam)) != Thing::_endOfList);
- if (AL_2_viewCell == k4_ViewCellAlcove)
+ if (AL_2_viewCell == kDMViewCellAlcove)
break; /* End of processing when drawing objects in an alcove */
- if (viewSquareIndex < k0_ViewSquare_D3C)
+ if (viewSquareIndex < kDMViewSquareD3C)
break; /* End of processing if square is too far away at D4 */
/* Draw creatures */
- drawingLastBackRowCell = ((AL_2_viewCell <= k1_ViewCellFrontRight) || (cellCounter == 1)) && (!remainingViewCellOrdinalsToProcess || ((remainingViewCellOrdinalsToProcess & 0x0000000F) >= 3)); /* If (draw cell on the back row or second cell being processed) and (no more cells to draw or next cell to draw is a cell on the front row) */
+ drawingLastBackRowCell = ((AL_2_viewCell <= kDMViewCellFrontRight) || (cellCounter == 1)) && (!remainingViewCellOrdinalsToProcess || ((remainingViewCellOrdinalsToProcess & 0x0000000F) >= 3)); /* If (draw cell on the back row or second cell being processed) and (no more cells to draw or next cell to draw is a cell on the front row) */
if ((groupThing == Thing::_none) || drawCreaturesCompleted)
goto T0115129_DrawProjectiles; /* Skip code to draw creatures */
@@ -3259,7 +3283,7 @@ T0115015_DrawProjectileAsObject:
activeGroup = &_vm->_groupMan->_activeGroups[group->getActiveGroupIndex()];
CreatureInfo *creatureInfo = &_vm->_dungeonMan->_creatureInfos[group->_type];
creatureAspectStruct = &_creatureAspects219[creatureInfo->_creatureAspectIndex];
- creatureSize = getFlag(creatureInfo->_attributes, k0x0003_MaskCreatureInfo_size);
+ creatureSize = getFlag(creatureInfo->_attributes, kDMCreatureMaskSize);
creatureGraphicInfoGreen = creatureInfo->_graphicInfo;
}
objectAspect = (ObjectAspect *)creatureAspectStruct;
@@ -3268,7 +3292,7 @@ T0115015_DrawProjectileAsObject:
if (AL_0_creatureIndexRed) { /* If there is a creature on the cell being processed */
AL_0_creatureIndexRed--; /* Convert ordinal to index */
creatureIndexGreen = AL_0_creatureIndexRed;
- } else if (creatureSize == k1_MaskCreatureSizeHalf) {
+ } else if (creatureSize == kDMCreatureSizeHalf) {
AL_0_creatureIndexRed = 0;
creatureIndexGreen = -1;
} else
@@ -3276,16 +3300,17 @@ T0115015_DrawProjectileAsObject:
creatureDirectionDelta = _vm->normalizeModulo4(directionParam - _vm->_groupMan->getCreatureValue(activeGroup->_directions, AL_0_creatureIndexRed));
twoHalfSquareCreaturesFrontView = false;
- if ((AL_4_groupCells = activeGroup->_cells) == k255_CreatureTypeSingleCenteredCreature) { /* If there is a single centered creature in the group */
+ AL_4_groupCells = activeGroup->_cells;
+ if (AL_4_groupCells == kDMCreatureTypeSingleCenteredCreature) { /* If there is a single centered creature in the group */
if (remainingViewCellOrdinalsToProcess || (doorFrontViewDrawingPass == 1))
goto T0115129_DrawProjectiles; /* Do not draw a single centered creature now, wait until second pass (for a front view door) or until all cells have been drawn so the creature is drawn over all the objects on the floor */
drawCreaturesCompleted = true;
- if ((creatureSize == k1_MaskCreatureSizeHalf) && (creatureDirectionDelta & 0x0001)) /* Side view of half square creature */
+ if ((creatureSize == kDMCreatureSizeHalf) && (creatureDirectionDelta & 0x0001)) /* Side view of half square creature */
AL_2_viewCell = k3_HalfSizedViewCell_CenterColumn;
else
AL_2_viewCell = k4_HalfSizedViewCell_FrontRow;
- } else if ((creatureSize == k1_MaskCreatureSizeHalf) && (drawingLastBackRowCell || !remainingViewCellOrdinalsToProcess || (creatureIndexGreen < 0))) {
+ } else if ((creatureSize == kDMCreatureSizeHalf) && (drawingLastBackRowCell || !remainingViewCellOrdinalsToProcess || (creatureIndexGreen < 0))) {
if (drawingLastBackRowCell && (doorFrontViewDrawingPass != 2)) {
if ((creatureIndexGreen >= 0) && (creatureDirectionDelta & 0x0001))
AL_2_viewCell = k2_HalfSizedViewCell_BackRow; /* Side view of a half square creature on the back row. Drawn during pass 1 for a door square */
@@ -3303,18 +3328,19 @@ T0115015_DrawProjectileAsObject:
creatureIndexGreen = 0;
twoHalfSquareCreaturesFrontView = group->getCount();
- if (((AL_4_groupCells = _vm->_groupMan->getCreatureValue(AL_4_groupCells, AL_0_creatureIndexRed)) == directionParam) || (AL_4_groupCells == _vm->turnDirLeft(directionParam)))
+ AL_4_groupCells = _vm->_groupMan->getCreatureValue(AL_4_groupCells, AL_0_creatureIndexRed);
+ if ((AL_4_groupCells == directionParam) || (AL_4_groupCells == _vm->turnDirLeft(directionParam)))
AL_2_viewCell = k0_HalfSizedViewCell_LeftColumn;
else
AL_2_viewCell = k1_HalfSizedViewCell_RightColumn;
}
} else
goto T0115129_DrawProjectiles;
- } else if (creatureSize != k0_MaskCreatureSizeQuarter)
+ } else if (creatureSize != kDMCreatureSizeQuarter)
goto T0115129_DrawProjectiles;
creatureAspectInt = activeGroup->_aspect[creatureIndexGreen];
- if (viewSquareIndex > k9_ViewSquare_D0C)
+ if (viewSquareIndex > kDMViewSquareD0C)
viewSquareIndex--;
T0115077_DrawSecondHalfSquareCreature:
@@ -3326,7 +3352,7 @@ T0115077_DrawSecondHalfSquareCreature:
derivedBitmapIndex = ((CreatureAspect *)objectAspect)->_firstDerivedBitmapIndex;
int16 sourceByteWidth;
int16 sourceHeight;
- useCreatureSideBitmap = getFlag(creatureGraphicInfoRed, k0x0008_CreatureInfoGraphicMaskSide) && (creatureDirectionDelta & 0x0001);
+ useCreatureSideBitmap = getFlag(creatureGraphicInfoRed, kDMCreatureMaskSide) && (creatureDirectionDelta & 0x0001);
if (useCreatureSideBitmap) {
useCreatureAttackBitmap = useFlippedHorizontallyCreatureFrontImage = useCreatureBackBitmap = false;
AL_4_nativeBitmapIndex++; /* Skip the front image. Side image is right after the front image */
@@ -3334,20 +3360,20 @@ T0115077_DrawSecondHalfSquareCreature:
sourceByteWidth = byteWidth = ((CreatureAspect *)objectAspect)->_byteWidthSide;
sourceHeight = heightRedEagle = ((CreatureAspect *)objectAspect)->_heightSide;
} else {
- useCreatureBackBitmap = getFlag(creatureGraphicInfoRed, k0x0010_CreatureInfoGraphicMaskBack) && (creatureDirectionDelta == 0);
+ useCreatureBackBitmap = getFlag(creatureGraphicInfoRed, kDMCreatureMaskBack) && (creatureDirectionDelta == 0);
useCreatureAttackBitmap = !useCreatureBackBitmap;
- if (useCreatureAttackBitmap && getFlag(creatureAspectInt, k0x0080_MaskActiveGroupIsAttacking) && getFlag(creatureGraphicInfoRed, k0x0020_CreatureInfoGraphicMaskAttack)) {
+ if (useCreatureAttackBitmap && getFlag(creatureAspectInt, kDMAspectMaskActiveGroupIsAttacking) && getFlag(creatureGraphicInfoRed, kDMCreatureMaskAttack)) {
useFlippedHorizontallyCreatureFrontImage = false;
sourceByteWidth = byteWidth = ((CreatureAspect *)objectAspect)->_byteWidthAttack;
sourceHeight = heightRedEagle = ((CreatureAspect *)objectAspect)->_heightAttack;
AL_4_nativeBitmapIndex++; /* Skip the front image */
derivedBitmapIndex += 2;
- if (getFlag(creatureGraphicInfoRed, k0x0008_CreatureInfoGraphicMaskSide)) {
+ if (getFlag(creatureGraphicInfoRed, kDMCreatureMaskSide)) {
AL_4_nativeBitmapIndex++; /* If the creature has a side image, it preceeds the attack image */
derivedBitmapIndex += 2;
}
- if (getFlag(creatureGraphicInfoRed, k0x0010_CreatureInfoGraphicMaskBack)) {
+ if (getFlag(creatureGraphicInfoRed, kDMCreatureMaskBack)) {
AL_4_nativeBitmapIndex++; /* If the creature has a back image, it preceeds the attack image */
derivedBitmapIndex += 2;
}
@@ -3356,7 +3382,7 @@ T0115077_DrawSecondHalfSquareCreature:
sourceHeight = heightRedEagle = ((CreatureAspect *)objectAspect)->_heightFront;
if (useCreatureBackBitmap) {
useFlippedHorizontallyCreatureFrontImage = false;
- if (getFlag(creatureGraphicInfoRed, k0x0008_CreatureInfoGraphicMaskSide)) {
+ if (getFlag(creatureGraphicInfoRed, kDMCreatureMaskSide)) {
AL_4_nativeBitmapIndex += 2; /* If the creature has a side image, it preceeds the back image */
derivedBitmapIndex += 4;
} else {
@@ -3364,16 +3390,16 @@ T0115077_DrawSecondHalfSquareCreature:
derivedBitmapIndex += 2;
}
} else {
- useFlippedHorizontallyCreatureFrontImage = getFlag(creatureGraphicInfoRed, k0x0004_CreatureInfoGraphicMaskFlipNonAttack) && getFlag(creatureAspectInt, k0x0040_MaskActiveGroupFlipBitmap);
+ useFlippedHorizontallyCreatureFrontImage = getFlag(creatureGraphicInfoRed, kDMCreatureMaskFlipNonAttack) && getFlag(creatureAspectInt, kDMAspectMaskActiveGroupFlipBitmap);
if (useFlippedHorizontallyCreatureFrontImage) {
derivedBitmapIndex += 2;
- if (getFlag(creatureGraphicInfoRed, k0x0008_CreatureInfoGraphicMaskSide))
+ if (getFlag(creatureGraphicInfoRed, kDMCreatureMaskSide))
derivedBitmapIndex += 2;
- if (getFlag(creatureGraphicInfoRed, k0x0010_CreatureInfoGraphicMaskBack))
+ if (getFlag(creatureGraphicInfoRed, kDMCreatureMaskBack))
derivedBitmapIndex += 2;
- if (getFlag(creatureGraphicInfoRed, k0x0020_CreatureInfoGraphicMaskAttack))
+ if (getFlag(creatureGraphicInfoRed, kDMCreatureMaskAttack))
derivedBitmapIndex += 2;
}
}
@@ -3381,7 +3407,7 @@ T0115077_DrawSecondHalfSquareCreature:
}
int16 scale;
- if (viewSquareIndex >= k6_ViewSquare_D1C) { /* Creature is on D1 */
+ if (viewSquareIndex >= kDMViewSquareD1C) { /* Creature is on D1 */
creaturePaddingPixelCount = 0;
AL_8_shiftSetIndex = k0_ShiftSet_D0BackD1Front;
transparentColor = ((CreatureAspect *)objectAspect)->getTranspColour();
@@ -3393,7 +3419,7 @@ T0115077_DrawSecondHalfSquareCreature:
}
} else if (useCreatureBackBitmap || !useFlippedHorizontallyCreatureFrontImage) {
bitmapRedBanana = getNativeBitmapOrGraphic(AL_4_nativeBitmapIndex);
- if (useCreatureAttackBitmap && getFlag(creatureAspectInt, k0x0040_MaskActiveGroupFlipBitmap)) {
+ if (useCreatureAttackBitmap && getFlag(creatureAspectInt, kDMAspectMaskActiveGroupFlipBitmap)) {
copyBitmapAndFlipHorizontal(bitmapRedBanana, _tmpBitmap, byteWidth, heightRedEagle);
bitmapRedBanana = _tmpBitmap;
}
@@ -3401,20 +3427,21 @@ T0115077_DrawSecondHalfSquareCreature:
bitmapRedBanana = getDerivedBitmap(derivedBitmapIndex);
else {
bitmapGreenAnt = getNativeBitmapOrGraphic(AL_4_nativeBitmapIndex);
- if (getFlag(creatureGraphicInfoRed, k0x0004_CreatureInfoGraphicMaskFlipNonAttack))
- copyBitmapAndFlipHorizontal(bitmapGreenAnt, bitmapRedBanana = getDerivedBitmap(derivedBitmapIndex), byteWidth, heightRedEagle);
-
+ if (getFlag(creatureGraphicInfoRed, kDMCreatureMaskFlipNonAttack)) {
+ bitmapRedBanana = getDerivedBitmap(derivedBitmapIndex);
+ copyBitmapAndFlipHorizontal(bitmapGreenAnt, bitmapRedBanana, byteWidth, heightRedEagle);
+ }
addDerivedBitmap(derivedBitmapIndex);
}
} else { /* Creature is on D2 or D3 */
if (useFlippedHorizontallyCreatureFrontImage)
derivedBitmapIndex++; /* Skip front D1 image in additional graphics */
- byte* paletteChanges;
- if (viewSquareIndex >= k3_ViewSquare_D2C) { /* Creature is on D2 */
+ byte *paletteChanges;
+ if (viewSquareIndex >= kDMViewSquareD2C) { /* Creature is on D2 */
derivedBitmapIndex++; /* Skip front D3 image in additional graphics */
AL_8_shiftSetIndex = k1_ShiftSet_D1BackD2Front;
- useCreatureSpecialD2FrontBitmap = getFlag(creatureGraphicInfoRed, k0x0080_CreatureInfoGraphicMaskSpecialD2Front) && !useCreatureSideBitmap && !useCreatureBackBitmap && !useCreatureAttackBitmap;
+ useCreatureSpecialD2FrontBitmap = getFlag(creatureGraphicInfoRed, kDMCreatureMaskSpecialD2Front) && !useCreatureSideBitmap && !useCreatureBackBitmap && !useCreatureAttackBitmap;
paletteChanges = _palChangesCreatureD2;
scale = k20_Scale_D2;
} else { /* Creature is on D3 */
@@ -3433,13 +3460,14 @@ T0115077_DrawSecondHalfSquareCreature:
bitmapRedBanana = getDerivedBitmap(derivedBitmapIndex);
else {
bitmapGreenAnt = getNativeBitmapOrGraphic(AL_4_nativeBitmapIndex);
- blitToBitmapShrinkWithPalChange(bitmapGreenAnt, bitmapRedBanana = getDerivedBitmap(derivedBitmapIndex), sourceByteWidth << 1, sourceHeight, byteWidth << 1, heightRedEagle, paletteChanges);
+ bitmapRedBanana = getDerivedBitmap(derivedBitmapIndex);
+ blitToBitmapShrinkWithPalChange(bitmapGreenAnt, bitmapRedBanana, sourceByteWidth << 1, sourceHeight, byteWidth << 1, heightRedEagle, paletteChanges);
addDerivedBitmap(derivedBitmapIndex);
}
if ((useCreatureSideBitmap && (creatureDirectionDelta == 1)) || /* If creature is viewed from the right, the side view must be flipped */
- (useCreatureAttackBitmap && getFlag(creatureAspectInt, k0x0040_MaskActiveGroupFlipBitmap)) ||
- (useCreatureSpecialD2FrontBitmap && getFlag(creatureGraphicInfoRed, k0x0100_CreatureInfoGraphicMaskSpecialD2FrontIsFlipped)) ||
- (useFlippedHorizontallyCreatureFrontImage && getFlag(creatureGraphicInfoRed, k0x0004_CreatureInfoGraphicMaskFlipNonAttack))) { /* If the graphic should be flipped */
+ (useCreatureAttackBitmap && getFlag(creatureAspectInt, kDMAspectMaskActiveGroupFlipBitmap)) ||
+ (useCreatureSpecialD2FrontBitmap && getFlag(creatureGraphicInfoRed, kDMCreatureMaskSpecialD2FrontIsFlipped)) ||
+ (useFlippedHorizontallyCreatureFrontImage && getFlag(creatureGraphicInfoRed, kDMCreatureMaskFlipNonAttack))) { /* If the graphic should be flipped */
if (!useFlippedHorizontallyCreatureFrontImage || !derivedBitmapInCache) {
AL_4_normalizdByteWidth = getNormalizedByteWidth(byteWidth);
if (!useFlippedHorizontallyCreatureFrontImage) {
@@ -3454,8 +3482,8 @@ T0115077_DrawSecondHalfSquareCreature:
}
AL_4_yPos = coordinateSet[1];
AL_4_yPos += shiftSets[AL_8_shiftSetIndex][getVerticalOffsetM23(creatureAspectInt)];
- boxByteGreen._y2 = MIN(AL_4_yPos, (int16)135);
- boxByteGreen._y1 = MAX(0, AL_4_yPos - (heightRedEagle - 1));
+ boxByteGreen._rect.bottom = MIN(AL_4_yPos, (int16)135);
+ boxByteGreen._rect.top = MAX(0, AL_4_yPos - (heightRedEagle - 1));
AL_4_xPos = coordinateSet[0];
AL_4_xPos += shiftSets[AL_8_shiftSetIndex][getHorizontalOffsetM22(creatureAspectInt)];
@@ -3464,14 +3492,14 @@ T0115077_DrawSecondHalfSquareCreature:
else if (viewLane != kDMViewLaneCenter) /* Lane right */
AL_4_xPos += 100;
- boxByteGreen._x2 = CLIP(0, AL_4_xPos + byteWidth, 223);
+ boxByteGreen._rect.right = CLIP(0, AL_4_xPos + byteWidth, 223);
- if (!boxByteGreen._x2)
+ if (!boxByteGreen._rect.right)
goto T0115126_CreatureNotVisible;
int16 AL_0_creaturePosX;
- boxByteGreen._x1 = CLIP(0, AL_4_xPos - byteWidth + 1, 223);
- if (boxByteGreen._x1) {
- if (boxByteGreen._x1 == 223)
+ boxByteGreen._rect.left = CLIP(0, AL_4_xPos - byteWidth + 1, 223);
+ if (boxByteGreen._rect.left) {
+ if (boxByteGreen._rect.left == 223)
goto T0115126_CreatureNotVisible;
AL_0_creaturePosX = creaturePaddingPixelCount;
} else
@@ -3495,7 +3523,7 @@ T0115129_DrawProjectiles:
if (!squareHasProjectile)
continue;
viewSquareIndex = AL_10_viewSquareIndexBackup;
- if (viewSquareIndex > k9_ViewSquare_D0C)
+ if (viewSquareIndex > kDMViewSquareD0C)
continue;
AL_2_viewCell = currentViewCellToDraw;
projectilePosX = objectCoordinateSets[0][viewSquareIndex][AL_2_viewCell][0];
@@ -3506,13 +3534,14 @@ T0115129_DrawProjectiles:
do {
if ((thingParam.getType() == kDMThingTypeProjectile) && (thingParam.getCell() == cellYellowBear)) {
Projectile *projectile = (Projectile *)_vm->_dungeonMan->getThingData(thingParam);
- if ((AL_4_projectileAspect = _vm->_dungeonMan->getProjectileAspect(projectile->_slot)) < 0) { /* Negative value: projectile aspect is the ordinal of a PROJECTIL_ASPECT */
+ AL_4_projectileAspect = _vm->_dungeonMan->getProjectileAspect(projectile->_slot);
+ if (AL_4_projectileAspect < 0) { /* Negative value: projectile aspect is the ordinal of a PROJECTIL_ASPECT */
objectAspect = (ObjectAspect *)&_projectileAspect[_vm->ordinalToIndex(-AL_4_projectileAspect)];
AL_4_nativeBitmapIndex = ((ProjectileAspect *)objectAspect)->_firstNativeBitmapRelativeIndex + k316_FirstProjectileGraphicIndice;
projectileAspectType = getFlag(((ProjectileAspect *)objectAspect)->_graphicInfo, k0x0003_ProjectileAspectTypeMask);
bool doNotScaleWithKineticEnergy = !getFlag(((ProjectileAspect *)objectAspect)->_graphicInfo, k0x0100_ProjectileScaleWithKineticEnergyMask);
- if ((doNotScaleWithKineticEnergy || (projectile->_kineticEnergy == 255)) && (viewSquareIndex == k9_ViewSquare_D0C)) {
+ if ((doNotScaleWithKineticEnergy || (projectile->_kineticEnergy == 255)) && (viewSquareIndex == kDMViewSquareD0C)) {
scale = 0; /* Use native bitmap without resizing */
byteWidth = ((ProjectileAspect *)objectAspect)->_byteWidth;
heightRedEagle = ((ProjectileAspect *)objectAspect)->_height;
@@ -3540,8 +3569,9 @@ T0115129_DrawProjectiles:
projectileBitmapIndexDelta = 2;
if (projectileAspectTypeHasBackGraphicAndRotation) {
- flipHorizontal = (AL_2_viewCell == k0_ViewCellFronLeft) || (AL_2_viewCell == k3_ViewCellBackLeft);
- if (!(flipVertical = projectileFlipVertical))
+ flipHorizontal = (AL_2_viewCell == kDMViewCellFronLeft) || (AL_2_viewCell == kDMViewCellBackLeft);
+ flipVertical = projectileFlipVertical;
+ if (!flipVertical)
flipHorizontal = !flipHorizontal;
} else {
flipVertical = false;
@@ -3553,8 +3583,8 @@ T0115129_DrawProjectiles:
else
projectileBitmapIndexDelta = 1;
- flipVertical = projectileAspectTypeHasBackGraphicAndRotation && (AL_2_viewCell < k2_ViewCellBackRight);
- flipHorizontal = getFlag(((ProjectileAspect *)objectAspect)->_graphicInfo, k0x0010_ProjectileSideMask) && !((viewLane == kDMViewLaneRight) || ((viewLane == kDMViewLaneCenter) && ((AL_2_viewCell == k1_ViewCellFrontRight) || (AL_2_viewCell == k2_ViewCellBackRight))));
+ flipVertical = projectileAspectTypeHasBackGraphicAndRotation && (AL_2_viewCell < kDMViewCellBackRight);
+ flipHorizontal = getFlag(((ProjectileAspect *)objectAspect)->_graphicInfo, k0x0010_ProjectileSideMask) && !((viewLane == kDMViewLaneRight) || ((viewLane == kDMViewLaneCenter) && ((AL_2_viewCell == kDMViewCellFrontRight) || (AL_2_viewCell == kDMViewCellBackRight))));
}
AL_4_nativeBitmapIndex += projectileBitmapIndexDelta;
@@ -3565,7 +3595,8 @@ T0115129_DrawProjectiles:
if (flipHorizontal)
paddingPixelCount = (7 - ((byteWidth - 1) & 0x0007)) << 1;
- if (doNotScaleWithKineticEnergy && isDerivedBitmapInCache(derivedBitmapIndex = k282_DerivedBitmapFirstProjectile + ((ProjectileAspect *)objectAspect)->_firstDerivedBitmapRelativeIndex + (projectileBitmapIndexDelta * 6) + AL_8_projectileScaleIndex)) {
+ derivedBitmapIndex = kDMDerivedBitmapFirstProjectile + ((ProjectileAspect *)objectAspect)->_firstDerivedBitmapRelativeIndex + (projectileBitmapIndexDelta * 6) + AL_8_projectileScaleIndex;
+ if (doNotScaleWithKineticEnergy && isDerivedBitmapInCache(derivedBitmapIndex)) {
bitmapRedBanana = getDerivedBitmap(derivedBitmapIndex);
} else {
bitmapGreenAnt = getNativeBitmapOrGraphic(AL_4_nativeBitmapIndex);
@@ -3592,11 +3623,11 @@ T0115129_DrawProjectiles:
if (flipHorizontal)
flipBitmapHorizontal(bitmapRedBanana, AL_4_normalizdByteWidth, heightRedEagle);
}
- boxByteGreen._y2 = (heightRedEagle >> 1) + 47;
- boxByteGreen._y1 = 47 - (heightRedEagle >> 1) + !(heightRedEagle & 0x0001);
- boxByteGreen._x2 = MIN(223, projectilePosX + byteWidth);
- boxByteGreen._x1 = MAX(0, projectilePosX - byteWidth + 1);
- if (boxByteGreen._x1) {
+ boxByteGreen._rect.bottom = (heightRedEagle >> 1) + 47;
+ boxByteGreen._rect.top = 47 - (heightRedEagle >> 1) + !(heightRedEagle & 0x0001);
+ boxByteGreen._rect.right = MIN(223, projectilePosX + byteWidth);
+ boxByteGreen._rect.left = MAX(0, projectilePosX - byteWidth + 1);
+ if (boxByteGreen._rect.left) {
if (flipHorizontal)
AL_4_xPos = paddingPixelCount;
else
@@ -3604,7 +3635,7 @@ T0115129_DrawProjectiles:
} else
AL_4_xPos = MAX(paddingPixelCount, int16(byteWidth - projectilePosX - 1)); /* BUG0_06 Graphical glitch when drawing projectiles or explosions. If a projectile or explosion bitmap is cropped because it is only partly visible on the left side of the viewport (boxByteGreen.X1 = 0) and the bitmap is flipped horizontally (flipHorizontal = true) then a wrong part of the bitmap is drawn on screen. To fix this bug, "+ paddingPixelCount" must be added to the second parameter of this function call */
- blitToBitmap(bitmapRedBanana, _bitmapViewport, boxByteGreen, AL_4_xPos, 0, getNormalizedByteWidth(byteWidth), k112_byteWidthViewport, k10_ColorFlesh, heightRedEagle, k136_heightViewport);
+ blitToBitmap(bitmapRedBanana, _bitmapViewport, boxByteGreen, AL_4_xPos, 0, getNormalizedByteWidth(byteWidth), k112_byteWidthViewport, kDMColorFlesh, heightRedEagle, k136_heightViewport);
} else { /* Positive value: projectile aspect is the index of a OBJECT_ASPECT */
useAlcoveObjectImage = false;
byte projectileCoordinates[2];
@@ -3635,18 +3666,19 @@ T0115171_BackFromT0115015_DrawProjectileAsObject:;
if (thingParam.getType() == kDMThingTypeExplosion) {
AL_2_cellPurpleMan = thingParam.getCell();
Explosion *explosion = (Explosion *)_vm->_dungeonMan->getThingData(thingParam);
- bool rebirthExplosion = ((uint16)(AL_4_explosionType = explosion->getType()) >= kDMExplosionTypeRebirthStep1);
- if (rebirthExplosion && ((AL_1_viewSquareExplosionIndex < k3_ViewSquare_D3C_Explosion) || (AL_1_viewSquareExplosionIndex > k9_ViewSquare_D1C_Explosion) || (AL_2_cellPurpleMan != cellYellowBear))) /* If explosion is rebirth and is not visible */
+ AL_4_explosionType = explosion->getType();
+ bool rebirthExplosion = ((uint16)AL_4_explosionType >= kDMExplosionTypeRebirthStep1);
+ if (rebirthExplosion && ((AL_1_viewSquareExplosionIndex < kDMViewSquareD3CExplosion) || (AL_1_viewSquareExplosionIndex > kDMViewSquareD1CExplosion) || (AL_2_cellPurpleMan != cellYellowBear))) /* If explosion is rebirth and is not visible */
continue;
bool smoke = false;
if ((AL_4_explosionType == kDMExplosionTypeFireball) || (AL_4_explosionType == kDMExplosionTypeLightningBolt) || (AL_4_explosionType == kDMExplosionTypeRebirthStep2)) {
AL_4_explosionAspectIndex = kDMExplosionAspectFire;
} else {
if ((AL_4_explosionType == kDMExplosionTypePoisonBolt) || (AL_4_explosionType == kDMExplosionTypePoisonCloud)) {
- AL_4_explosionAspectIndex = k2_ExplosionAspectPoison;
+ AL_4_explosionAspectIndex = kDMExplosionAspectPoison;
} else if (AL_4_explosionType == kDMExplosionTypeSmoke) {
smoke = true;
- AL_4_explosionAspectIndex = k3_ExplosionAspectSmoke;
+ AL_4_explosionAspectIndex = kDMExplosionAspectSmoke;
} else {
if (AL_4_explosionType == kDMExplosionTypeRebirthStep1) {
objectAspect = (ObjectAspect *)&_projectileAspect[_vm->ordinalToIndex(-_vm->_dungeonMan->getProjectileAspect(Thing::_explLightningBolt))];
@@ -3654,21 +3686,21 @@ T0115171_BackFromT0115015_DrawProjectileAsObject:;
explosionCoordinates = rebirthStep1ExplosionCoordinates[AL_1_viewSquareExplosionIndex - 3];
byteWidth = getScaledDimension((((ProjectileAspect *)objectAspect)->_byteWidth), explosionCoordinates[2]);
heightRedEagle = getScaledDimension((((ProjectileAspect *)objectAspect)->_height), explosionCoordinates[2]);
- if (AL_1_viewSquareExplosionIndex != k9_ViewSquare_D1C_Explosion) {
+ if (AL_1_viewSquareExplosionIndex != kDMViewSquareD1CExplosion) {
blitToBitmapShrinkWithPalChange(bitmapRedBanana, _tmpBitmap, ((ProjectileAspect *)objectAspect)->_byteWidth << 1, ((ProjectileAspect *)objectAspect)->_height, byteWidth << 1, heightRedEagle, _palChangesNoChanges);
bitmapRedBanana = _tmpBitmap;
}
goto T0115200_DrawExplosion;
}
if (AL_4_explosionType == kDMExplosionTypeFluxcage) {
- if (AL_1_viewSquareExplosionIndex >= k4_ViewSquare_D3L_Explosion)
+ if (AL_1_viewSquareExplosionIndex >= kDMViewSquareD3LExplosion)
fluxcageExplosion = explosion;
continue;
}
AL_4_explosionAspectIndex = kDMExplosionAspectSpell;
}
}
- if (AL_1_viewSquareExplosionIndex == k12_ViewSquare_D0C_Explosion) {
+ if (AL_1_viewSquareExplosionIndex == kDMViewSquareD0CExplosion) {
if (smoke)
AL_4_explosionAspectIndex--; /* Smoke uses the same graphics as Poison Cloud, but with palette changes */
@@ -3679,14 +3711,14 @@ T0115171_BackFromT0115015_DrawProjectileAsObject:;
if (AL_2_explosionSize > 3)
AL_4_explosionAspectIndex++; /* Use third graphic in the pattern for large explosion attack */
}
- isDerivedBitmapInCache(k0_DerivedBitmapViewport);
+ isDerivedBitmapInCache(kDMDerivedBitmapViewport);
bitmapRedBanana = getNativeBitmapOrGraphic(AL_4_explosionAspectIndex + k351_FirstExplosionPatternGraphicIndice);
if (smoke) {
blitToBitmapShrinkWithPalChange(bitmapRedBanana, _tmpBitmap, 48, 32, 48, 32, _palChangeSmoke);
bitmapRedBanana = _tmpBitmap;
}
- blitBoxFilledWithMaskedBitmap(bitmapRedBanana, _bitmapViewport, 0, getDerivedBitmap(k0_DerivedBitmapViewport), boxExplosionPatternD0C, _vm->getRandomNumber(4) + 87, _vm->getRandomNumber(64), k112_byteWidthViewport, Color(k0x0080_BlitDoNotUseMask | k10_ColorFlesh), 0, 0, 136, 93);
- addDerivedBitmap(k0_DerivedBitmapViewport);
+ blitBoxFilledWithMaskedBitmap(bitmapRedBanana, _bitmapViewport, 0, getDerivedBitmap(kDMDerivedBitmapViewport), boxExplosionPatternD0C, _vm->getRandomNumber(4) + 87, _vm->getRandomNumber(64), k112_byteWidthViewport, Color(k0x0080_BlitDoNotUseMask | kDMColorFlesh), 0, 0, 136, 93);
+ addDerivedBitmap(kDMDerivedBitmapViewport);
warning("DISABLED CODE: f480_releaseBlock in drawObjectsCreaturesProjectilesExplosions");
//f480_releaseBlock(k0_DerivedBitmapViewport | 0x8000);
} else {
@@ -3699,9 +3731,9 @@ T0115171_BackFromT0115015_DrawProjectileAsObject:;
explosionCoordinates = centeredExplosionCoordinates[AL_1_viewSquareExplosionIndex];
} else {
if ((AL_2_cellPurpleMan == directionParam) || (AL_2_cellPurpleMan == _vm->turnDirLeft(directionParam)))
- AL_2_viewCell = k0_ViewCellFronLeft;
+ AL_2_viewCell = kDMViewCellFronLeft;
else
- AL_2_viewCell = k1_ViewCellFrontRight;
+ AL_2_viewCell = kDMViewCellFrontRight;
explosionCoordinates = explosionCoordinatesArray[AL_1_viewSquareExplosionIndex][AL_2_viewCell];
}
@@ -3715,19 +3747,19 @@ T0115200_DrawExplosion:
if (flipHorizontal)
paddingPixelCount = (7 - ((byteWidth - 1) & 0x0007)) << 1; /* Number of unused pixels in the units on the right of the bitmap */
- boxByteGreen._y2 = MIN(135, explosionCoordinates[1] + (heightRedEagle >> 1));
+ boxByteGreen._rect.bottom = MIN(135, explosionCoordinates[1] + (heightRedEagle >> 1));
AL_4_yPos = MAX(0, explosionCoordinates[1] - (heightRedEagle >> 1) + !(heightRedEagle & 0x0001));
if (AL_4_yPos >= 136)
continue;
- boxByteGreen._y1 = AL_4_yPos;
+ boxByteGreen._rect.top = AL_4_yPos;
AL_4_xPos = MIN(223, explosionCoordinates[0] + byteWidth);
if (AL_4_xPos < 0)
continue;
- boxByteGreen._x2 = AL_4_xPos;
+ boxByteGreen._rect.right = AL_4_xPos;
AL_4_xPos = explosionCoordinates[0];
- boxByteGreen._x1 = CLIP(0, AL_4_xPos - byteWidth + 1, 223);
+ boxByteGreen._rect.left = CLIP(0, AL_4_xPos - byteWidth + 1, 223);
- if (boxByteGreen._x1)
+ if (boxByteGreen._rect.left)
AL_4_xPos = paddingPixelCount;
else {
AL_4_xPos = MAX(paddingPixelCount, int16(byteWidth - AL_4_xPos - 1)); /* BUG0_07 Graphical glitch when drawing explosions. If an explosion bitmap is cropped because it is only partly visible on the left side of the viewport (boxByteGreen.X1 = 0) and the bitmap is not flipped horizontally (flipHorizontal = false) then the variable paddingPixelCount is not set before being used here. Its previous value (defined while drawing something else) is used and may cause an incorrect bitmap to be drawn */
@@ -3735,7 +3767,7 @@ T0115200_DrawExplosion:
/* BUG0_06 Graphical glitch when drawing projectiles or explosions. If a projectile or explosion bitmap is cropped because it is only partly visible on the left side of the viewport (boxByteGreen.X1 = 0) and the bitmap is flipped horizontally (flipHorizontal = true) then a wrong part of the bitmap is drawn on screen. To fix this bug, "+ paddingPixelCount" must be added to the second parameter of this function call */
}
- if (boxByteGreen._x2 <= boxByteGreen._x1)
+ if (boxByteGreen._rect.right <= boxByteGreen._rect.left)
continue;
byteWidth = getNormalizedByteWidth(byteWidth);
@@ -3750,7 +3782,7 @@ T0115200_DrawExplosion:
if (flipVertical)
flipBitmapVertical(bitmapRedBanana, byteWidth, heightRedEagle);
- blitToBitmap(bitmapRedBanana, _bitmapViewport, boxByteGreen, AL_4_xPos, 0, byteWidth, k112_byteWidthViewport, k10_ColorFlesh, heightRedEagle, k136_heightViewport);
+ blitToBitmap(bitmapRedBanana, _bitmapViewport, boxByteGreen, AL_4_xPos, 0, byteWidth, k112_byteWidthViewport, kDMColorFlesh, heightRedEagle, k136_heightViewport);
}
}
} while ((thingParam = _vm->_dungeonMan->getNextThing(thingParam))!= Thing::_endOfList);
@@ -3785,7 +3817,7 @@ bool DisplayMan::isDerivedBitmapInCache(int16 derivedBitmapIndex) {
return true;
}
-byte* DisplayMan::getDerivedBitmap(int16 derivedBitmapIndex) {
+byte *DisplayMan::getDerivedBitmap(int16 derivedBitmapIndex) {
return _derivedBitmaps[derivedBitmapIndex];
}
@@ -3810,7 +3842,7 @@ uint16 DisplayMan::getDarkenedColor(uint16 RGBcolor) {
return RGBcolor;
}
-void DisplayMan::startEndFadeToPalette(uint16* P0849_pui_Palette) {
+void DisplayMan::startEndFadeToPalette(uint16 *P0849_pui_Palette) {
uint16 *paletteRegister = _paletteFadeTemporary;
for (int16 i = 0; i < 16; i++)
@@ -3865,7 +3897,7 @@ void DisplayMan::startEndFadeToPalette(uint16* P0849_pui_Palette) {
}
}
-void DisplayMan::buildPaletteChangeCopperList(uint16* middleScreen, uint16* topAndBottom) {
+void DisplayMan::buildPaletteChangeCopperList(uint16 *middleScreen, uint16 *topAndBottom) {
_paletteFadeFrom = topAndBottom;
byte colorPalette[32 * 3];
for (int i = 0; i < 16; ++i) {
diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h
index 46b68fc3c2..9df6ad1c3a 100644
--- a/engines/dm/gfx.h
+++ b/engines/dm/gfx.h
@@ -50,12 +50,12 @@ enum ViewFloor {
};
enum DoorState {
- kDMDoorStateOpen = 0, // @ C0_DOOR_STATE_OPEN
- kDMDoorStateOneFourth = 1, // @ C1_DOOR_STATE_CLOSED_ONE_FOURTH
- kDMDoorStateHalf = 2, // @ k2_DoorStateAspect_CLOSED_HALF
+ kDMDoorStateOpen = 0, // @ C0_DOOR_STATE_OPEN
+ kDMDoorStateOneFourth = 1, // @ C1_DOOR_STATE_CLOSED_ONE_FOURTH
+ kDMDoorStateHalf = 2, // @ k2_DoorStateAspect_CLOSED_HALF
kDMDoorStateThreeFourth = 3, // @ C3_DOOR_STATE_CLOSED_THREE_FOURTH
- kDMDoorStateClosed = 4, // @ C4_DOOR_STATE_CLOSED
- kDMDoorStateDestroyed = 5 // @ C5_DOOR_STATE_DESTROYED
+ kDMDoorStateClosed = 4, // @ C4_DOOR_STATE_CLOSED
+ kDMDoorStateDestroyed = 5 // @ C5_DOOR_STATE_DESTROYED
};
enum DoorOrnament {
@@ -73,17 +73,17 @@ enum DoorButton {
/* View lanes */
enum ViewLane {
- kDMViewLaneCenter = 0, // @ C0_VIEW_LANE_CENTER
- kDMViewLaneLeft = 1, // @ C1_VIEW_LANE_LEFT
- kDMViewLaneRight = 2 // @ C2_VIEW_LANE_RIGHT
+ kDMViewLaneCenter = 0, // @ C0_VIEW_LANE_CENTER
+ kDMViewLaneLeft = 1, // @ C1_VIEW_LANE_LEFT
+ kDMViewLaneRight = 2 // @ C2_VIEW_LANE_RIGHT
};
/* Explosion aspects */
enum ExplosionAspectEnum {
- kDMExplosionAspectFire = 0, // @ C0_EXPLOSION_ASPECT_FIRE
- kDMExplosionAspectSpell = 1, // @ C1_EXPLOSION_ASPECT_SPELL
- k2_ExplosionAspectPoison = 2, // @ C2_EXPLOSION_ASPECT_POISON
- k3_ExplosionAspectSmoke = 3 // @ C3_EXPLOSION_ASPECT_SMOKE
+ kDMExplosionAspectFire = 0, // @ C0_EXPLOSION_ASPECT_FIRE
+ kDMExplosionAspectSpell = 1, // @ C1_EXPLOSION_ASPECT_SPELL
+ kDMExplosionAspectPoison = 2, // @ C2_EXPLOSION_ASPECT_POISON
+ kDMExplosionAspectSmoke = 3 // @ C3_EXPLOSION_ASPECT_SMOKE
};
enum WallSet {
@@ -95,24 +95,130 @@ enum FloorSet {
};
enum ViewWall {
- kDMViewWallD3LRight = 0, // @ C00_VIEW_WALL_D3L_RIGHT
- kDMViewWallD3RLeft = 1, // @ C01_VIEW_WALL_D3R_LEFT
- kDMViewWallD3LFront = 2, // @ C02_VIEW_WALL_D3L_FRONT
- kDMViewWallD3CFront = 3, // @ C03_VIEW_WALL_D3C_FRONT
- kDMViewWallD3RFront = 4, // @ C04_VIEW_WALL_D3R_FRONT
- kDMViewWallD2LRight = 5, // @ C05_VIEW_WALL_D2L_RIGHT
- kDMViewWallD2RLeft = 6, // @ C06_VIEW_WALL_D2R_LEFT
- kDMViewWallD2LFront = 7, // @ C07_VIEW_WALL_D2L_FRONT
- kDMViewWallD2CFront = 8, // @ C08_VIEW_WALL_D2C_FRONT
- kDMViewWallD2RFront = 9, // @ C09_VIEW_WALL_D2R_FRONT
+ kDMViewWallD3LRight = 0, // @ C00_VIEW_WALL_D3L_RIGHT
+ kDMViewWallD3RLeft = 1, // @ C01_VIEW_WALL_D3R_LEFT
+ kDMViewWallD3LFront = 2, // @ C02_VIEW_WALL_D3L_FRONT
+ kDMViewWallD3CFront = 3, // @ C03_VIEW_WALL_D3C_FRONT
+ kDMViewWallD3RFront = 4, // @ C04_VIEW_WALL_D3R_FRONT
+ kDMViewWallD2LRight = 5, // @ C05_VIEW_WALL_D2L_RIGHT
+ kDMViewWallD2RLeft = 6, // @ C06_VIEW_WALL_D2R_LEFT
+ kDMViewWallD2LFront = 7, // @ C07_VIEW_WALL_D2L_FRONT
+ kDMViewWallD2CFront = 8, // @ C08_VIEW_WALL_D2C_FRONT
+ kDMViewWallD2RFront = 9, // @ C09_VIEW_WALL_D2R_FRONT
kDMViewWallD1LRight = 10, // @ C10_VIEW_WALL_D1L_RIGHT
- kDMViewWallD1RLeft = 11, // @ C11_VIEW_WALL_D1R_LEFT
+ kDMViewWallD1RLeft = 11, // @ C11_VIEW_WALL_D1R_LEFT
kDMViewWallD1CFront = 12 // @ C12_VIEW_WALL_D1C_FRONT
};
-#define kDMMaskDoorInfoCreaturesCanSeeThrough 0x0001 // @ MASK0x0001_CREATURES_CAN_SEE_THROUGH
+enum CellOrder {
+ kDMCellOrderNone = 0xFFFF,
+ kDMCellOrderAlcove = 0x0000, // @ C0000_CELL_ORDER_ALCOVE
+ kDMCellOrderBackLeft = 0x0001, // @ C0001_CELL_ORDER_BACKLEFT
+ kDMCellOrderBackRight = 0x0002, // @ C0002_CELL_ORDER_BACKRIGHT
+ kDMCellOrderDoorPass1BackLeft = 0x0018, // @ C0018_CELL_ORDER_DOORPASS1_BACKLEFT
+ kDMCellOrderBackLeftBackRight = 0x0021, // @ C0021_CELL_ORDER_BACKLEFT_BACKRIGHT
+ kDMCellOrderDoorPass1BackRight = 0x0028, // @ C0028_CELL_ORDER_DOORPASS1_BACKRIGHT
+ kDMCellOrderBackRightFrontRight = 0x0032, // @ C0032_CELL_ORDER_BACKRIGHT_FRONTRIGHT
+ kDMCellOrderDoorPass2FrontRight = 0x0039, // @ C0039_CELL_ORDER_DOORPASS2_FRONTRIGHT
+ kDMCellOrderBackLeftFrontLeft = 0x0041, // @ C0041_CELL_ORDER_BACKLEFT_FRONTLEFT
+ kDMCellOrderDoorPass2FrontLeft = 0x0049, // @ C0049_CELL_ORDER_DOORPASS2_FRONTLEFT
+ kDMCellOrderDoorPass1BackRightBackLeft = 0x0128, // @ C0128_CELL_ORDER_DOORPASS1_BACKRIGHT_BACKLEFT
+ kDMCellOrderDoorPass1BackLeftBackRight = 0x0218, // @ C0218_CELL_ORDER_DOORPASS1_BACKLEFT_BACKRIGHT
+ kDMCellOrderBackLeftBackRightFrontRight = 0x0321, // @ C0321_CELL_ORDER_BACKLEFT_BACKRIGHT_FRONTRIGHT
+ kDMCellOrderBackRightFrontLeftFrontRight = 0x0342, // @ C0342_CELL_ORDER_BACKRIGHT_FRONTLEFT_FRONTRIGHT
+ kDMCellOrderDoorPass2FrontLeftFrontRight = 0x0349, // @ C0349_CELL_ORDER_DOORPASS2_FRONTLEFT_FRONTRIGHT
+ kDMCellOrderBackRightBackLeftFrontLeft = 0x0412, // @ C0412_CELL_ORDER_BACKRIGHT_BACKLEFT_FRONTLEFT
+ kDMCellOrderBackLeftFrontRightFrontLeft = 0x0431, // @ C0431_CELL_ORDER_BACKLEFT_FRONTRIGHT_FRONTLEFT
+ kDMCellOrderDoorPass2FrontRightFrontLeft = 0x0439, // @ C0439_CELL_ORDER_DOORPASS2_FRONTRIGHT_FRONTLEFT
+ kDMCellOrderBackLeftBackRightFrontLeftFrontRight = 0x3421, // @ C3421_CELL_ORDER_BACKLEFT_BACKRIGHT_FRONTLEFT_FRONTRIGHT
+ kDMCellOrderBackRightBackLeftFrontRightFrontLeft = 0x4312 // @ C4312_CELL_ORDER_BACKRIGHT_BACKLEFT_FRONTRIGHT_FRONTLEFT
+};
+
+enum DerivedBitmap {
+ kDMDerivedBitmapViewport = 0, // @ C000_DERIVED_BITMAP_VIEWPORT
+ kDMDerivedBitmapThievesEyeVisibleArea = 1, // @ C001_DERIVED_BITMAP_THIEVES_EYE_VISIBLE_AREA
+ kDMDerivedBitmapDamageToCreatureMedium = 2, // @ C002_DERIVED_BITMAP_DAMAGE_TO_CREATURE_MEDIUM
+ kDMDerivedBitmapDamageToCreatureSmall = 3, // @ C003_DERIVED_BITMAP_DAMAGE_TO_CREATURE_SMALL
+ kDMDerivedBitmapFirstWallOrnament = 4, // @ C004_DERIVED_BITMAP_FIRST_WALL_ORNAMENT
+ kDMDerivedBitmapFirstDoorOrnamentD3 = 68, // @ C068_DERIVED_BITMAP_FIRST_DOOR_ORNAMENT_D3
+ kDMDerivedBitmapFirstDoorOrnamentD2 = 69, // @ C069_DERIVED_BITMAP_FIRST_DOOR_ORNAMENT_D2
+ kDMDerivedBitmapFirstDoorButton = 102, // @ C102_DERIVED_BITMAP_FIRST_DOOR_BUTTON
+ kDMDerivedBitmapFirstObject = 104, // @ C104_DERIVED_BITMAP_FIRST_OBJECT
+ kDMDerivedBitmapFirstProjectile = 282, // @ C282_DERIVED_BITMAP_FIRST_PROJECTILE
+ kDMDerivedBitmapFirstExplosion = 438, // @ C438_DERIVED_BITMAP_FIRST_EXPLOSION
+ kDMDerivedBitmapFirstCreature = 495 // @ C495_DERIVED_BITMAP_FIRST_CREATURE
+};
+
+enum ViewSquare {
+ kDMViewSquareD4C = -3, // @ CM3_VIEW_SQUARE_D4C
+ kViewSquareD4L = -2, // @ CM2_VIEW_SQUARE_D4L
+ kDMViewSquareD4R = -1, // @ CM1_VIEW_SQUARE_D4R
+ kDMViewSquareD3C = 0, // @ C00_VIEW_SQUARE_D3C
+ kDMViewSquareD3L = 1, // @ C01_VIEW_SQUARE_D3L
+ kDMViewSquareD3R = 2, // @ C02_VIEW_SQUARE_D3R
+ kDMViewSquareD2C = 3, // @ C03_VIEW_SQUARE_D2C
+ kDMViewSquareD2L = 4, // @ C04_VIEW_SQUARE_D2L
+ kDMViewSquareD2R = 5, // @ C05_VIEW_SQUARE_D2R
+ kDMViewSquareD1C = 6, // @ C06_VIEW_SQUARE_D1C
+ kDMViewSquareD1L = 7, // @ C07_VIEW_SQUARE_D1L
+ kDMViewSquareD1R = 8, // @ C08_VIEW_SQUARE_D1R
+ kDMViewSquareD0C = 9, // @ C09_VIEW_SQUARE_D0C
+ kDMViewSquareD0L = 10, // @ C10_VIEW_SQUARE_D0L
+ kDMViewSquareD0R = 11, // @ C11_VIEW_SQUARE_D0R
+ kDMViewSquareD3CExplosion = 3, // @ C03_VIEW_SQUARE_D3C_EXPLOSION
+ kDMViewSquareD3LExplosion = 4, // @ C04_VIEW_SQUARE_D3L_EXPLOSION
+ kDMViewSquareD1CExplosion = 9, // @ C09_VIEW_SQUARE_D1C_EXPLOSION
+ kDMViewSquareD0CExplosion = 12 // @ C12_VIEW_SQUARE_D0C_EXPLOSION
+};
+
+enum ViewCell {
+ kDMViewCellFronLeft = 0, // @ C00_VIEW_CELL_FRONT_LEFT
+ kDMViewCellFrontRight = 1, // @ C01_VIEW_CELL_FRONT_RIGHT
+ kDMViewCellBackRight = 2, // @ C02_VIEW_CELL_BACK_RIGHT
+ kDMViewCellBackLeft = 3, // @ C03_VIEW_CELL_BACK_LEFT
+ kDMViewCellAlcove = 4, // @ C04_VIEW_CELL_ALCOVE
+ kDMViewCellDoorButtonOrWallOrn = 5 // @ C05_VIEW_CELL_DOOR_BUTTON_OR_WALL_ORNAMENT
+};
+
+enum Color {
+ kDMColorNoTransparency = -1,
+ kDMColorBlack = 0,
+ kDMColorDarkGary = 1,
+ kDMColorLightGray = 2,
+ kDMColorDarkBrown = 3,
+ kDMColorCyan = 4,
+ kDMColorLightBrown = 5,
+ kDMColorDarkGreen = 6,
+ kDMColorLightGreen = 7,
+ kDMColorRed = 8,
+ kDMColorGold = 9,
+ kDMColorFlesh = 10,
+ kDMColorYellow = 11,
+ kDMColorDarkestGray = 12,
+ kDMColorLightestGray = 13,
+ kDMColorBlue = 14,
+ kDMColorWhite = 15
+};
+
+#define kDMMaskDoorInfoCreaturesCanSeeThrough 0x0001 // @ MASK0x0001_CREATURES_CAN_SEE_THROUGH
#define kDMMaskDoorInfoProjectilesCanPassThrough 0x0002 // @ MASK0x0002_PROJECTILES_CAN_PASS_THROUGH
-#define kDMMaskDoorInfoAnimated 0x0004 // @ MASK0x0004_ANIMATED
+#define kDMMaskDoorInfoAnimated 0x0004 // @ MASK0x0004_ANIMATED
+#define kDMMaskDoorFront 0x0008 // @ MASK0x0008_DOOR_FRONT
+
+/* Field Aspect Mask */
+#define kMaskFieldAspectFlipMask 0x0080 // @ MASK0x0080_FLIP_MASK
+#define kMaskFieldAspectIndex 0x007F // @ MASK0x007F_MASK_INDEX
+#define kMaskFieldAspectNoMask 255 // @ C255_NO_MASK
+
+#define kDMCreatureMaskAdditional 0x0003 // @ MASK0x0003_ADDITIONAL
+#define kDMCreatureMaskFlipNonAttack 0x0004 // @ MASK0x0004_FLIP_NON_ATTACK
+#define kDMCreatureMaskSide 0x0008 // @ MASK0x0008_SIDE
+#define kDMCreatureMaskBack 0x0010 // @ MASK0x0010_BACK
+#define kDMCreatureMaskAttack 0x0020 // @ MASK0x0020_ATTACK
+#define kDMCreatureMaskSpecialD2Front 0x0080 // @ MASK0x0080_SPECIAL_D2_FRONT
+#define kDMCreatureMaskSpecialD2FrontIsFlipped 0x0100 // @ MASK0x0100_SPECIAL_D2_FRONT_IS_FLIPPED_FRONT
+#define kDMCreatureMaskFlipAttack 0x0200 // @ MASK0x0200_FLIP_ATTACK
+#define kDMCreatureMaskFlipDuringAttack 0x0400 // @ MASK0x0400_FLIP_DURING_ATTACK
#define k2_FloorSetGraphicCount 2 // @ C002_FLOOR_SET_GRAPHIC_COUNT
#define k13_WallSetGraphicCount 13 // @ C013_WALL_SET_GRAPHIC_COUNT
@@ -126,50 +232,17 @@ enum ViewWall {
#define k14_ProjectileAspectCount 14 // @ C014_PROJECTILE_ASPECT_COUNT
#define k85_ObjAspectCount 85 // @ C085_OBJECT_ASPECT_COUNT
-#define k0_HalfSizedViewCell_LeftColumn 0 // @ C00_VIEW_CELL_LEFT_COLUMN
-#define k1_HalfSizedViewCell_RightColumn 1 // @ C01_VIEW_CELL_RIGHT_COLUMN
-#define k2_HalfSizedViewCell_BackRow 2 // @ C02_VIEW_CELL_BACK_ROW
+#define k0_HalfSizedViewCell_LeftColumn 0 // @ C00_VIEW_CELL_LEFT_COLUMN
+#define k1_HalfSizedViewCell_RightColumn 1 // @ C01_VIEW_CELL_RIGHT_COLUMN
+#define k2_HalfSizedViewCell_BackRow 2 // @ C02_VIEW_CELL_BACK_ROW
#define k3_HalfSizedViewCell_CenterColumn 3 // @ C03_VIEW_CELL_CENTER_COLUMN
-#define k4_HalfSizedViewCell_FrontRow 4 // @ C04_VIEW_CELL_FRONT_ROW
+#define k4_HalfSizedViewCell_FrontRow 4 // @ C04_VIEW_CELL_FRONT_ROW
/* Shift sets */
#define k0_ShiftSet_D0BackD1Front 0 // @ C0_SHIFT_SET_D0_BACK_OR_D1_FRONT
#define k1_ShiftSet_D1BackD2Front 1 // @ C1_SHIFT_SET_D1_BACK_OR_D2_FRONT
#define k2_ShiftSet_D2BackD3Front 2 // @ C2_SHIFT_SET_D2_BACK_OR_D3_FRONT
-#define k0x0008_CellOrder_DoorFront 0x0008 // @ MASK0x0008_DOOR_FRONT
-#define k0x0000_CellOrder_Alcove 0x0000 // @ C0000_CELL_ORDER_ALCOVE
-#define k0x0001_CellOrder_BackLeft 0x0001 // @ C0001_CELL_ORDER_BACKLEFT
-#define k0x0002_CellOrder_BackRight 0x0002 // @ C0002_CELL_ORDER_BACKRIGHT
-#define k0x0018_CellOrder_DoorPass1_BackLeft 0x0018 // @ C0018_CELL_ORDER_DOORPASS1_BACKLEFT
-#define k0x0021_CellOrder_BackLeft_BackRight 0x0021 // @ C0021_CELL_ORDER_BACKLEFT_BACKRIGHT
-#define k0x0028_CellOrder_DoorPass1_BackRight 0x0028 // @ C0028_CELL_ORDER_DOORPASS1_BACKRIGHT
-#define k0x0032_CellOrder_BackRight_FrontRight 0x0032 // @ C0032_CELL_ORDER_BACKRIGHT_FRONTRIGHT
-#define k0x0039_CellOrder_DoorPass2_FrontRight 0x0039 // @ C0039_CELL_ORDER_DOORPASS2_FRONTRIGHT
-#define k0x0041_CellOrder_BackLeft_FrontLeft 0x0041 // @ C0041_CELL_ORDER_BACKLEFT_FRONTLEFT
-#define k0x0049_CellOrder_DoorPass2_FrontLeft 0x0049 // @ C0049_CELL_ORDER_DOORPASS2_FRONTLEFT
-#define k0x0128_CellOrder_DoorPass1_BackRight_BackLeft 0x0128 // @ C0128_CELL_ORDER_DOORPASS1_BACKRIGHT_BACKLEFT
-#define k0x0218_CellOrder_DoorPass1_BackLeft_BackRight 0x0218 // @ C0218_CELL_ORDER_DOORPASS1_BACKLEFT_BACKRIGHT
-#define k0x0321_CellOrder_BackLeft_BackRight_FrontRight 0x0321 // @ C0321_CELL_ORDER_BACKLEFT_BACKRIGHT_FRONTRIGHT
-#define k0x0342_CellOrder_BackRight_FrontLeft_FrontRight 0x0342 // @ C0342_CELL_ORDER_BACKRIGHT_FRONTLEFT_FRONTRIGHT
-#define k0x0349_CellOrder_DoorPass2_FrontLeft_FrontRight 0x0349 // @ C0349_CELL_ORDER_DOORPASS2_FRONTLEFT_FRONTRIGHT
-#define k0x0412_CellOrder_BackRight_BackLeft_FrontLeft 0x0412 // @ C0412_CELL_ORDER_BACKRIGHT_BACKLEFT_FRONTLEFT
-#define k0x0431_CellOrder_BackLeft_FrontRight_FrontLeft 0x0431 // @ C0431_CELL_ORDER_BACKLEFT_FRONTRIGHT_FRONTLEFT
-#define k0x0439_CellOrder_DoorPass2_FrontRight_FrontLeft 0x0439 // @ C0439_CELL_ORDER_DOORPASS2_FRONTRIGHT_FRONTLEFT
-#define k0x3421_CellOrder_BackLeft_BackRight_FrontLeft_FrontRight 0x3421 // @ C3421_CELL_ORDER_BACKLEFT_BACKRIGHT_FRONTLEFT_FRONTRIGHT
-#define k0x4312_CellOrder_BackRight_BackLeft_FrontRight_FrontLeft 0x4312 // @ C4312_CELL_ORDER_BACKRIGHT_BACKLEFT_FRONTRIGHT_FRONTLEFT
-
-/* Creature info GraphicInfo */
-#define k0x0003_CreatureInfoGraphicMaskAdditional 0x0003 // @ MASK0x0003_ADDITIONAL
-#define k0x0004_CreatureInfoGraphicMaskFlipNonAttack 0x0004 // @ MASK0x0004_FLIP_NON_ATTACK
-#define k0x0008_CreatureInfoGraphicMaskSide 0x0008 // @ MASK0x0008_SIDE
-#define k0x0010_CreatureInfoGraphicMaskBack 0x0010 // @ MASK0x0010_BACK
-#define k0x0020_CreatureInfoGraphicMaskAttack 0x0020 // @ MASK0x0020_ATTACK
-#define k0x0080_CreatureInfoGraphicMaskSpecialD2Front 0x0080 // @ MASK0x0080_SPECIAL_D2_FRONT
-#define k0x0100_CreatureInfoGraphicMaskSpecialD2FrontIsFlipped 0x0100 // @ MASK0x0100_SPECIAL_D2_FRONT_IS_FLIPPED_FRONT
-#define k0x0200_CreatureInfoGraphicMaskFlipAttack 0x0200 // @ MASK0x0200_FLIP_ATTACK
-#define k0x0400_CreatureInfoGraphicMaskFlipDuringAttack 0x0400 // @ MASK0x0400_FLIP_DURING_ATTACK
-
#define k75_FirstFloorSet 75 // @ C075_GRAPHIC_FIRST_FLOOR_SET
#define k77_FirstWallSet 77 // @ C077_GRAPHIC_FIRST_WALL_SET
#define k90_FirstStairs 90 // @ C090_GRAPHIC_FIRST_STAIRS
@@ -180,98 +253,34 @@ enum ViewWall {
#define k303_FirstDoorOrn 303 // @ C303_GRAPHIC_FIRST_DOOR_ORNAMENT
#define k730_DerivedBitmapMaximumCount 730 // @ C730_DERIVED_BITMAP_MAXIMUM_COUNT
-/* Field Aspect Mask */
-#define kMaskFieldAspectFlipMask 0x0080 // @ MASK0x0080_FLIP_MASK
-#define kMaskFieldAspectIndex 0x007F // @ MASK0x007F_MASK_INDEX
-#define kMaskFieldAspectNoMask 255 // @ C255_NO_MASK
-
-enum ViewSquare {
- kM3_ViewSquare_D4C = -3, // @ CM3_VIEW_SQUARE_D4C
- kM2_ViewSquare_D4L = -2, // @ CM2_VIEW_SQUARE_D4L
- kM1_ViewSquare_D4R = -1, // @ CM1_VIEW_SQUARE_D4R
- k0_ViewSquare_D3C = 0, // @ C00_VIEW_SQUARE_D3C
- k1_ViewSquare_D3L = 1, // @ C01_VIEW_SQUARE_D3L
- k2_ViewSquare_D3R = 2, // @ C02_VIEW_SQUARE_D3R
- k3_ViewSquare_D2C = 3, // @ C03_VIEW_SQUARE_D2C
- k4_ViewSquare_D2L = 4, // @ C04_VIEW_SQUARE_D2L
- k5_ViewSquare_D2R = 5, // @ C05_VIEW_SQUARE_D2R
- k6_ViewSquare_D1C = 6, // @ C06_VIEW_SQUARE_D1C
- k7_ViewSquare_D1L = 7, // @ C07_VIEW_SQUARE_D1L
- k8_ViewSquare_D1R = 8, // @ C08_VIEW_SQUARE_D1R
- k9_ViewSquare_D0C = 9, // @ C09_VIEW_SQUARE_D0C
- k10_ViewSquare_D0L = 10, // @ C10_VIEW_SQUARE_D0L
- k11_ViewSquare_D0R = 11, // @ C11_VIEW_SQUARE_D0R
- k3_ViewSquare_D3C_Explosion = 3, // @ C03_VIEW_SQUARE_D3C_EXPLOSION
- k4_ViewSquare_D3L_Explosion = 4, // @ C04_VIEW_SQUARE_D3L_EXPLOSION
- k9_ViewSquare_D1C_Explosion = 9, // @ C09_VIEW_SQUARE_D1C_EXPLOSION
- k12_ViewSquare_D0C_Explosion = 12 // @ C12_VIEW_SQUARE_D0C_EXPLOSION
-};
-
-class ExplosionAspect {
-public:
- uint16 _byteWidth;
- uint16 _height;
-
- ExplosionAspect(uint16 byteWidth, uint16 height) :_byteWidth(byteWidth), _height(height) {}
- ExplosionAspect() : _byteWidth(0), _height(0) {}
-}; // @ EXPLOSION_ASPECT
-
-extern ExplosionAspect g211_ExplosionAspects[k4_ExplosionAspectCount]; // @ G0211_as_Graphic558_ExplosionAspects
-
-extern byte g215_ProjectileScales[7]; // @ G0215_auc_Graphic558_ProjectileScales
-
-
-#define k0_DerivedBitmapViewport 0 // @ C000_DERIVED_BITMAP_VIEWPORT
-#define k1_DerivedBitmapThievesEyeVisibleArea 1 // @ C001_DERIVED_BITMAP_THIEVES_EYE_VISIBLE_AREA
-#define k2_DerivedBitmapDamageToCreatureMedium 2 // @ C002_DERIVED_BITMAP_DAMAGE_TO_CREATURE_MEDIUM
-#define k3_DerivedBitmapDamageToCreatureSmall 3 // @ C003_DERIVED_BITMAP_DAMAGE_TO_CREATURE_SMALL
-#define k4_DerivedBitmapFirstWallOrnament 4 // @ C004_DERIVED_BITMAP_FIRST_WALL_ORNAMENT
-#define k68_DerivedBitmapFirstDoorOrnament_D3 68 // @ C068_DERIVED_BITMAP_FIRST_DOOR_ORNAMENT_D3
-#define k69_DerivedBitmapFirstDoorOrnament_D2 69 // @ C069_DERIVED_BITMAP_FIRST_DOOR_ORNAMENT_D2
-#define k102_DerivedBitmapFirstDoorButton 102 // @ C102_DERIVED_BITMAP_FIRST_DOOR_BUTTON
-#define k104_DerivedBitmapFirstObject 104 // @ C104_DERIVED_BITMAP_FIRST_OBJECT
-#define k282_DerivedBitmapFirstProjectile 282 // @ C282_DERIVED_BITMAP_FIRST_PROJECTILE
-#define k438_DerivedBitmapFirstExplosion 438 // @ C438_DERIVED_BITMAP_FIRST_EXPLOSION
-#define k495_DerivedBitmapFirstCreature 495 // @ C495_DERIVED_BITMAP_FIRST_CREATURE
-
-
-#define k16_Scale_D3 16 // @ C16_SCALE_D3
-#define k20_Scale_D2 20 // @ C20_SCALE_D2
+#define k16_Scale_D3 16 // @ C16_SCALE_D3
+#define k20_Scale_D2 20 // @ C20_SCALE_D2
/* Object aspect GraphicInfo */
-#define k0x0001_ObjectFlipOnRightMask 0x0001 // @ MASK0x0001_FLIP_ON_RIGHT
-#define k0x0010_ObjectAlcoveMask 0x0010 // @ MASK0x0010_ALCOVE
+#define k0x0001_ObjectFlipOnRightMask 0x0001 // @ MASK0x0001_FLIP_ON_RIGHT
+#define k0x0010_ObjectAlcoveMask 0x0010 // @ MASK0x0010_ALCOVE
/* Projectile aspect GraphicInfo */
-#define k0x0010_ProjectileSideMask 0x0010 // @ MASK0x0010_SIDE
-#define k0x0100_ProjectileScaleWithKineticEnergyMask 0x0100 // @ MASK0x0100_SCALE_WITH_KINETIC_ENERGY
-#define k0x0003_ProjectileAspectTypeMask 0x0003 // @ MASK0x0003_ASPECT_TYPE
+#define k0x0010_ProjectileSideMask 0x0010 // @ MASK0x0010_SIDE
+#define k0x0100_ProjectileScaleWithKineticEnergyMask 0x0100 // @ MASK0x0100_SCALE_WITH_KINETIC_ENERGY
+#define k0x0003_ProjectileAspectTypeMask 0x0003 // @ MASK0x0003_ASPECT_TYPE
/* Projectile aspect type */
-#define k0_ProjectileAspectHasBackGraphicRotation 0 // @ C0_PROJECTILE_ASPECT_TYPE_HAS_BACK_GRAPHIC_AND_ROTATION
+#define k0_ProjectileAspectHasBackGraphicRotation 0 // @ C0_PROJECTILE_ASPECT_TYPE_HAS_BACK_GRAPHIC_AND_ROTATION
#define k1_ProjectileAspectBackGraphic 1 // @ C1_PROJECTILE_ASPECT_TYPE_HAS_BACK_GRAPHIC_AND_NO_ROTATION
-#define k2_ProjectileAspectHasRotation 2 // @ C2_PROJECTILE_ASPECT_TYPE_NO_BACK_GRAPHIC_AND_ROTATION
-#define k3_ProjectileAspectHasNone 3 // @ C3_PROJECTILE_ASPECT_TYPE_NO_BACK_GRAPHIC_AND_NO_ROTATION
+#define k2_ProjectileAspectHasRotation 2 // @ C2_PROJECTILE_ASPECT_TYPE_NO_BACK_GRAPHIC_AND_ROTATION
+#define k3_ProjectileAspectHasNone 3 // @ C3_PROJECTILE_ASPECT_TYPE_NO_BACK_GRAPHIC_AND_NO_ROTATION
/* Projectile aspects */
-#define k3_ProjectileAspectExplosionLightningBolt 3 // @ C03_PROJECTILE_ASPECT_EXPLOSION_LIGHTNING_BOLT
-#define k10_ProjectileAspectExplosionFireBall 10 // @ C10_PROJECTILE_ASPECT_EXPLOSION_FIREBALL
-#define k11_ProjectileAspectExplosionDefault 11 // @ C11_PROJECTILE_ASPECT_EXPLOSION_DEFAULT
-#define k12_ProjectileAspectExplosionSlime 12 // @ C12_PROJECTILE_ASPECT_EXPLOSION_SLIME
+#define k3_ProjectileAspectExplosionLightningBolt 3 // @ C03_PROJECTILE_ASPECT_EXPLOSION_LIGHTNING_BOLT
+#define k10_ProjectileAspectExplosionFireBall 10 // @ C10_PROJECTILE_ASPECT_EXPLOSION_FIREBALL
+#define k11_ProjectileAspectExplosionDefault 11 // @ C11_PROJECTILE_ASPECT_EXPLOSION_DEFAULT
+#define k12_ProjectileAspectExplosionSlime 12 // @ C12_PROJECTILE_ASPECT_EXPLOSION_SLIME
#define k13_ProjectileAspectExplosionPoisonBoltCloud 13 // @ C13_PROJECTILE_ASPECT_EXPLOSION_POISON_BOLT_POISON_CLOUD
#define k0x0080_BlitDoNotUseMask 0x0080 // @ MASK0x0080_DO_NOT_USE_MASK
#define kScaleThreshold 32768
-enum ViewCell {
- k0_ViewCellFronLeft = 0, // @ C00_VIEW_CELL_FRONT_LEFT
- k1_ViewCellFrontRight = 1, // @ C01_VIEW_CELL_FRONT_RIGHT
- k2_ViewCellBackRight = 2, // @ C02_VIEW_CELL_BACK_RIGHT
- k3_ViewCellBackLeft = 3, // @ C03_VIEW_CELL_BACK_LEFT
- k4_ViewCellAlcove = 4, // @ C04_VIEW_CELL_ALCOVE
- k5_ViewCellDoorButtonOrWallOrn = 5 // @ C05_VIEW_CELL_DOOR_BUTTON_OR_WALL_ORNAMENT
-};
-
enum GraphicIndice {
k0_dialogBoxGraphicIndice = 0, // @ C000_GRAPHIC_DIALOG_BOX
k1_titleGraphicsIndice = 1, // @ C001_GRAPHIC_TITLE
@@ -301,13 +310,13 @@ enum GraphicIndice {
k30_FoodLabelIndice = 30, // @ C030_GRAPHIC_FOOD_LABEL
k31_WaterLabelIndice = 31, // @ C031_GRAPHIC_WATER_LABEL
k32_PoisionedLabelIndice = 32, // @ C032_GRAPHIC_POISONED_LABEL
- k33_SlotBoxNormalIndice = 33, // @ C033_GRAPHIC_SLOT_BOX_NORMAL
- k34_SlotBoxWoundedIndice = 34, // @ C034_GRAPHIC_SLOT_BOX_WOUNDED
+ k33_SlotBoxNormalIndice = 33, // @ C033_GRAPHIC_SLOT_BOX_NORMAL
+ k34_SlotBoxWoundedIndice = 34, // @ C034_GRAPHIC_SLOT_BOX_WOUNDED
k35_SlotBoxActingHandIndice = 35, // @ C035_GRAPHIC_SLOT_BOX_ACTING_HAND
k37_BorderPartyShieldIndice = 37, // @ C037_GRAPHIC_BORDER_PARTY_SHIELD
k38_BorderPartyFireshieldIndice = 38, // @ C038_GRAPHIC_BORDER_PARTY_FIRESHIELD
k39_BorderPartySpellshieldIndice = 39, // @ C039_GRAPHIC_BORDER_PARTY_SPELLSHIELD
- k40_PanelResurectReincaranteIndice = 40, // @ C040_GRAPHIC_PANEL_RESURRECT_REINCARNATE
+ k40_PanelResurectReincaranteIndice = 40, // @ C040_GRAPHIC_PANEL_RESURRECT_REINCARNATE
k41_holeInWall_GraphicIndice = 41, // @ C041_GRAPHIC_HOLE_IN_WALL
k42_ObjectIcons_000_TO_031 = 42, // @ C042_GRAPHIC_OBJECT_ICONS_000_TO_031
k43_ObjectIcons_032_TO_063 = 43, // @ C043_GRAPHIC_OBJECT_ICONS_032_TO_063
@@ -343,37 +352,45 @@ enum GraphicIndice {
k241_FloorOrn_15_D3L_footprints = 241, // @ C241_GRAPHIC_FLOOR_ORNAMENT_15_D3L_FOOTPRINTS
k301_DoorMaskDestroyedIndice = 301, // @ C301_GRAPHIC_DOOR_MASK_DESTROYED
k315_firstDoorButton_GraphicIndice = 315, // @ C315_GRAPHIC_FIRST_DOOR_BUTTON
- k316_FirstProjectileGraphicIndice = 316, // @ C316_GRAPHIC_FIRST_PROJECTILE
+ k316_FirstProjectileGraphicIndice = 316, // @ C316_GRAPHIC_FIRST_PROJECTILE
k348_FirstExplosionGraphicIndice = 348, // @ C348_GRAPHIC_FIRST_EXPLOSION
- k351_FirstExplosionPatternGraphicIndice = 351, // @ C351_GRAPHIC_FIRST_EXPLOSION_PATTERN
+ k351_FirstExplosionPatternGraphicIndice = 351, // @ C351_GRAPHIC_FIRST_EXPLOSION_PATTERN
k360_FirstObjectGraphicIndice = 360, // @ C360_GRAPHIC_FIRST_OBJECT
k446_FirstCreatureGraphicIndice = 446, // @ C446_GRAPHIC_FIRST_CREATURE
- k557_FontGraphicIndice = 557 // @ C557_GRAPHIC_FONT
+ k557_FontGraphicIndice = 557 // @ C557_GRAPHIC_FONT
};
+class ExplosionAspect {
+public:
+ uint16 _byteWidth;
+ uint16 _height;
+
+ ExplosionAspect(uint16 byteWidth, uint16 height) :_byteWidth(byteWidth), _height(height) {}
+ ExplosionAspect() : _byteWidth(0), _height(0) {}
+}; // @ EXPLOSION_ASPECT
// in all cases, where a function takes a Box, it expects it to contain inclusive boundaries
class Box {
public:
- int16 _x1;
- int16 _x2;
- int16 _y1;
- int16 _y2;
+ Common::Rect _rect;
- Box(int16 x1, int16 x2, int16 y1, int16 y2) : _x1(x1), _x2(x2), _y1(y1), _y2(y2) {}
- Box() {}
- template <typename T>
- explicit Box(T *ptr) {
- _x1 = *ptr++;
- _x2 = *ptr++;
- _y1 = *ptr++;
- _y2 = *ptr++;
+ Box(int16 x1, int16 x2, int16 y1, int16 y2) {
+ // +1 because Rect.constains is not inclusive for right and bottom, at the opposite of the isPointInside
+ _rect = Common::Rect(x1, y1, x2, y2);
}
+
+ Box() {}
+
bool isPointInside(Common::Point point) {
- return (_x1 <= point.x) && (point.x <= _x2) && (_y1 <= point.y) && (point.y <= _y2); // <= because incluseive boundaries
+ // not using Common::Rect::contains() because we need both boundaries to be included
+ return (_rect.left <= point.x) && (point.x <= _rect.right) && (_rect.top <= point.y) && (point.y <= _rect.bottom);
}
- bool isPointInside(int16 x, int16 y) { return isPointInside(Common::Point(x, y)); }
- void setToZero() { _x1 = _x2 = _y1 = _y2 = 0; }
+
+ bool isPointInside(int16 x, int16 y) {
+ return isPointInside(Common::Point(x, y));
+ }
+
+ void setToZero() { _rect = Common::Rect(0, 0, 0, 0); }
}; // @ BOX_BYTE, BOX_WORD
extern Box g2_BoxMovementArrows; // @ G0002_s_Graphic562_Box_MovementArrows
@@ -391,26 +408,6 @@ public:
_srcByteWidth(srcWidth), _srcHeight(srcHeight), _srcX(srcX), _srcY(srcY) {}
};
-enum Color {
- kM1_ColorNoTransparency = -1,
- k0_ColorBlack = 0,
- k1_ColorDarkGary = 1,
- k2_ColorLightGray = 2,
- k3_ColorDarkBrown = 3,
- k4_ColorCyan = 4,
- k5_ColorLightBrown = 5,
- k6_ColorDarkGreen = 6,
- k7_ColorLightGreen = 7,
- k8_ColorRed = 8,
- k9_ColorGold = 9,
- k10_ColorFlesh = 10,
- k11_ColorYellow = 11,
- k12_ColorDarkestGray = 12,
- k13_ColorLightestGray = 13,
- k14_ColorBlue = 14,
- k15_ColorWhite = 15
-};
-
class FieldAspect {
public:
uint16 _nativeBitmapRelativeIndex;
@@ -485,7 +482,7 @@ public:
_firstNativeBitmapRelativeIndex(firstN), _firstDerivedBitmapRelativeIndex(firstD),
_byteWidth(byteWidth), _height(h), _graphicInfo(grap) {}
- ProjectileAspect() : _firstNativeBitmapRelativeIndex(0),
+ ProjectileAspect() : _firstNativeBitmapRelativeIndex(0),
_firstDerivedBitmapRelativeIndex(0), _byteWidth(0), _height(0), _graphicInfo(0) {}
}; // @ PROJECTIL_ASPECT
@@ -518,16 +515,16 @@ struct OrnamentInfo {
#define k15_DoorOrnDestroyedMask 15 // @ C15_DOOR_ORNAMENT_DESTROYED_MASK
#define k16_DoorOrnThivesEyeMask 16 // @ C16_DOOR_ORNAMENT_THIEVES_EYE_MASK
-#define k0_viewportNotDungeonView 0 // @ C0_VIEWPORT_NOT_DUNGEON_VIEW
-#define k1_viewportDungeonView 1 // @ C1_VIEWPORT_DUNGEON_VIEW
-#define k2_viewportAsBeforeSleepOrFreezeGame 2 // @ C2_VIEWPORT_AS_BEFORE_SLEEP_OR_FREEZE_GAME
+#define k0_viewportNotDungeonView 0 // @ C0_VIEWPORT_NOT_DUNGEON_VIEW
+#define k1_viewportDungeonView 1 // @ C1_VIEWPORT_DUNGEON_VIEW
+#define k2_viewportAsBeforeSleepOrFreezeGame 2 // @ C2_VIEWPORT_AS_BEFORE_SLEEP_OR_FREEZE_GAME
#define k112_byteWidthViewport 112 // @ C112_BYTE_WIDTH_VIEWPORT
-#define k136_heightViewport 136 // @ C136_HEIGHT_VIEWPORT
+#define k136_heightViewport 136 // @ C136_HEIGHT_VIEWPORT
#define k160_byteWidthScreen 160 // @ C160_BYTE_WIDTH_SCREEN
-#define k200_heightScreen 200 // @ C200_HEIGHT_SCREEN
+#define k200_heightScreen 200 // @ C200_HEIGHT_SCREEN
#define k8_byteWidth 8 // @ C008_BYTE_WIDTH
#define k16_byteWidth 16 // @ C016_BYTE_WIDTH
@@ -549,18 +546,7 @@ public:
Frame _rightHorizontal[3];
DoorFrames(Frame f1, Frame f2_1, Frame f2_2, Frame f2_3,
Frame f3_1, Frame f3_2, Frame f3_3,
- Frame f4_1, Frame f4_2, Frame f4_3) {
- _closedOrDestroyed = f1;
- _vertical[0] = f2_1;
- _vertical[1] = f2_2;
- _vertical[2] = f2_3;
- _leftHorizontal[0] = f3_1;
- _leftHorizontal[1] = f3_2;
- _leftHorizontal[2] = f3_3;
- _rightHorizontal[0] = f4_1;
- _rightHorizontal[1] = f4_2;
- _rightHorizontal[2] = f4_3;
- }
+ Frame f4_1, Frame f4_2, Frame f4_3);
}; // @ DOOR_FRAMES
#define D00_RGB_BLACK 0x0000
@@ -656,7 +642,7 @@ class DisplayMan {
public:
byte *_bitmapWallSetD1LCR; // @ G0700_puc_Bitmap_WallSet_Wall_D1LCR
private:
- Box _boxThievesEyeViewPortVisibleArea; // @ G0106_s_Graphic558_Box_ThievesEye_ViewportVisibleArea
+ Box _boxThievesEyeViewPortVisibleArea; // @ G0106_s_Graphic558_Box_ThievesEye_ViewportVisibleArea
byte _palChangesDoorButtonAndWallOrnD3[16]; // @ G0198_auc_Graphic558_PaletteChanges_DoorButtonAndWallOrnament_D3
byte _palChangesDoorButtonAndWallOrnD2[16]; // @ G0199_auc_Graphic558_PaletteChanges_DoorButtonAndWallOrnament_D2
@@ -717,7 +703,7 @@ public:
void loadIntoBitmap(uint16 index, byte *destBitmap); // @ F0466_EXPAND_GraphicToBitmap
void setUpScreens(uint16 width, uint16 height);
- void loadGraphics(); // @ F0479_MEMORY_ReadGraphicsDatHeader
+ void loadGraphics(); // @ F0479_MEMORY_ReadGraphicsDatHeader
void initializeGraphicData(); // @ F0460_START_InitializeGraphicData
void loadCurrentMapGraphics(); // @ F0096_DUNGEONVIEW_LoadCurrentMapGraphics_CPSDF
void allocateFlippedWallBitmaps(); // @ F0461_START_AllocateFlippedWallBitmaps
@@ -779,7 +765,7 @@ public:
int16 getScaledDimension(int16 dimension, int16 scale); // @ M78_SCALED_DIMENSION
void drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Direction directionParam,
int16 mapXpos, int16 mapYpos, int16 viewSquareIndex,
- uint16 orderedViewCellOrdinals); // @ F0115_DUNGEONVIEW_DrawObjectsCreaturesProjectilesExplosions_CPSEF
+ CellOrder orderedViewCellOrdinals); // @ F0115_DUNGEONVIEW_DrawObjectsCreaturesProjectilesExplosions_CPSEF
uint16 getNormalizedByteWidth(uint16 byteWidth); // @ M77_NORMALIZED_BYTE_WIDTH
uint16 getVerticalOffsetM23(uint16 val); // @ M23_VERTICAL_OFFSET
uint16 getHorizontalOffsetM22(uint16 val); // @ M22_HORIZONTAL_OFFSET
diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp
index a302647c42..1fa79fd67a 100644
--- a/engines/dm/group.cpp
+++ b/engines/dm/group.cpp
@@ -37,7 +37,8 @@
namespace DM {
-int32 M32_setTime(int32 &map_time, int32 time) {
+
+int32 GroupMan::setTime(int32 &map_time, int32 time) {
return map_time = (map_time & 0xFF000000) | time;
}
@@ -105,12 +106,12 @@ uint16 GroupMan::getGroupDirections(Group *group, int16 mapIndex) {
int16 GroupMan::getCreatureOrdinalInCell(Group *group, uint16 cell) {
uint16 currMapIndex = _vm->_dungeonMan->_currMapIndex;
byte groupCells = getGroupCells(group, currMapIndex);
- if (groupCells == k255_CreatureTypeSingleCenteredCreature)
+ if (groupCells == kDMCreatureTypeSingleCenteredCreature)
return _vm->indexToOrdinal(0);
int retval = 0;
byte creatureIndex = group->getCount();
- if (getFlag(_vm->_dungeonMan->_creatureInfos[group->_type]._attributes, k0x0003_MaskCreatureInfo_size) == k1_MaskCreatureSizeHalf) {
+ if (getFlag(_vm->_dungeonMan->_creatureInfos[group->_type]._attributes, kDMCreatureMaskSize) == kDMCreatureSizeHalf) {
if ((getGroupDirections(group, currMapIndex) & 1) == (cell & 1))
cell = _vm->turnDirLeft(cell);
@@ -139,13 +140,13 @@ uint16 GroupMan::getCreatureValue(uint16 groupVal, uint16 creatureIndex) {
void GroupMan::dropGroupPossessions(int16 mapX, int16 mapY, Thing groupThing, SoundMode soundMode) {
Group *group = (Group *)_vm->_dungeonMan->getThingData(groupThing);
- uint16 creatureType = group->_type;
- if ((soundMode != kDMSoundModeDoNotPlaySound) && getFlag(_vm->_dungeonMan->_creatureInfos[creatureType]._attributes, k0x0200_MaskCreatureInfo_dropFixedPoss)) {
+ CreatureType creatureType = group->_type;
+ if ((soundMode != kDMSoundModeDoNotPlaySound) && getFlag(_vm->_dungeonMan->_creatureInfos[creatureType]._attributes, kDMCreatureMaskDropFixedPoss)) {
int16 creatureIndex = group->getCount();
uint16 groupCells = getGroupCells(group, _vm->_dungeonMan->_currMapIndex);
do {
dropCreatureFixedPossessions(creatureType, mapX, mapY,
- (groupCells == k255_CreatureTypeSingleCenteredCreature) ? k255_CreatureTypeSingleCenteredCreature : getCreatureValue(groupCells, creatureIndex), soundMode);
+ (groupCells == kDMCreatureTypeSingleCenteredCreature) ? (uint16)kDMCreatureTypeSingleCenteredCreature : getCreatureValue(groupCells, creatureIndex), soundMode);
} while (creatureIndex--);
}
@@ -167,7 +168,7 @@ void GroupMan::dropGroupPossessions(int16 mapX, int16 mapY, Thing groupThing, So
}
}
-void GroupMan::dropCreatureFixedPossessions(uint16 creatureType, int16 mapX, int16 mapY, uint16 cell, SoundMode soundMode) {
+void GroupMan::dropCreatureFixedPossessions(CreatureType creatureType, int16 mapX, int16 mapY, uint16 cell, SoundMode soundMode) {
static uint16 fixedPossessionCreature12Skeleton[3] = { // @ G0245_aui_Graphic559_FixedPossessionsCreature12Skeleton
kDMObjectInfoIndexFirstWeapon + kDMWeaponFalchion,
kDMObjectInfoIndexFirstArmour + kDMArmourWoodenShield,
@@ -192,25 +193,25 @@ void GroupMan::dropCreatureFixedPossessions(uint16 creatureType, int16 mapX, int
};
static uint16 fixedPossessionCreature7rockRockPile[5] = { // @ G0249_aui_Graphic559_FixedPossessionsCreature07Rock_RockPile
kDMObjectInfoIndexFirstJunk + kDMJunkTypeBoulder,
- kDMObjectInfoIndexFirstJunk + kDMJunkTypeBoulder | kDMMaskRandomDrop,
- kDMObjectInfoIndexFirstWeapon + kDMWeaponRock | kDMMaskRandomDrop,
- kDMObjectInfoIndexFirstWeapon + kDMWeaponRock | kDMMaskRandomDrop,
+ (kDMObjectInfoIndexFirstJunk + kDMJunkTypeBoulder) | kDMMaskRandomDrop,
+ (kDMObjectInfoIndexFirstWeapon + kDMWeaponRock) | kDMMaskRandomDrop,
+ (kDMObjectInfoIndexFirstWeapon + kDMWeaponRock) | kDMMaskRandomDrop,
0
};
static uint16 fixedPossessionCreature4PainRatHellHound[3] = { // @ G0250_aui_Graphic559_FixedPossessionsCreature04PainRat_Hellhound
kDMObjectInfoIndexFirstJunk + kDMJunkTypeDrumstickShank,
- kDMObjectInfoIndexFirstJunk + kDMJunkTypeDrumstickShank | kDMMaskRandomDrop,
+ (kDMObjectInfoIndexFirstJunk + kDMJunkTypeDrumstickShank) | kDMMaskRandomDrop,
0
};
static uint16 fixedPossessionCreature6screamer[3] = { // @ G0251_aui_Graphic559_FixedPossessionsCreature06Screamer
kDMObjectInfoIndexFirstJunk + kDMJunkTypeScreamerSlice,
- kDMObjectInfoIndexFirstJunk + kDMJunkTypeScreamerSlice | kDMMaskRandomDrop,
+ (kDMObjectInfoIndexFirstJunk + kDMJunkTypeScreamerSlice) | kDMMaskRandomDrop,
0
};
static uint16 fixedPossessionCreature15MagnetaWormWorm[4] = { // @ G0252_aui_Graphic559_FixedPossessionsCreature15MagentaWorm_Worm
kDMObjectInfoIndexFirstJunk + kDMJunkTypeWormRound,
- kDMObjectInfoIndexFirstJunk + kDMJunkTypeWormRound | kDMMaskRandomDrop,
- kDMObjectInfoIndexFirstJunk + kDMJunkTypeWormRound | kDMMaskRandomDrop,
+ (kDMObjectInfoIndexFirstJunk + kDMJunkTypeWormRound) | kDMMaskRandomDrop,
+ (kDMObjectInfoIndexFirstJunk + kDMJunkTypeWormRound) | kDMMaskRandomDrop,
0
};
static uint16 fixedPossessionCreature24RedDragon[11] = { // @ G0253_aui_Graphic559_FixedPossessionsCreature24RedDragon
@@ -222,38 +223,40 @@ void GroupMan::dropCreatureFixedPossessions(uint16 creatureType, int16 mapX, int
kDMObjectInfoIndexFirstJunk + kDMJunkTypeDragonSteak,
kDMObjectInfoIndexFirstJunk + kDMJunkTypeDragonSteak,
kDMObjectInfoIndexFirstJunk + kDMJunkTypeDragonSteak,
- kDMObjectInfoIndexFirstJunk + kDMJunkTypeDragonSteak | kDMMaskRandomDrop,
- kDMObjectInfoIndexFirstJunk + kDMJunkTypeDragonSteak | kDMMaskRandomDrop, 0};
+ (kDMObjectInfoIndexFirstJunk + kDMJunkTypeDragonSteak) | kDMMaskRandomDrop,
+ (kDMObjectInfoIndexFirstJunk + kDMJunkTypeDragonSteak) | kDMMaskRandomDrop,
+ 0
+ };
uint16 *fixedPossessions;
bool cursedPossessions = false;
switch (creatureType) {
- case k4_CreatureTypePainRatHellHound:
+ case kDMCreatureTypePainRat:
fixedPossessions = fixedPossessionCreature4PainRatHellHound;
break;
- case k6_CreatureTypeScreamer:
+ case kDMCreatureTypeScreamer:
fixedPossessions = fixedPossessionCreature6screamer;
break;
- case k7_CreatureTypeRockpile:
+ case kDMCreatureTypeRockpile:
fixedPossessions = fixedPossessionCreature7rockRockPile;
break;
- case k9_CreatureTypeStoneGolem:
+ case kDMCreatureTypeStoneGolem:
fixedPossessions = fixedPossessionCreature9StoneGolem;
break;
- case k12_CreatureTypeSkeleton:
+ case kDMCreatureTypeSkeleton:
fixedPossessions = fixedPossessionCreature12Skeleton;
break;
- case k16_CreatureTypeTrolinAntman:
+ case kDMCreatureTypeAntman:
fixedPossessions = fixedPossessionCreatur16TrolinAntman;
break;
- case k15_CreatureTypeMagnetaWormWorm:
+ case kDMCreatureTypeMagentaWorm:
fixedPossessions = fixedPossessionCreature15MagnetaWormWorm;
break;
- case k18_CreatureTypeAnimatedArmourDethKnight:
+ case kDMCreatureTypeAnimatedArmour:
cursedPossessions = true;
fixedPossessions = fixedPossessionCreature18AnimatedArmourDethKnight;
break;
- case k24_CreatureTypeRedDragon:
+ case kDMCreatureTypeRedDragon:
fixedPossessions = fixedPossessionCreature24RedDragon;
break;
default:
@@ -287,7 +290,7 @@ void GroupMan::dropCreatureFixedPossessions(uint16 creatureType, int16 mapX, int
/* The same pointer type is used no matter the actual type k5_WeaponThingType, k6_ArmourThingType or k10_JunkThingType */
currWeapon->setType(currFixedPossession);
currWeapon->setCursed(cursedPossessions);
- nextUnusedThing = _vm->thingWithNewCell(nextUnusedThing, ((cell == k255_CreatureTypeSingleCenteredCreature) || !_vm->getRandomNumber(4)) ? _vm->getRandomNumber(4) : cell);
+ nextUnusedThing = _vm->thingWithNewCell(nextUnusedThing, ((cell == kDMCreatureTypeSingleCenteredCreature) || !_vm->getRandomNumber(4)) ? _vm->getRandomNumber(4) : cell);
_vm->_moveSens->getMoveResult(nextUnusedThing, kDMMapXNotOnASquare, 0, mapX, mapY);
currFixedPossession = *fixedPossessions++;
}
@@ -384,14 +387,14 @@ Thing GroupMan::groupGetThing(int16 mapX, int16 mapY) {
}
int16 GroupMan::groupGetDamageCreatureOutcome(Group *group, uint16 creatureIndex, int16 mapX, int16 mapY, int16 damage, bool notMoving) {
- uint16 creatureType = group->_type;
+ CreatureType creatureType = group->_type;
CreatureInfo *creatureInfo = &_vm->_dungeonMan->_creatureInfos[creatureType];
- if (getFlag(creatureInfo->_attributes, k0x2000_MaskCreatureInfo_archenemy)) /* Lord Chaos cannot be damaged */
+ if (getFlag(creatureInfo->_attributes, kDMCreatureMaskArchenemy)) /* Lord Chaos cannot be damaged */
return k0_outcomeKilledNoCreaturesInGroup;
if (group->_health[creatureIndex] <= damage) {
uint16 groupCells = getGroupCells(group, _vm->_dungeonMan->_currMapIndex);
- uint16 cell = (groupCells == k255_CreatureTypeSingleCenteredCreature) ? k255_CreatureTypeSingleCenteredCreature : getCreatureValue(groupCells, creatureIndex);
+ uint16 cell = (groupCells == kDMCreatureTypeSingleCenteredCreature) ? (uint16)kDMCreatureTypeSingleCenteredCreature : getCreatureValue(groupCells, creatureIndex);
uint16 creatureCount = group->getCount();
uint16 retVal;
@@ -403,7 +406,7 @@ int16 GroupMan::groupGetDamageCreatureOutcome(Group *group, uint16 creatureIndex
retVal = k2_outcomeKilledAllCreaturesInGroup;
} else { /* If there are several creatures in the group */
uint16 groupDirections = getGroupDirections(group, _vm->_dungeonMan->_currMapIndex);
- if (getFlag(creatureInfo->_attributes, k0x0200_MaskCreatureInfo_dropFixedPoss)) {
+ if (getFlag(creatureInfo->_attributes, kDMCreatureMaskDropFixedPoss)) {
if (notMoving)
dropCreatureFixedPossessions(creatureType, mapX, mapY, cell, kDMSoundModePlayOneTickLater);
else
@@ -414,7 +417,7 @@ int16 GroupMan::groupGetDamageCreatureOutcome(Group *group, uint16 creatureIndex
if (currentMapIsPartyMap)
activeGroup = &_activeGroups[group->getActiveGroupIndex()];
- if (group->getBehaviour() == k6_behavior_ATTACK) {
+ if (group->getBehaviour() == kDMBehaviorAttack) {
TimelineEvent *curEvent = _vm->_timeline->_events;
for (uint16 eventIndex = 0; eventIndex < _vm->_timeline->_eventMaxCount; eventIndex++) {
uint16 curEventType = curEvent->_type;
@@ -440,11 +443,11 @@ int16 GroupMan::groupGetDamageCreatureOutcome(Group *group, uint16 creatureIndex
}
uint16 fearResistance = creatureInfo->getFearResistance();
- if (currentMapIsPartyMap && (fearResistance) != k15_immuneToFear) {
+ if (currentMapIsPartyMap && (fearResistance != kDMImmuneToFear)) {
fearResistance += creatureCount - 1;
if (fearResistance < _vm->getRandomNumber(16)) { /* Test if the death of a creature frightens the remaining creatures in the group */
activeGroup->_delayFleeingFromTarget = _vm->getRandomNumber(100 - (fearResistance << 2)) + 20;
- group->setBehaviour(k5_behavior_FLEE);
+ group->setBehaviour(kDMBehaviorFlee);
}
}
}
@@ -464,11 +467,11 @@ int16 GroupMan::groupGetDamageCreatureOutcome(Group *group, uint16 creatureIndex
retVal = k1_outcomeKilledSomeCreaturesInGroup;
}
- uint16 creatureSize = getFlag(creatureInfo->_attributes, k0x0003_MaskCreatureInfo_size);
+ CreatureSize creatureSize = (CreatureSize)getFlag(creatureInfo->_attributes, kDMCreatureMaskSize);
uint16 attack;
- if (creatureSize == k0_MaskCreatureSizeQuarter)
+ if (creatureSize == kDMCreatureSizeQuarter)
attack = 110;
- else if (creatureSize == k1_MaskCreatureSizeHalf)
+ else if (creatureSize == kDMCreatureSizeHalf)
attack = 190;
else
attack = 255;
@@ -544,8 +547,8 @@ int16 GroupMan::getDamageAllCreaturesOutcome(Group *group, int16 mapX, int16 map
return k0_outcomeKilledNoCreaturesInGroup;
}
-int16 GroupMan::groupGetResistanceAdjustedPoisonAttack(uint16 creatreType, int16 poisonAttack) {
- int16 poisonResistance = _vm->_dungeonMan->_creatureInfos[creatreType].getPoisonResistance();
+int16 GroupMan::groupGetResistanceAdjustedPoisonAttack(CreatureType creatureType, int16 poisonAttack) {
+ int16 poisonResistance = _vm->_dungeonMan->_creatureInfos[creatureType].getPoisonResistance();
if (!poisonAttack || (poisonResistance == kDMImmuneToPoison))
return 0;
@@ -593,7 +596,7 @@ void GroupMan::processEvents29to41(int16 eventMapX, int16 eventMapY, int16 event
/* Update the event */
TimelineEvent nextEvent;
_vm->setMapAndTime(nextEvent._mapTime, _vm->_dungeonMan->_currMapIndex, _vm->_gameTime);
- nextEvent._priority = 255 - creatureInfo._movementTicks; /* The fastest creatures (with small MovementTicks value) get higher event priority */
+ nextEvent._priority = kDMMovementTicksImmobile - creatureInfo._movementTicks; /* The fastest creatures (with small MovementTicks value) get higher event priority */
nextEvent._Bu._location._mapX = eventMapX;
nextEvent._Bu._location._mapY = eventMapY;
/* If the creature is not on the party map then try and move the creature in a random direction and place a new event 37 in the timeline for the next creature movement */
@@ -617,7 +620,7 @@ T0209005_AddEventAndReturn:
return;
}
/* If the creature is Lord Chaos then ignore the event if the game is won. Initialize data to analyze Fluxcages */
- bool isArchEnemy = getFlag(creatureInfo._attributes, k0x2000_MaskCreatureInfo_archenemy);
+ bool isArchEnemy = getFlag(creatureInfo._attributes, kDMCreatureMaskArchenemy);
if (isArchEnemy) {
if (_vm->_gameWon)
return;
@@ -633,7 +636,7 @@ T0209005_AddEventAndReturn:
ticksSinceLastMove += 256;
int16 movementTicks = creatureInfo._movementTicks;
- if (movementTicks == k255_immobile)
+ if (movementTicks == kDMMovementTicksImmobile)
movementTicks = 100;
if (_vm->_championMan->_party._freezeLifeTicks && !isArchEnemy) { /* If life is frozen and the creature is not Lord Chaos (Lord Chaos is immune to Freeze Life) then reschedule the event later (except for reactions which are ignored when life if frozen) */
@@ -660,7 +663,7 @@ T0209005_AddEventAndReturn:
}
AL0447_i_Behavior = curGroup->getBehaviour();
uint16 creatureCount = curGroup->getCount();
- int16 creatureSize = getFlag(creatureInfo._attributes, k0x0003_MaskCreatureInfo_size);
+ int16 creatureSize = getFlag(creatureInfo._attributes, kDMCreatureMaskSize);
AL0450_i_DistanceXToParty = ABS(eventMapX - _vm->_dungeonMan->_partyMapX);
AL0451_i_DistanceYToParty = ABS(eventMapY - _vm->_dungeonMan->_partyMapY);
_currentGroupMapX = eventMapX;
@@ -680,7 +683,7 @@ T0209005_AddEventAndReturn:
if (eventType <= k31_TMEventTypeGroupReactionPartyIsAdjecent) { /* Process Reaction events 29 to 31 */
switch (eventType = eventType - k32_TMEventTypeUpdateAspectGroup) {
case kM1_TMEventTypeCreateReactionEvent31ParyIsAdjacent: /* This event is used when the party bumps into a group or attacks a group physically (not with a spell). It causes the creature behavior to change to attack if it is not already attacking the party or fleeing from target */
- if ((AL0447_i_Behavior != k6_behavior_ATTACK) && (AL0447_i_Behavior != k5_behavior_FLEE)) {
+ if ((AL0447_i_Behavior != kDMBehaviorAttack) && (AL0447_i_Behavior != kDMBehaviorFlee)) {
groupDeleteEvents(eventMapX, eventMapY);
goto T0209044_SetBehavior6_Attack;
}
@@ -688,11 +691,11 @@ T0209005_AddEventAndReturn:
activeGroup->_targetMapY = _vm->_dungeonMan->_partyMapY;
return;
case kM2_TMEventTypeCreateReactionEvent30HitByProjectile: /* This event is used for the reaction of a group after a projectile impacted with one creature in the group (some creatures may have been killed) */
- if ((AL0447_i_Behavior == k6_behavior_ATTACK) || (AL0447_i_Behavior == k5_behavior_FLEE)) /* If the creature is attacking the party or fleeing from the target then there is no reaction */
+ if ((AL0447_i_Behavior == kDMBehaviorAttack) || (AL0447_i_Behavior == kDMBehaviorFlee)) /* If the creature is attacking the party or fleeing from the target then there is no reaction */
return;
- AL0446_i_Behavior2Or3 = ((AL0447_i_Behavior == k3_behavior_USELESS) || (AL0447_i_Behavior == k2_behavior_USELESS));
+ AL0446_i_Behavior2Or3 = ((AL0447_i_Behavior == kDMBehaviorUnknown3) || (AL0447_i_Behavior == kDMBehaviorUnknown2));
if (AL0446_i_Behavior2Or3 || (_vm->getRandomNumber(4))) { /* BUG0_00 Useless code. Behavior cannot be 2 nor 3 because these values are never used. The actual condition is thus: if 3/4 chances */
- if (!groupGetDistanceToVisibleParty(curGroup, kM1_wholeCreatureGroup, eventMapX, eventMapY)) { /* If the group cannot see the party then look in a random direction to try and search for the party */
+ if (!groupGetDistanceToVisibleParty(curGroup, kDMWholeCreatureGroup, eventMapX, eventMapY)) { /* If the group cannot see the party then look in a random direction to try and search for the party */
approachAfterReaction = newGroupDirectionFound = false;
goto T0209073_SetDirectionGroup;
}
@@ -700,26 +703,26 @@ T0209005_AddEventAndReturn:
return;
} /* No 'break': proceed to instruction after the next 'case' below. Reaction is to move in a random direction to try and avoid other projectiles */
case kM3_TMEventTypeCreateReactionEvent29DangerOnSquare: /* This event is used when some creatures in the group were killed by a Poison Cloud or by a closing door or if Lord Chaos is surrounded by 3 Fluxcages. It causes the creature to move in a random direction to avoid the danger */
- approachAfterReaction = (AL0447_i_Behavior == k6_behavior_ATTACK); /* If the creature behavior is 'Attack' and it has to move to avoid danger then it will change its behavior to 'Approach' after the movement */
+ approachAfterReaction = (AL0447_i_Behavior == kDMBehaviorAttack); /* If the creature behavior is 'Attack' and it has to move to avoid danger then it will change its behavior to 'Approach' after the movement */
newGroupDirectionFound = false;
goto T0209058_MoveInRandomDirection;
}
}
if (eventType < k37_TMEventTypeUpdateBehaviourGroup) { /* Process Update Aspect events 32 to 36 */
nextEvent._type = eventType + 5;
- if (groupGetDistanceToVisibleParty(curGroup, kM1_wholeCreatureGroup, eventMapX, eventMapY)) {
- if ((AL0447_i_Behavior != k6_behavior_ATTACK) && (AL0447_i_Behavior != k5_behavior_FLEE)) {
+ if (groupGetDistanceToVisibleParty(curGroup, kDMWholeCreatureGroup, eventMapX, eventMapY)) {
+ if ((AL0447_i_Behavior != kDMBehaviorAttack) && (AL0447_i_Behavior != kDMBehaviorFlee)) {
if (_vm->getDistance(_vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, eventMapX, eventMapY) <= 1)
goto T0209044_SetBehavior6_Attack;
- if (((AL0447_i_Behavior == k0_behavior_WANDER) || (AL0447_i_Behavior == k3_behavior_USELESS)) && (AL0447_i_Behavior != k7_behavior_APPROACH)) /* BUG0_00 Useless code. Behavior cannot be 3 because this value is never used. Moreover, the second condition in the && is redundant (if the value is 0 or 3, it cannot be 7). The actual condition is: if (AL0447_i_Behavior == k0_behavior_WANDER) */
+ if (((AL0447_i_Behavior == kDMBehaviorWander) || (AL0447_i_Behavior == kDMBehaviorUnknown3)) && (AL0447_i_Behavior != kDMBehaviorApproach)) /* BUG0_00 Useless code. Behavior cannot be 3 because this value is never used. Moreover, the second condition in the && is redundant (if the value is 0 or 3, it cannot be 7). The actual condition is: if (AL0447_i_Behavior == k0_behavior_WANDER) */
goto T0209054_SetBehavior7_Approach;
}
activeGroup->_targetMapX = _vm->_dungeonMan->_partyMapX;
activeGroup->_targetMapY = _vm->_dungeonMan->_partyMapY;
}
- if (AL0447_i_Behavior == k6_behavior_ATTACK) {
+ if (AL0447_i_Behavior == kDMBehaviorAttack) {
AL0446_i_CreatureAspectIndex = eventType - k33_TMEventTypeUpdateAspectCreature_0; /* Value -1 for event 32, meaning aspect will be updated for all creatures in the group */
- nextAspectUpdateTime = getCreatureAspectUpdateTime(activeGroup, AL0446_i_CreatureAspectIndex, getFlag(activeGroup->_aspect[AL0446_i_CreatureAspectIndex], k0x0080_MaskActiveGroupIsAttacking));
+ nextAspectUpdateTime = getCreatureAspectUpdateTime(activeGroup, AL0446_i_CreatureAspectIndex, getFlag(activeGroup->_aspect[AL0446_i_CreatureAspectIndex], kDMAspectMaskActiveGroupIsAttacking));
goto T0209136;
}
if ((AL0450_i_DistanceXToParty > 3) || (AL0451_i_DistanceYToParty > 3)) {
@@ -734,8 +737,8 @@ T0209005_AddEventAndReturn:
if (eventType == k37_TMEventTypeUpdateBehaviourGroup) { /* Process event 37, Update Group Behavior */
bool allowMovementOverFakePitsAndFakeWalls;
- if ((AL0447_i_Behavior == k0_behavior_WANDER) || (AL0447_i_Behavior == k2_behavior_USELESS) || (AL0447_i_Behavior == k3_behavior_USELESS)) { /* BUG0_00 Useless code. Behavior cannot be 2 nor 3 because these values are never used. The actual condition is: if (AL0447_i_Behavior == k0_behavior_WANDER) */
- distanceToVisibleParty = groupGetDistanceToVisibleParty(curGroup, kM1_wholeCreatureGroup, eventMapX, eventMapY);
+ if ((AL0447_i_Behavior == kDMBehaviorWander) || (AL0447_i_Behavior == kDMBehaviorUnknown2) || (AL0447_i_Behavior == kDMBehaviorUnknown3)) { /* BUG0_00 Useless code. Behavior cannot be 2 nor 3 because these values are never used. The actual condition is: if (AL0447_i_Behavior == k0_behavior_WANDER) */
+ distanceToVisibleParty = groupGetDistanceToVisibleParty(curGroup, kDMWholeCreatureGroup, eventMapX, eventMapY);
if (distanceToVisibleParty) {
if ((distanceToVisibleParty <= (creatureInfo.getAttackRange())) && ((!AL0450_i_DistanceXToParty) || (!AL0451_i_DistanceYToParty))) { /* If the creature is in range for attack and on the same row or column as the party on the map */
T0209044_SetBehavior6_Attack:
@@ -744,15 +747,15 @@ T0209044_SetBehavior6_Attack:
}
activeGroup->_targetMapX = _vm->_dungeonMan->_partyMapX;
activeGroup->_targetMapY = _vm->_dungeonMan->_partyMapY;
- curGroup->setBehaviour(k6_behavior_ATTACK);
+ curGroup->setBehaviour(kDMBehaviorAttack);
AL0446_i_Direction = _currGroupPrimaryDirToParty;
for (AL0447_i_CreatureIndex = creatureCount; AL0447_i_CreatureIndex >= 0; AL0447_i_CreatureIndex--) {
if ((getCreatureValue(activeGroup->_directions, AL0447_i_CreatureIndex) != AL0446_i_Direction) &&
((!AL0447_i_CreatureIndex) || (!_vm->getRandomNumber(2)))) {
- setGroupDirection(activeGroup, AL0446_i_Direction, AL0447_i_CreatureIndex, creatureCount && (creatureSize == k1_MaskCreatureSizeHalf));
- M32_setTime(nextEvent._mapTime, _vm->_gameTime + _vm->getRandomNumber(4) + 2); /* Random delay represents the time for the creature to turn */
+ setGroupDirection(activeGroup, AL0446_i_Direction, AL0447_i_CreatureIndex, creatureCount && (creatureSize == kDMCreatureSizeHalf));
+ setTime(nextEvent._mapTime, _vm->_gameTime + _vm->getRandomNumber(4) + 2); /* Random delay represents the time for the creature to turn */
} else {
- M32_setTime(nextEvent._mapTime, _vm->_gameTime + 1);
+ setTime(nextEvent._mapTime, _vm->_gameTime + 1);
}
if (notUpdateBehaviorFl) {
nextEvent._mapTime += MIN((uint16)((creatureInfo._attackTicks >> 1) + _vm->getRandomNumber(4)), ticks);
@@ -762,16 +765,16 @@ T0209044_SetBehavior6_Attack:
}
return;
}
- if (AL0447_i_Behavior != k2_behavior_USELESS) { /* BUG0_00 Useless code. Behavior cannot be 2 because this value is never used */
+ if (AL0447_i_Behavior != kDMBehaviorUnknown2) { /* BUG0_00 Useless code. Behavior cannot be 2 because this value is never used */
T0209054_SetBehavior7_Approach:
- curGroup->setBehaviour(k7_behavior_APPROACH);
+ curGroup->setBehaviour(kDMBehaviorApproach);
activeGroup->_targetMapX = _vm->_dungeonMan->_partyMapX;
activeGroup->_targetMapY = _vm->_dungeonMan->_partyMapY;
nextEvent._mapTime += 1;
goto T0209134_SetEvent37;
}
} else {
- if (AL0447_i_Behavior == k0_behavior_WANDER) {
+ if (AL0447_i_Behavior == kDMBehaviorWander) {
primaryDirectionToOrFromParty = getSmelledPartyPrimaryDirOrdinal(&creatureInfo, eventMapX, eventMapY);
if (primaryDirectionToOrFromParty) {
primaryDirectionToOrFromParty--;
@@ -810,7 +813,7 @@ T0209061_MoveGroup:
}
if (_groupMovementBlockedByParty) {
if ((eventType != kM3_TMEventTypeCreateReactionEvent29DangerOnSquare) &&
- ((curGroup->getBehaviour() != k5_behavior_FLEE) ||
+ ((curGroup->getBehaviour() != kDMBehaviorFlee) ||
!getFirstPossibleMovementDirOrdinal(&creatureInfo, eventMapX, eventMapY, false) ||
_vm->getRandomNumber(2)))
goto T0209044_SetBehavior6_Attack;
@@ -839,15 +842,15 @@ T0209073_SetDirectionGroup:
if (!newGroupDirectionFound)
return;
if (approachAfterReaction)
- curGroup->setBehaviour(k7_behavior_APPROACH);
+ curGroup->setBehaviour(kDMBehaviorApproach);
stopAttacking(activeGroup, eventMapX, eventMapY);
}
}
}
} else {
- if (AL0447_i_Behavior == k7_behavior_APPROACH) {
- distanceToVisibleParty = groupGetDistanceToVisibleParty(curGroup, kM1_wholeCreatureGroup, eventMapX, eventMapY);
+ if (AL0447_i_Behavior == kDMBehaviorApproach) {
+ distanceToVisibleParty = groupGetDistanceToVisibleParty(curGroup, kDMWholeCreatureGroup, eventMapX, eventMapY);
if (distanceToVisibleParty) {
if ((distanceToVisibleParty <= creatureInfo.getAttackRange()) && ((!AL0450_i_DistanceXToParty) || (!AL0451_i_DistanceYToParty))) /* If the creature is in range for attack and on the same row or column as the party on the map */
goto T0209044_SetBehavior6_Attack;
@@ -863,7 +866,7 @@ T0209082_WalkTowardTarget:
/* If the creature reached its target but the party is not there anymore */
if ((eventMapX == AL0450_i_TargetMapX) && (eventMapY == AL0451_i_TargetMapY)) {
newGroupDirectionFound = false;
- curGroup->setBehaviour(k0_behavior_WANDER);
+ curGroup->setBehaviour(kDMBehaviorWander);
goto T0209073_SetDirectionGroup;
}
}
@@ -896,11 +899,11 @@ T0209089_DoubleSquareMove:
}
setDirGroup(activeGroup, primaryDirectionToOrFromParty, creatureCount, creatureSize);
} else {
- if (AL0447_i_Behavior == k5_behavior_FLEE) {
+ if (AL0447_i_Behavior == kDMBehaviorFlee) {
T0209094_FleeFromTarget:
allowMovementOverFakePitsAndFakeWalls = true;
/* If the creature can see the party then update target coordinates */
- distanceToVisibleParty = groupGetDistanceToVisibleParty(curGroup, kM1_wholeCreatureGroup, eventMapX, eventMapY);
+ distanceToVisibleParty = groupGetDistanceToVisibleParty(curGroup, kDMWholeCreatureGroup, eventMapX, eventMapY);
if (distanceToVisibleParty) {
AL0450_i_TargetMapX = (activeGroup->_targetMapX = _vm->_dungeonMan->_partyMapX);
AL0451_i_TargetMapY = (activeGroup->_targetMapY = _vm->_dungeonMan->_partyMapY);
@@ -908,7 +911,7 @@ T0209094_FleeFromTarget:
if (!(--(activeGroup->_delayFleeingFromTarget))) { /* If the creature is not afraid anymore then stop fleeing from target */
T0209096_SetBehavior0_Wander:
newGroupDirectionFound = false;
- curGroup->setBehaviour(k0_behavior_WANDER);
+ curGroup->setBehaviour(kDMBehaviorWander);
goto T0209073_SetDirectionGroup;
}
if (_vm->getRandomNumber(2)) {
@@ -934,14 +937,14 @@ T0209096_SetBehavior0_Wander:
}
}
} else { /* Process events 38 to 41, Update Creature Behavior */
- if (AL0447_i_Behavior == k5_behavior_FLEE) {
+ if (AL0447_i_Behavior == kDMBehaviorFlee) {
if (creatureCount) {
stopAttacking(activeGroup, eventMapX, eventMapY);
}
goto T0209094_FleeFromTarget;
}
/* If the creature is attacking, then compute the next aspect update time and the next attack time */
- if (getFlag(activeGroup->_aspect[AL0447_i_CreatureIndex = eventType - k38_TMEventTypeUpdateBehaviour_0], k0x0080_MaskActiveGroupIsAttacking)) {
+ if (getFlag(activeGroup->_aspect[AL0447_i_CreatureIndex = eventType - k38_TMEventTypeUpdateBehaviour_0], kDMAspectMaskActiveGroupIsAttacking)) {
nextAspectUpdateTime = getCreatureAspectUpdateTime(activeGroup, AL0447_i_CreatureIndex, false);
nextEvent._mapTime += ((AL0447_i_Ticks = creatureInfo._attackTicks) + _vm->getRandomNumber(4) - 1);
if (AL0447_i_Ticks > 15)
@@ -958,16 +961,16 @@ T0209096_SetBehavior0_Wander:
activeGroup->_targetMapY = _vm->_dungeonMan->_partyMapY;
}
/* If there is a single creature in the group that is not full square sized and 1/4 chance */
- if (!creatureCount && (creatureSize != k2_MaskCreatureSizeFull) && !((AL0446_i_GroupCellsCriteria = _vm->getRandomNumber(65536)) & 0x00C0)) {
- if (activeGroup->_cells != k255_CreatureTypeSingleCenteredCreature) {
+ if (!creatureCount && (creatureSize != kDMCreatureSizeFull) && !((AL0446_i_GroupCellsCriteria = _vm->getRandomNumber(65536)) & 0x00C0)) {
+ if (activeGroup->_cells != kDMCreatureTypeSingleCenteredCreature) {
/* If the creature is not already on the center of the square then change its cell */
if (AL0446_i_GroupCellsCriteria & 0x0038) /* 7/8 chances of changing cell to the center of the square */
- activeGroup->_cells = k255_CreatureTypeSingleCenteredCreature;
+ activeGroup->_cells = kDMCreatureTypeSingleCenteredCreature;
else /* 1/8 chance of changing cell to the next or previous cell on the square */
AL0446_i_GroupCellsCriteria = _vm->normalizeModulo4(_vm->normalizeModulo4(activeGroup->_cells) + ((AL0446_i_GroupCellsCriteria & 0x0001) ? 1 : -1));
}
/* If 1/8 chance and the creature is not adjacent to the party and is a quarter square sized creature then process projectile impacts and update the creature cell if still alive. When the creature is not in front of the party, it has 7/8 chances of dodging a projectile by moving to another cell or staying in the center of the square */
- if (!(AL0446_i_GroupCellsCriteria & 0x0038) && (distanceToVisibleParty != 1) && (creatureSize == k0_MaskCreatureSizeQuarter)) {
+ if (!(AL0446_i_GroupCellsCriteria & 0x0038) && (distanceToVisibleParty != 1) && (creatureSize == kDMCreatureSizeQuarter)) {
if (_vm->_projexpl->projectileGetImpactCount(kDMElementTypeCreature, eventMapX, eventMapY, activeGroup->_cells) && (_vm->_projexpl->_creatureDamageOutcome == k2_outcomeKilledAllCreaturesInGroup)) /* This call to F0218_PROJECTILE_GetImpactCount works fine because there is a single creature in the group so L0445_ps_ActiveGroup->Cells contains only one cell index */
return;
activeGroup->_cells = _vm->normalizeModulo4(AL0446_i_GroupCellsCriteria);
@@ -975,20 +978,20 @@ T0209096_SetBehavior0_Wander:
}
/* If the creature can see the party and is looking in the party direction or can attack in all direction */
if (distanceToVisibleParty &&
- (getFlag(creatureInfo._attributes, k0x0004_MaskCreatureInfo_sideAttack) ||
+ (getFlag(creatureInfo._attributes, kDMCreatureMaskSideAttack) ||
getCreatureValue(activeGroup->_directions, AL0447_i_CreatureIndex) == primaryDirectionToOrFromParty)) {
/* If the creature is in range to attack the party and random test succeeds */
if ((distanceToVisibleParty <= (AL0446_i_Range = creatureInfo.getAttackRange())) &&
(!AL0450_i_DistanceXToParty || !AL0451_i_DistanceYToParty) &&
(AL0446_i_Range <= (_vm->getRandomNumber(16) + 1))) {
if ((AL0446_i_Range == 1) &&
- (!getFlag(AL0446_i_CreatureAttributes = creatureInfo._attributes, k0x0008_MaskCreatureInfo_preferBackRow) || !_vm->getRandomNumber(4) || !getFlag(AL0446_i_CreatureAttributes, k0x0010_MaskCreatureInfo_attackAnyChamp)) &&
- (creatureSize == k0_MaskCreatureSizeQuarter) &&
- (activeGroup->_cells != k255_CreatureTypeSingleCenteredCreature) &&
+ (!getFlag(AL0446_i_CreatureAttributes = creatureInfo._attributes, kDMCreatureMaskPreferBackRow) || !_vm->getRandomNumber(4) || !getFlag(AL0446_i_CreatureAttributes, kDMCreatureMaskAttackAnyChamp)) &&
+ (creatureSize == kDMCreatureSizeQuarter) &&
+ (activeGroup->_cells != kDMCreatureTypeSingleCenteredCreature) &&
((AL0446_i_Cell = getCreatureValue(activeGroup->_cells, AL0447_i_CreatureIndex)) != primaryDirectionToOrFromParty) &&
(AL0446_i_Cell != _vm->turnDirRight(primaryDirectionToOrFromParty))) { /* If the creature cannot cast spells (range = 1) and is not on a cell where it can attack the party directly and is a quarter square sized creature not in the center of the square then the creature moves to another cell and attack does not occur immediately */
if (!creatureCount && _vm->getRandomNumber(2)) {
- activeGroup->_cells = k255_CreatureTypeSingleCenteredCreature;
+ activeGroup->_cells = kDMCreatureTypeSingleCenteredCreature;
} else {
if ((primaryDirectionToOrFromParty & 0x0001) == (AL0446_i_Cell & 0x0001))
AL0446_i_Cell--;
@@ -1012,7 +1015,7 @@ T0209096_SetBehavior0_Wander:
nextAspectUpdateTime = getCreatureAspectUpdateTime(activeGroup, AL0447_i_CreatureIndex, isCreatureAttacking(curGroup, eventMapX, eventMapY, AL0447_i_CreatureIndex));
nextEvent._mapTime += (creatureInfo._animationTicks & 0xF) + _vm->getRandomNumber(2);
} else {
- curGroup->setBehaviour(k7_behavior_APPROACH);
+ curGroup->setBehaviour(kDMBehaviorApproach);
if (creatureCount) {
stopAttacking(activeGroup, eventMapX, eventMapY);
}
@@ -1020,14 +1023,14 @@ T0209096_SetBehavior0_Wander:
}
} else {
/* If the party is visible, update target coordinates */
- if (groupGetDistanceToVisibleParty(curGroup, kM1_wholeCreatureGroup, eventMapX, eventMapY)) {
+ if (groupGetDistanceToVisibleParty(curGroup, kDMWholeCreatureGroup, eventMapX, eventMapY)) {
activeGroup->_targetMapX = _vm->_dungeonMan->_partyMapX;
activeGroup->_targetMapY = _vm->_dungeonMan->_partyMapY;
- setGroupDirection(activeGroup, primaryDirectionToOrFromParty, AL0447_i_CreatureIndex, creatureCount && (creatureSize == k1_MaskCreatureSizeHalf));
+ setGroupDirection(activeGroup, primaryDirectionToOrFromParty, AL0447_i_CreatureIndex, creatureCount && (creatureSize == kDMCreatureSizeHalf));
nextEvent._mapTime += 2;
nextAspectUpdateTime = _vm->filterTime(nextEvent._mapTime);
} else { /* If the party is not visible, move to the target (last known party location) */
- curGroup->setBehaviour(k7_behavior_APPROACH);
+ curGroup->setBehaviour(kDMBehaviorApproach);
if (creatureCount) {
stopAttacking(activeGroup, eventMapX, eventMapY);
}
@@ -1044,7 +1047,7 @@ T0209134_SetEvent37:
}
T0209135:
if (!nextAspectUpdateTime) {
- nextAspectUpdateTime = getCreatureAspectUpdateTime(activeGroup, kM1_wholeCreatureGroup, false);
+ nextAspectUpdateTime = getCreatureAspectUpdateTime(activeGroup, kDMWholeCreatureGroup, false);
}
T0209136:
if (notUpdateBehaviorFl) {
@@ -1060,7 +1063,7 @@ bool GroupMan::isMovementPossible(CreatureInfo *creatureInfo, int16 mapX, int16
_groupMovementBlockedByGroupThing = Thing::_endOfList;
_groupMovementBlockedByDoor = false;
_groupMovementBlockedByParty = false;
- if (creatureInfo->_movementTicks == k255_immobile)
+ if (creatureInfo->_movementTicks == kDMMovementTicksImmobile)
return false;
_vm->_dungeonMan->mapCoordsAfterRelMovement((Direction)dir, 1, 0, mapX, mapY);
@@ -1071,13 +1074,13 @@ bool GroupMan::isMovementPossible(CreatureInfo *creatureInfo, int16 mapX, int16
((mapY >= 0) && (mapY < _vm->_dungeonMan->_currMapHeight)) &&
(curSquareType != kDMElementTypeWall) &&
(curSquareType != kDMElementTypeStairs) &&
- ((curSquareType != kDMElementTypePit) || (getFlag(curSquare, kDMSquareMaskPitImaginary) && allowMovementOverImaginaryPitsAndFakeWalls) || !getFlag(curSquare, kDMSquareMaskPitOpen) || getFlag(creatureInfo->_attributes, k0x0020_MaskCreatureInfo_levitation)) &&
+ ((curSquareType != kDMElementTypePit) || (getFlag(curSquare, kDMSquareMaskPitImaginary) && allowMovementOverImaginaryPitsAndFakeWalls) || !getFlag(curSquare, kDMSquareMaskPitOpen) || getFlag(creatureInfo->_attributes, kDMCreatureMaskLevitation)) &&
((curSquareType != kDMElementTypeFakeWall) || getFlag(curSquare, kDMSquareMaskFakeWallOpen) || (getFlag(curSquare, kDMSquareMaskFakeWallImaginary) && allowMovementOverImaginaryPitsAndFakeWalls)));
if (_groupMovBlockedByWallStairsPitFakeWalFluxCageTeleporter)
return false;
- if (getFlag(creatureInfo->_attributes, k0x2000_MaskCreatureInfo_archenemy)) {
+ if (getFlag(creatureInfo->_attributes, kDMCreatureMaskArchenemy)) {
Thing curThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY);
while (curThing != Thing::_endOfList) {
if ((curThing).getType() == kDMThingTypeExplosion) {
@@ -1106,7 +1109,7 @@ bool GroupMan::isMovementPossible(CreatureInfo *creatureInfo, int16 mapX, int16
if (curSquareType == kDMElementTypeDoor) {
Teleporter *curTeleporter = (Teleporter *)_vm->_dungeonMan->getSquareFirstThingData(mapX, mapY);
- if (((Square(curSquare).getDoorState()) > (((Door *)curTeleporter)->opensVertically() ? CreatureInfo::getHeight(creatureInfo->_attributes) : 1)) && ((Square(curSquare).getDoorState()) != kDMDoorStateDestroyed) && !getFlag(creatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial)) {
+ if (((Square(curSquare).getDoorState()) > (((Door *)curTeleporter)->opensVertically() ? CreatureInfo::getHeight(creatureInfo->_attributes) : 1)) && ((Square(curSquare).getDoorState()) != kDMDoorStateDestroyed) && !getFlag(creatureInfo->_attributes, kDMCreatureMaskNonMaterial)) {
_groupMovementBlockedByDoor = true;
return false;
}
@@ -1123,13 +1126,13 @@ int16 GroupMan::getDistanceBetweenSquares(int16 srcMapX, int16 srcMapY, int16 de
int16 GroupMan::groupGetDistanceToVisibleParty(Group *group, int16 creatureIndex, int16 mapX, int16 mapY) {
uint16 groupDirections;
CreatureInfo *groupCreatureInfo = &_vm->_dungeonMan->_creatureInfos[group->_type];
- if (_vm->_championMan->_party._event71Count_Invisibility && !getFlag(groupCreatureInfo->_attributes, k0x0800_MaskCreatureInfo_seeInvisible))
+ if (_vm->_championMan->_party._event71Count_Invisibility && !getFlag(groupCreatureInfo->_attributes, kDMCreatureMaskSeeInvisible))
return 0;
bool alwaysSee = false;
int16 checkDirectionsCount; /* Count of directions to test in L0425_ai_CreatureViewDirections */
int16 creatureViewDirections[4]; /* List of directions to test */
- if (getFlag(groupCreatureInfo->_attributes, k0x0004_MaskCreatureInfo_sideAttack)) { /* If creature can see in all directions */
+ if (getFlag(groupCreatureInfo->_attributes, kDMCreatureMaskSideAttack)) { /* If creature can see in all directions */
alwaysSee = true;
checkDirectionsCount = 1;
creatureViewDirections[0] = kDMDirNorth;
@@ -1159,7 +1162,7 @@ int16 GroupMan::groupGetDistanceToVisibleParty(Group *group, int16 creatureIndex
while (checkDirectionsCount--) {
if (alwaysSee || isDestVisibleFromSource(creatureViewDirections[checkDirectionsCount], mapX, mapY, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY)) {
int16 sightRange = groupCreatureInfo->getSightRange();
- if (!getFlag(groupCreatureInfo->_attributes, k0x1000_MaskCreatureInfo_nightVision))
+ if (!getFlag(groupCreatureInfo->_attributes, kDMCreatureMaskNightVision))
sightRange -= _vm->_displayMan->_dungeonViewPaletteIndex >> 1;
if (_currGroupDistanceToParty > MAX<int16>(1, sightRange))
@@ -1244,7 +1247,7 @@ bool GroupMan::isViewPartyBlocked(uint16 mapX, uint16 mapY) {
int32 GroupMan::getCreatureAspectUpdateTime(ActiveGroup *activeGroup, int16 creatureIndex, bool isAttacking) {
Group *group = &(((Group *)_vm->_dungeonMan->_thingData[kDMThingTypeGroup])[activeGroup->_groupThingIndex]);
- uint16 creatureType = group->_type;
+ CreatureType creatureType = group->_type;
uint16 creatureGraphicInfo = _vm->_dungeonMan->_creatureInfos[creatureType]._graphicInfo;
bool processGroup = (creatureIndex < 0);
if (processGroup) /* If the creature index is negative then all creatures in the group are processed */
@@ -1252,7 +1255,7 @@ int32 GroupMan::getCreatureAspectUpdateTime(ActiveGroup *activeGroup, int16 crea
do {
uint16 aspect = activeGroup->_aspect[creatureIndex];
- aspect &= k0x0080_MaskActiveGroupIsAttacking | k0x0040_MaskActiveGroupFlipBitmap;
+ aspect &= kDMAspectMaskActiveGroupIsAttacking | kDMAspectMaskActiveGroupFlipBitmap;
int16 offset = ((creatureGraphicInfo >> 12) & 0x3);
if (offset) {
offset = _vm->getRandomNumber(offset);
@@ -1271,39 +1274,39 @@ int32 GroupMan::getCreatureAspectUpdateTime(ActiveGroup *activeGroup, int16 crea
aspect |= (offset << 3);
}
if (isAttacking) {
- if (getFlag(creatureGraphicInfo, k0x0200_CreatureInfoGraphicMaskFlipAttack)) {
- if (getFlag(aspect, k0x0080_MaskActiveGroupIsAttacking) && (creatureType == k18_CreatureTypeAnimatedArmourDethKnight)) {
+ if (getFlag(creatureGraphicInfo, kDMCreatureMaskFlipAttack)) {
+ if (getFlag(aspect, kDMAspectMaskActiveGroupIsAttacking) && (creatureType == kDMCreatureTypeAnimatedArmour)) {
if (_vm->getRandomNumber(2)) {
- toggleFlag(aspect, k0x0040_MaskActiveGroupFlipBitmap);
+ toggleFlag(aspect, kDMAspectMaskActiveGroupFlipBitmap);
_vm->_sound->requestPlay(k16_soundCOMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT, _currentGroupMapX, _currentGroupMapY, kDMSoundModePlayIfPrioritized);
}
- } else if (!getFlag(aspect, k0x0080_MaskActiveGroupIsAttacking) || !getFlag(creatureGraphicInfo, k0x0400_CreatureInfoGraphicMaskFlipDuringAttack)) {
+ } else if (!getFlag(aspect, kDMAspectMaskActiveGroupIsAttacking) || !getFlag(creatureGraphicInfo, kDMCreatureMaskFlipDuringAttack)) {
if (_vm->getRandomNumber(2))
- setFlag(aspect, k0x0040_MaskActiveGroupFlipBitmap);
+ setFlag(aspect, kDMAspectMaskActiveGroupFlipBitmap);
else
- clearFlag(aspect, k0x0040_MaskActiveGroupFlipBitmap);
+ clearFlag(aspect, kDMAspectMaskActiveGroupFlipBitmap);
}
} else
- clearFlag(aspect, k0x0040_MaskActiveGroupFlipBitmap);
+ clearFlag(aspect, kDMAspectMaskActiveGroupFlipBitmap);
- setFlag(aspect, k0x0080_MaskActiveGroupIsAttacking);
+ setFlag(aspect, kDMAspectMaskActiveGroupIsAttacking);
} else {
- if (getFlag(creatureGraphicInfo, k0x0004_CreatureInfoGraphicMaskFlipNonAttack)) {
- if (creatureType == k13_CreatureTypeCouatl) {
+ if (getFlag(creatureGraphicInfo, kDMCreatureMaskFlipNonAttack)) {
+ if (creatureType == kDMCreatureTypeCouatl) {
if (_vm->getRandomNumber(2)) {
- toggleFlag(aspect, k0x0040_MaskActiveGroupFlipBitmap);
- uint16 soundIndex = _vm->_moveSens->getSound(k13_CreatureTypeCouatl);
+ toggleFlag(aspect, kDMAspectMaskActiveGroupFlipBitmap);
+ uint16 soundIndex = _vm->_moveSens->getSound(kDMCreatureTypeCouatl);
if (soundIndex <= k34_D13_soundCount)
_vm->_sound->requestPlay(soundIndex, _currentGroupMapX, _currentGroupMapY, kDMSoundModePlayIfPrioritized);
}
} else if (_vm->getRandomNumber(2))
- setFlag(aspect, k0x0040_MaskActiveGroupFlipBitmap);
+ setFlag(aspect, kDMAspectMaskActiveGroupFlipBitmap);
else
- clearFlag(aspect, k0x0040_MaskActiveGroupFlipBitmap);
+ clearFlag(aspect, kDMAspectMaskActiveGroupFlipBitmap);
} else
- clearFlag(aspect, k0x0040_MaskActiveGroupFlipBitmap);
+ clearFlag(aspect, kDMAspectMaskActiveGroupFlipBitmap);
- clearFlag(aspect, k0x0080_MaskActiveGroupIsAttacking);
+ clearFlag(aspect, kDMAspectMaskActiveGroupIsAttacking);
}
activeGroup->_aspect[creatureIndex] = aspect;
} while (processGroup && (creatureIndex--));
@@ -1340,7 +1343,7 @@ void GroupMan::addGroupEvent(TimelineEvent *event, uint32 time) {
if (time < (uint32)_vm->filterTime(event->_mapTime)) {
event->_type -= 5;
event->_Cu._ticks = _vm->filterTime(event->_mapTime) - time;
- M32_setTime(event->_mapTime, time);
+ setTime(event->_mapTime, time);
} else
event->_Cu._ticks = time - _vm->filterTime(event->_mapTime);
@@ -1382,7 +1385,7 @@ int16 GroupMan::getFirstPossibleMovementDirOrdinal(CreatureInfo *info, int16 map
}
void GroupMan::setDirGroup(ActiveGroup *activeGroup, int16 dir, int16 creatureIndex, int16 creatureSize) {
- bool twoHalfSquareSizedCreatures = creatureIndex && (creatureSize == k1_MaskCreatureSizeHalf);
+ bool twoHalfSquareSizedCreatures = creatureIndex && (creatureSize == kDMCreatureSizeHalf);
if (twoHalfSquareSizedCreatures)
creatureIndex--;
@@ -1395,7 +1398,7 @@ void GroupMan::setDirGroup(ActiveGroup *activeGroup, int16 dir, int16 creatureIn
void GroupMan::stopAttacking(ActiveGroup *group, int16 mapX, int16 mapY) {
for (int16 creatureIndex = 0; creatureIndex < 4; creatureIndex++)
- clearFlag(group->_aspect[creatureIndex++], k0x0080_MaskActiveGroupIsAttacking);
+ clearFlag(group->_aspect[creatureIndex++], kDMAspectMaskActiveGroupIsAttacking);
groupDeleteEvents(mapX, mapY);
}
@@ -1413,13 +1416,13 @@ bool GroupMan::isCreatureAttacking(Group *group, int16 mapX, int16 mapY, uint16
_vm->_projexpl->_lastCreatureAttackTime = _vm->_gameTime;
ActiveGroup activeGroup = _activeGroups[group->getActiveGroupIndex()];
- uint16 creatureType = group->_type;
+ CreatureType creatureType = group->_type;
CreatureInfo *creatureInfo = &_vm->_dungeonMan->_creatureInfos[creatureType];
uint16 primaryDirectionToParty = _currGroupPrimaryDirToParty;
int16 targetCell;
byte groupCells = activeGroup._cells;
- if (groupCells == k255_CreatureTypeSingleCenteredCreature)
+ if (groupCells == kDMCreatureTypeSingleCenteredCreature)
targetCell = _vm->getRandomNumber(2);
else
targetCell = ((getCreatureValue(groupCells, creatureIndex) + 5 - primaryDirectionToParty) & 0x0002) >> 1;
@@ -1430,8 +1433,8 @@ bool GroupMan::isCreatureAttacking(Group *group, int16 mapX, int16 mapY, uint16
Thing projectileThing = Thing::_none;
switch (creatureType) {
- case k14_CreatureTypeVexirk:
- case k23_CreatureTypeLordChaos:
+ case kDMCreatureTypeVexirk:
+ case kDMCreatureTypeLordChaos:
if (_vm->getRandomNumber(2)) {
projectileThing = Thing::_explFireBall;
} else {
@@ -1450,23 +1453,23 @@ bool GroupMan::isCreatureAttacking(Group *group, int16 mapX, int16 mapY, uint16
}
}
break;
- case k1_CreatureTypeSwampSlimeSlime:
+ case kDMCreatureTypeSwampSlime:
projectileThing = Thing::_explSlime;
break;
- case k3_CreatureTypeWizardEyeFlyingEye:
+ case kDMCreatureTypeWizardEye:
if (_vm->getRandomNumber(8)) {
projectileThing = Thing::_explLightningBolt;
} else {
projectileThing = Thing::_explOpenDoor;
}
break;
- case k19_CreatureTypeMaterializerZytaz:
+ case kDMCreatureTypeMaterializerZytaz:
if (_vm->getRandomNumber(2)) {
projectileThing = Thing::_explPoisonCloud;
break;
}
- case k22_CreatureTypeDemon:
- case k24_CreatureTypeRedDragon:
+ case kDMCreatureTypeDemon:
+ case kDMCreatureTypeRedDragon:
projectileThing = Thing::_explFireBall;
} /* BUG0_13 The game may crash when 'Lord Order' or 'Grey Lord' cast spells. This cannot happen with the original dungeons as they do not contain any groups of these types. 'Lord Order' and 'Grey Lord' creatures can cast spells (attack range > 1) but no projectile type is defined for them in the code. If these creatures are present in a dungeon they will cast projectiles containing undefined things because the variable is not initialized */
int16 kineticEnergy = (creatureInfo->_attack >> 2) + 1;
@@ -1476,7 +1479,7 @@ bool GroupMan::isCreatureAttacking(Group *group, int16 mapX, int16 mapY, uint16
_vm->_projexpl->createProjectile(projectileThing, mapX, mapY, targetCell, (Direction)_currGroupPrimaryDirToParty, CLIP<byte>(20, kineticEnergy, 255), creatureInfo->_dexterity, 8);
} else {
int16 championIndex;
- if (getFlag(creatureInfo->_attributes, k0x0010_MaskCreatureInfo_attackAnyChamp)) {
+ if (getFlag(creatureInfo->_attributes, kDMCreatureMaskAttackAnyChamp)) {
championIndex = _vm->getRandomNumber(4);
int cpt;
for (cpt = 0; (cpt < 4) && !_vm->_championMan->_champions[championIndex]._currHealth; cpt++)
@@ -1490,7 +1493,7 @@ bool GroupMan::isCreatureAttacking(Group *group, int16 mapX, int16 mapY, uint16
return false;
}
- if (creatureType == k2_CreatureTypeGiggler)
+ if (creatureType == kDMCreatureTypeGiggler)
stealFromChampion(group, championIndex);
else {
int16 damage = getChampionDamage(group, championIndex) + 1;
@@ -1561,7 +1564,7 @@ void GroupMan::stealFromChampion(Group *group, uint16 championIndex) {
}
if (!_vm->getRandomNumber(8) || (objectStolen && _vm->getRandomNumber(2))) {
_activeGroups[group->getActiveGroupIndex()]._delayFleeingFromTarget = _vm->getRandomNumber(64) + 20;
- group->setBehaviour(k5_behavior_FLEE);
+ group->setBehaviour(kDMBehaviorFlee);
}
}
@@ -1630,7 +1633,7 @@ int16 GroupMan::getChampionDamage(Group *group, uint16 champIndex) {
void GroupMan::dropMovingCreatureFixedPossession(Thing thing, int16 mapX, int16 mapY) {
if (_dropMovingCreatureFixedPossCellCount) {
Group *group = (Group *)_vm->_dungeonMan->getThingData(thing);
- int16 creatureType = group->_type;
+ CreatureType creatureType = group->_type;
while (_dropMovingCreatureFixedPossCellCount) {
dropCreatureFixedPossessions(creatureType, mapX, mapY, _dropMovingCreatureFixedPossessionsCell[--_dropMovingCreatureFixedPossCellCount], kDMSoundModePlayOneTickLater);
}
@@ -1639,13 +1642,13 @@ void GroupMan::dropMovingCreatureFixedPossession(Thing thing, int16 mapX, int16
void GroupMan::startWandering(int16 mapX, int16 mapY) {
Group *L0332_ps_Group = (Group *)_vm->_dungeonMan->getThingData(groupGetThing(mapX, mapY));
- if (L0332_ps_Group->getBehaviour() >= k4_behavior_USELESS) {
- L0332_ps_Group->setBehaviour(k0_behavior_WANDER);
+ if (L0332_ps_Group->getBehaviour() >= kDMBehaviorUnknown4) {
+ L0332_ps_Group->setBehaviour(kDMBehaviorWander);
}
TimelineEvent nextEvent;
_vm->setMapAndTime(nextEvent._mapTime, _vm->_dungeonMan->_currMapIndex, (_vm->_gameTime + 1));
nextEvent._type = k37_TMEventTypeUpdateBehaviourGroup;
- nextEvent._priority = 255 - _vm->_dungeonMan->_creatureInfos[L0332_ps_Group->_type]._movementTicks; /* The fastest creatures (with small MovementTicks value) get higher event priority */
+ nextEvent._priority = kDMMovementTicksImmobile - _vm->_dungeonMan->_creatureInfos[L0332_ps_Group->_type]._movementTicks; /* The fastest creatures (with small MovementTicks value) get higher event priority */
nextEvent._Cu._ticks = 0;
nextEvent._Bu._location._mapX = mapX;
nextEvent._Bu._location._mapY = mapY;
@@ -1677,7 +1680,7 @@ void GroupMan::addActiveGroup(Thing thing, int16 mapX, int16 mapY) {
activeGroup->_directions = (Direction)getGroupValueUpdatedWithCreatureValue(activeGroup->_directions, creatureIndex, curGroup->getDir());
activeGroup->_aspect[creatureIndex] = 0;
} while (creatureIndex--);
- getCreatureAspectUpdateTime(activeGroup, kM1_wholeCreatureGroup, false);
+ getCreatureAspectUpdateTime(activeGroup, kDMWholeCreatureGroup, false);
}
void GroupMan::removeActiveGroup(uint16 activeGroupIndex) {
@@ -1689,8 +1692,8 @@ void GroupMan::removeActiveGroup(uint16 activeGroupIndex) {
_currActiveGroupCount--;
group->_cells = activeGroup->_cells;
group->setDir(_vm->normalizeModulo4(activeGroup->_directions));
- if (group->getBehaviour() >= k4_behavior_USELESS) {
- group->setBehaviour(k0_behavior_WANDER);
+ if (group->getBehaviour() >= kDMBehaviorUnknown4) {
+ group->setBehaviour(kDMBehaviorWander);
}
activeGroup->_groupThingIndex = -1;
}
@@ -1724,7 +1727,7 @@ void GroupMan::addAllActiveGroups() {
}
}
-Thing GroupMan::groupGetGenerated(int16 creatureType, int16 healthMultiplier, uint16 creatureCount, Direction dir, int16 mapX, int16 mapY) {
+Thing GroupMan::groupGetGenerated(CreatureType creatureType, int16 healthMultiplier, uint16 creatureCount, Direction dir, int16 mapX, int16 mapY) {
Thing groupThing = _vm->_dungeonMan->getUnusedThing(kDMThingTypeGroup);
if (((_currActiveGroupCount >= (_maxActiveGroupCount - 5)) && (_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex))
|| (groupThing == Thing::_none)) {
@@ -1741,15 +1744,16 @@ Thing GroupMan::groupGetGenerated(int16 creatureType, int16 healthMultiplier, ui
if (severalCreaturesInGroup)
cell = _vm->getRandomNumber(4);
else
- groupCells = k255_CreatureTypeSingleCenteredCreature;
+ groupCells = kDMCreatureTypeSingleCenteredCreature;
- CreatureInfo *creatureInfo = &_vm->_dungeonMan->_creatureInfos[group->_type = creatureType];
+ group->_type = creatureType;
+ CreatureInfo *creatureInfo = &_vm->_dungeonMan->_creatureInfos[group->_type];
uint16 baseHealth = creatureInfo->_baseHealth;
do {
group->_health[creatureCount] = (baseHealth * healthMultiplier) + _vm->getRandomNumber((baseHealth >> 2) + 1);
if (severalCreaturesInGroup) {
groupCells = getGroupValueUpdatedWithCreatureValue(groupCells, creatureCount, cell++);
- if (getFlag(creatureInfo->_attributes, k0x0003_MaskCreatureInfo_size) == k1_MaskCreatureSizeHalf)
+ if (getFlag(creatureInfo->_attributes, kDMCreatureMaskSize) == kDMCreatureSizeHalf)
cell++;
cell &= 0x0003;
@@ -1811,7 +1815,7 @@ int16 GroupMan::getMeleeActionDamage(Champion *champ, int16 champIndex, Group *g
if (actionHitsNonMaterialCreatures)
clearFlag(actionHitProbability, k0x8000_hitNonMaterialCreatures);
- if ((!getFlag(creatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial) || actionHitsNonMaterialCreatures) &&
+ if ((!getFlag(creatureInfo->_attributes, kDMCreatureMaskNonMaterial) || actionHitsNonMaterialCreatures) &&
((_vm->_championMan->getDexterity(champ) > (_vm->getRandomNumber(32) + creatureInfo->_dexterity + doubledMapDifficulty - 16)) ||
(!_vm->getRandomNumber(4)) ||
(_vm->_championMan->isLucky(champ, 75 - actionHitProbability)))) {
@@ -1851,7 +1855,7 @@ T0231009:
L0565_i_Damage >>= 2;
L0565_i_Damage += _vm->getRandomNumber(4) + 1;
if ((actionHandObjectIconIndex == kDMIconIndiceWeaponVorpalBlade)
- && !getFlag(creatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial)
+ && !getFlag(creatureInfo->_attributes, kDMCreatureMaskNonMaterial)
&& !(L0565_i_Damage >>= 1))
goto T0231015;
@@ -1925,7 +1929,7 @@ uint16 GroupMan::isLordChaosOnSquare(int16 mapX, int16 mapY) {
return 0;
Group *group = (Group *)_vm->_dungeonMan->getThingData(thing);
- if (group->_type == k23_CreatureTypeLordChaos)
+ if (group->_type == kDMCreatureTypeLordChaos)
return thing.toUint16();
return 0;
@@ -1950,7 +1954,7 @@ void GroupMan::fuseAction(uint16 mapX, uint16 mapY) {
if ((mapX < 0) || (mapX >= _vm->_dungeonMan->_currMapWidth) || (mapY < 0) || (mapY >= _vm->_dungeonMan->_currMapHeight))
return;
- _vm->_projexpl->createExplosion(Thing::_explHarmNonMaterial, 255, mapX, mapY, k255_CreatureTypeSingleCenteredCreature); /* BUG0_17 The game crashes after the Fuse action is performed while looking at a wall on a map boundary. An explosion thing is created on the square in front of the party but there is no check to ensure the square coordinates are in the map bounds. This corrupts a memory location and leads to a game crash */
+ _vm->_projexpl->createExplosion(Thing::_explHarmNonMaterial, 255, mapX, mapY, kDMCreatureTypeSingleCenteredCreature); /* BUG0_17 The game crashes after the Fuse action is performed while looking at a wall on a map boundary. An explosion thing is created on the square in front of the party but there is no check to ensure the square coordinates are in the map bounds. This corrupts a memory location and leads to a game crash */
Thing lordChaosThing = Thing(isLordChaosOnSquare(mapX, mapY));
if (lordChaosThing.toUint16()) {
bool isFluxcages[4];
diff --git a/engines/dm/group.h b/engines/dm/group.h
index ad68a03216..a60eb75999 100644
--- a/engines/dm/group.h
+++ b/engines/dm/group.h
@@ -29,71 +29,83 @@
#define DM_GROUP_H
#include "dm/dm.h"
+#include "dm/sounds.h"
namespace DM {
class Champion;
class TimelineEvent;
class CreatureInfo;
- // this doesn't seem to be used anywhere at all
/* Creature types */
enum CreatureType {
- k0_CreatureTypeGiantScorpionScorpion = 0, // @ C00_CREATURE_GIANT_SCORPION_SCORPION
- k1_CreatureTypeSwampSlimeSlime = 1, // @ C01_CREATURE_SWAMP_SLIME_SLIME_DEVIL
- k2_CreatureTypeGiggler = 2, // @ C02_CREATURE_GIGGLER
- k3_CreatureTypeWizardEyeFlyingEye = 3, // @ C03_CREATURE_WIZARD_EYE_FLYING_EYE
- k4_CreatureTypePainRatHellHound = 4, // @ C04_CREATURE_PAIN_RAT_HELLHOUND
- k5_CreatureTypeRuster = 5, // @ C05_CREATURE_RUSTER
- k6_CreatureTypeScreamer = 6, // @ C06_CREATURE_SCREAMER
- k7_CreatureTypeRockpile = 7, // @ C07_CREATURE_ROCK_ROCKPILE
- k8_CreatureTypeGhostRive = 8, // @ C08_CREATURE_GHOST_RIVE
- k9_CreatureTypeStoneGolem = 9, // @ C09_CREATURE_STONE_GOLEM
- k10_CreatureTypeMummy = 10, // @ C10_CREATURE_MUMMY
- k11_CreatureTypeBlackFlame = 11, // @ C11_CREATURE_BLACK_FLAME
- k12_CreatureTypeSkeleton = 12, // @ C12_CREATURE_SKELETON
- k13_CreatureTypeCouatl = 13, // @ C13_CREATURE_COUATL
- k14_CreatureTypeVexirk = 14, // @ C14_CREATURE_VEXIRK
- k15_CreatureTypeMagnetaWormWorm = 15, // @ C15_CREATURE_MAGENTA_WORM_WORM
- k16_CreatureTypeTrolinAntman = 16, // @ C16_CREATURE_TROLIN_ANTMAN
- k17_CreatureTypeGiantWaspMuncher = 17, // @ C17_CREATURE_GIANT_WASP_MUNCHER
- k18_CreatureTypeAnimatedArmourDethKnight = 18, // @ C18_CREATURE_ANIMATED_ARMOUR_DETH_KNIGHT
- k19_CreatureTypeMaterializerZytaz = 19, // @ C19_CREATURE_MATERIALIZER_ZYTAZ
- k20_CreatureTypeWaterElemental = 20, // @ C20_CREATURE_WATER_ELEMENTAL
- k21_CreatureTypeOitu = 21, // @ C21_CREATURE_OITU
- k22_CreatureTypeDemon = 22, // @ C22_CREATURE_DEMON
- k23_CreatureTypeLordChaos = 23, // @ C23_CREATURE_LORD_CHAOS
- k24_CreatureTypeRedDragon = 24, // @ C24_CREATURE_RED_DRAGON
- k25_CreatureTypeLordOrder = 25, // @ C25_CREATURE_LORD_ORDER
- k26_CreatureTypeGreyLord = 26, // @ C26_CREATURE_GREY_LORD
- k255_CreatureTypeSingleCenteredCreature = 255 // @ C255_SINGLE_CENTERED_CREATURE
+ kDMCreatureTypeGiantScorpion = 0, // @ C00_CREATURE_GIANT_SCORPION_SCORPION
+ kDMCreatureTypeSwampSlime = 1, // @ C01_CREATURE_SWAMP_SLIME_SLIME_DEVIL
+ kDMCreatureTypeGiggler = 2, // @ C02_CREATURE_GIGGLER
+ kDMCreatureTypeWizardEye = 3, // @ C03_CREATURE_WIZARD_EYE_FLYING_EYE
+ kDMCreatureTypePainRat = 4, // @ C04_CREATURE_PAIN_RAT_HELLHOUND
+ kDMCreatureTypeRuster = 5, // @ C05_CREATURE_RUSTER
+ kDMCreatureTypeScreamer = 6, // @ C06_CREATURE_SCREAMER
+ kDMCreatureTypeRockpile = 7, // @ C07_CREATURE_ROCK_ROCKPILE
+ kDMCreatureTypeGhostRive = 8, // @ C08_CREATURE_GHOST_RIVE
+ kDMCreatureTypeStoneGolem = 9, // @ C09_CREATURE_STONE_GOLEM
+ kDMCreatureTypeMummy = 10, // @ C10_CREATURE_MUMMY
+ kDMCreatureTypeBlackFlame = 11, // @ C11_CREATURE_BLACK_FLAME
+ kDMCreatureTypeSkeleton = 12, // @ C12_CREATURE_SKELETON
+ kDMCreatureTypeCouatl = 13, // @ C13_CREATURE_COUATL
+ kDMCreatureTypeVexirk = 14, // @ C14_CREATURE_VEXIRK
+ kDMCreatureTypeMagentaWorm = 15, // @ C15_CREATURE_MAGENTA_WORM_WORM
+ kDMCreatureTypeAntman = 16, // @ C16_CREATURE_TROLIN_ANTMAN
+ kDMCreatureTypeGiantWasp = 17, // @ C17_CREATURE_GIANT_WASP_MUNCHER
+ kDMCreatureTypeAnimatedArmour = 18, // @ C18_CREATURE_ANIMATED_ARMOUR_DETH_KNIGHT
+ kDMCreatureTypeMaterializerZytaz = 19, // @ C19_CREATURE_MATERIALIZER_ZYTAZ
+ kDMCreatureTypeWaterElemental = 20, // @ C20_CREATURE_WATER_ELEMENTAL
+ kDMCreatureTypeOitu = 21, // @ C21_CREATURE_OITU
+ kDMCreatureTypeDemon = 22, // @ C22_CREATURE_DEMON
+ kDMCreatureTypeLordChaos = 23, // @ C23_CREATURE_LORD_CHAOS
+ kDMCreatureTypeRedDragon = 24, // @ C24_CREATURE_RED_DRAGON
+ kDMCreatureTypeLordOrder = 25, // @ C25_CREATURE_LORD_ORDER
+ kDMCreatureTypeGreyLord = 26 // @ C26_CREATURE_GREY_LORD
};
-#define k0_MaskCreatureSizeQuarter 0 // @ C0_SIZE_QUARTER_SQUARE
-#define k1_MaskCreatureSizeHalf 1 // @ C1_SIZE_HALF_SQUARE
-#define k2_MaskCreatureSizeFull 2 // @ C2_SIZE_FULL_SQUARE
-
-#define k0x0003_MaskCreatureInfo_size 0x0003 // @ MASK0x0003_SIZE
-#define k0x0004_MaskCreatureInfo_sideAttack 0x0004 // @ MASK0x0004_SIDE_ATTACK
-#define k0x0008_MaskCreatureInfo_preferBackRow 0x0008 // @ MASK0x0008_PREFER_BACK_ROW
-#define k0x0010_MaskCreatureInfo_attackAnyChamp 0x0010 // @ MASK0x0010_ATTACK_ANY_CHAMPION
-#define k0x0020_MaskCreatureInfo_levitation 0x0020 // @ MASK0x0020_LEVITATION
-#define k0x0040_MaskCreatureInfo_nonMaterial 0x0040 // @ MASK0x0040_NON_MATERIAL
-#define k0x0200_MaskCreatureInfo_dropFixedPoss 0x0200 // @ MASK0x0200_DROP_FIXED_POSSESSIONS
-#define k0x0400_MaskCreatureInfo_keepThrownSharpWeapon 0x0400 // @ MASK0x0400_KEEP_THROWN_SHARP_WEAPONS
-#define k0x0800_MaskCreatureInfo_seeInvisible 0x0800 // @ MASK0x0800_SEE_INVISIBLE
-#define k0x1000_MaskCreatureInfo_nightVision 0x1000 // @ MASK0x1000_NIGHT_VISION
-#define k0x2000_MaskCreatureInfo_archenemy 0x2000 // @ MASK0x2000_ARCHENEMY
-#define k0x4000_MaskCreatureInfo_magicmap 0x4000 // @ MASK0x4000_MAGICMAP
+enum CreatureSize {
+ kDMCreatureSizeQuarter = 0, // @ C0_SIZE_QUARTER_SQUARE
+ kDMCreatureSizeHalf = 1, // @ C1_SIZE_HALF_SQUARE
+ kDMCreatureSizeFull = 2 // @ C2_SIZE_FULL_SQUARE
+};
+enum Behavior {
+ kDMBehaviorWander = 0, // @ C0_BEHAVIOR_WANDER
+ kDMBehaviorUnknown2 = 2, // @ C2_BEHAVIOR_USELESS
+ kDMBehaviorUnknown3 = 3, // @ C3_BEHAVIOR_USELESS
+ kDMBehaviorUnknown4 = 4, // @ C4_BEHAVIOR_USELESS
+ kDMBehaviorFlee = 5, // @ C5_BEHAVIOR_FLEE
+ kDMBehaviorAttack = 6, // @ C6_BEHAVIOR_ATTACK
+ kDMBehaviorApproach = 7 // @ C7_BEHAVIOR_APPROACH
+};
-#define k0x0040_MaskActiveGroupFlipBitmap 0x0040 // @ MASK0x0040_FLIP_BITMAP
-#define k0x0080_MaskActiveGroupIsAttacking 0x0080 // @ MASK0x0080_IS_ATTACKING
+#define kDMImmuneToFear 15 // @ C15_IMMUNE_TO_FEAR
+#define kDMMovementTicksImmobile 255 // @ C255_IMMOBILE
+#define kDMWholeCreatureGroup -1 // @ CM1_WHOLE_CREATURE_GROUP
+#define kDMCreatureTypeSingleCenteredCreature 255 // @ C255_SINGLE_CENTERED_CREATURE
+
+enum CreatureMask {
+ kDMCreatureMaskSize = 0x0003, // @ MASK0x0003_SIZE
+ kDMCreatureMaskSideAttack = 0x0004, // @ MASK0x0004_SIDE_ATTACK
+ kDMCreatureMaskPreferBackRow = 0x0008, // @ MASK0x0008_PREFER_BACK_ROW
+ kDMCreatureMaskAttackAnyChamp = 0x0010, // @ MASK0x0010_ATTACK_ANY_CHAMPION
+ kDMCreatureMaskLevitation = 0x0020, // @ MASK0x0020_LEVITATION
+ kDMCreatureMaskNonMaterial = 0x0040, // @ MASK0x0040_NON_MATERIAL
+ kDMCreatureMaskDropFixedPoss = 0x0200, // @ MASK0x0200_DROP_FIXED_POSSESSIONS
+ kDMCreatureMaskKeepThrownSharpWeapon = 0x0400, // @ MASK0x0400_KEEP_THROWN_SHARP_WEAPONS
+ kDMCreatureMaskSeeInvisible = 0x0800, // @ MASK0x0800_SEE_INVISIBLE
+ kDMCreatureMaskNightVision = 0x1000, // @ MASK0x1000_NIGHT_VISION
+ kDMCreatureMaskArchenemy = 0x2000, // @ MASK0x2000_ARCHENEMY
+ kDMCreatureMaskMagicMap = 0x4000 // @ MASK0x4000_MAGICMAP
+};
-enum SoundMode {
- kDMSoundModeDoNotPlaySound = -1, // @ CM1_MODE_DO_NOT_PLAY_SOUND
- kDMSoundModePlayImmediately = 0, // @ C00_MODE_PLAY_IMMEDIATELY
- kDMSoundModePlayIfPrioritized = 1, // @ C01_MODE_PLAY_IF_PRIORITIZED
- kDMSoundModePlayOneTickLater = 2 // @ C02_MODE_PLAY_ONE_TICK_LATER
+enum aspectMask {
+ kDMAspectMaskActiveGroupFlipBitmap = 0x0040, // @ MASK0x0040_FLIP_BITMAP
+ kDMAspectMaskActiveGroupIsAttacking = 0x0080 // @ MASK0x0080_IS_ATTACKING
};
class ActiveGroup {
@@ -112,18 +124,17 @@ public:
byte _aspect[4];
}; // @ ACTIVE_GROUP
-
class Group {
public:
Thing _nextThing;
Thing _slot;
- uint16 _type;
+ CreatureType _type;
uint16 _cells;
uint16 _health[4];
uint16 _flags;
public:
- explicit Group(uint16 *rawDat) : _nextThing(rawDat[0]), _slot(rawDat[1]), _type(rawDat[2]),
- _cells(rawDat[3]), _flags(rawDat[8]) {
+ explicit Group(uint16 *rawDat) : _nextThing(rawDat[0]), _slot(rawDat[1]), _cells(rawDat[3]), _flags(rawDat[8]) {
+ _type = (CreatureType)rawDat[2];
_health[0] = rawDat[4];
_health[1] = rawDat[5];
_health[2] = rawDat[6];
@@ -142,23 +153,6 @@ public:
void setDoNotDiscard(bool val) { _flags = (_flags & ~(1 << 10)) | ((val & 1) << 10); }
}; // @ GROUP
-#define k0_behavior_WANDER 0 // @ C0_BEHAVIOR_WANDER
-#define k2_behavior_USELESS 2 // @ C2_BEHAVIOR_USELESS
-#define k3_behavior_USELESS 3 // @ C3_BEHAVIOR_USELESS
-#define k4_behavior_USELESS 4 // @ C4_BEHAVIOR_USELESS
-#define k5_behavior_FLEE 5 // @ C5_BEHAVIOR_FLEE
-#define k6_behavior_ATTACK 6 // @ C6_BEHAVIOR_ATTACK
-#define k7_behavior_APPROACH 7 // @ C7_BEHAVIOR_APPROACH
-
-#define k15_immuneToFear 15 // @ C15_IMMUNE_TO_FEAR
-
-#define k255_immobile 255 // @ C255_IMMOBILE
-#define kM1_wholeCreatureGroup -1 // @ CM1_WHOLE_CREATURE_GROUP
-
-
-int32 M32_setTime(int32 &map_time, int32 time); // @ M32_SET_TIME
-
-
class GroupMan {
DMEngine *_vm;
byte _dropMovingCreatureFixedPossessionsCell[4]; // @ G0392_auc_DropMovingCreatureFixedPossessionsCells
@@ -179,6 +173,7 @@ class GroupMan {
bool _groupMovBlockedByWallStairsPitFakeWalFluxCageTeleporter; // @ G0387_B_GroupMovementBlockedByWallStairsPitFakeWallFluxcageTeleporter
int32 twoHalfSquareSizedCreaturesGroupLastDirectionSetTime; // @ G0395_l_TwoHalfSquareSizedCreaturesGroupLastDirectionSetTime
uint16 toggleFlag(uint16 &val, uint16 mask); // @ M10_TOGGLE
+ int32 setTime(int32 &map_time, int32 time); // @ M32_SET_TIME
public:
uint16 _maxActiveGroupCount; // @ G0376_ui_MaximumActiveGroupCount
@@ -193,7 +188,7 @@ public:
int16 getCreatureOrdinalInCell(Group *group, uint16 cell); // @ F0176_GROUP_GetCreatureOrdinalInCell
uint16 getCreatureValue(uint16 groupVal, uint16 creatureIndex); // @ M50_CREATURE_VALUE
void dropGroupPossessions(int16 mapX, int16 mapY, Thing groupThing, SoundMode mode); // @ F0188_GROUP_DropGroupPossessions
- void dropCreatureFixedPossessions(uint16 creatureType, int16 mapX, int16 mapY, uint16 cell,
+ void dropCreatureFixedPossessions(CreatureType creatureType, int16 mapX, int16 mapY, uint16 cell,
SoundMode soundMode); // @ F0186_GROUP_DropCreatureFixedPossessions
int16 getDirsWhereDestIsVisibleFromSource(int16 srcMapX, int16 srcMapY,
int16 destMapX, int16 destMapY); // @ F0228_GROUP_GetDirectionsWhereDestinationIsVisibleFromSource
@@ -208,7 +203,7 @@ public:
void groupDeleteEvents(int16 mapX, int16 mapY); // @ F0181_GROUP_DeleteEvents
uint16 getGroupValueUpdatedWithCreatureValue(uint16 groupVal, uint16 creatureIndex, uint16 creatureVal); // @ F0178_GROUP_GetGroupValueUpdatedWithCreatureValue
int16 getDamageAllCreaturesOutcome(Group *group, int16 mapX, int16 mapY, int16 attack, bool notMoving); // @ F0191_GROUP_GetDamageAllCreaturesOutcome
- int16 groupGetResistanceAdjustedPoisonAttack(uint16 creatreType, int16 poisonAttack); // @ F0192_GROUP_GetResistanceAdjustedPoisonAttack
+ int16 groupGetResistanceAdjustedPoisonAttack(CreatureType creatureType, int16 poisonAttack); // @ F0192_GROUP_GetResistanceAdjustedPoisonAttack
void processEvents29to41(int16 eventMapX, int16 eventMapY, int16 eventType, uint16 ticks); // @ F0209_GROUP_ProcessEvents29to41
bool isMovementPossible(CreatureInfo *creatureInfo, int16 mapX, int16 mapY,
uint16 dir, bool allowMovementOverImaginaryPitsAndFakeWalls); // @ F0202_GROUP_IsMovementPossible
@@ -242,7 +237,7 @@ public:
void removeActiveGroup(uint16 activeGroupIndex); // @ F0184_GROUP_RemoveActiveGroup
void removeAllActiveGroups(); // @ F0194_GROUP_RemoveAllActiveGroups
void addAllActiveGroups(); // @ F0195_GROUP_AddAllActiveGroups
- Thing groupGetGenerated(int16 creatureType, int16 healthMultiplier, uint16 creatureCount, Direction dir, int16 mapX, int16 mapY); // @ F0185_GROUP_GetGenerated
+ Thing groupGetGenerated(CreatureType creatureType, int16 healthMultiplier, uint16 creatureCount, Direction dir, int16 mapX, int16 mapY); // @ F0185_GROUP_GetGenerated
bool isSquareACorridorTeleporterPitOrDoor(int16 mapX, int16 mapY); // @ F0223_GROUP_IsSquareACorridorTeleporterPitOrDoor
int16 getMeleeTargetCreatureOrdinal(int16 groupX, int16 groupY, int16 partyX, int16 paryY,
uint16 champCell); // @ F0177_GROUP_GetMeleeTargetCreatureOrdinal
@@ -255,7 +250,6 @@ public:
void saveActiveGroupPart(Common::OutSaveFile *file);
void loadActiveGroupPart(Common::InSaveFile *file);
};
-
}
#endif
diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp
index 3fe3493172..93f66289ff 100644
--- a/engines/dm/inventory.cpp
+++ b/engines/dm/inventory.cpp
@@ -71,7 +71,7 @@ void InventoryMan::initConstants() {
InventoryMan::InventoryMan(DMEngine *vm) : _vm(vm) {
_inventoryChampionOrdinal = 0;
- _panelContent = k0_PanelContentFoodWaterPoisoned;
+ _panelContent = kDMPanelContentFoodWaterPoisoned;
for (uint16 i = 0; i < 8; ++i)
_chestSlots[i] = Thing(0);
_openChest = Thing::_none;
@@ -125,30 +125,30 @@ void InventoryMan::toggleInventory(ChampionIndex championIndex) {
_vm->_displayMan->_useByteBoxCoordinates = false;
_inventoryChampionOrdinal = _vm->indexToOrdinal(championIndex);
if (!inventoryChampionOrdinal)
- _vm->_displayMan->shadeScreenBox(&_vm->_displayMan->_boxMovementArrows, k0_ColorBlack);
+ _vm->_displayMan->shadeScreenBox(&_vm->_displayMan->_boxMovementArrows, kDMColorBlack);
Champion *champion = &_vm->_championMan->_champions[championIndex];
_vm->_displayMan->loadIntoBitmap(k17_InventoryGraphicIndice, _vm->_displayMan->_bitmapViewport);
if (_vm->_championMan->_candidateChampionOrdinal)
- _vm->_displayMan->fillBoxBitmap(_vm->_displayMan->_bitmapViewport, boxFloppyZzzCross, k12_ColorDarkestGray, k112_byteWidthViewport, k136_heightViewport);
+ _vm->_displayMan->fillBoxBitmap(_vm->_displayMan->_bitmapViewport, boxFloppyZzzCross, kDMColorDarkestGray, k112_byteWidthViewport, k136_heightViewport);
switch (_vm->getGameLanguage()) { // localized
default:
case Common::EN_ANY:
- _vm->_textMan->printToViewport(5, 116, k13_ColorLightestGray, "HEALTH");
- _vm->_textMan->printToViewport(5, 124, k13_ColorLightestGray, "STAMINA");
+ _vm->_textMan->printToViewport(5, 116, kDMColorLightestGray, "HEALTH");
+ _vm->_textMan->printToViewport(5, 124, kDMColorLightestGray, "STAMINA");
break;
case Common::DE_DEU:
- _vm->_textMan->printToViewport(5, 116, k13_ColorLightestGray, "GESUND");
- _vm->_textMan->printToViewport(5, 124, k13_ColorLightestGray, "KRAFT");
+ _vm->_textMan->printToViewport(5, 116, kDMColorLightestGray, "GESUND");
+ _vm->_textMan->printToViewport(5, 124, kDMColorLightestGray, "KRAFT");
break;
case Common::FR_FRA:
- _vm->_textMan->printToViewport(5, 116, k13_ColorLightestGray, "SANTE");
- _vm->_textMan->printToViewport(5, 124, k13_ColorLightestGray, "VIGUEUR");
+ _vm->_textMan->printToViewport(5, 116, kDMColorLightestGray, "SANTE");
+ _vm->_textMan->printToViewport(5, 124, kDMColorLightestGray, "VIGUEUR");
break;
}
- _vm->_textMan->printToViewport(5, 132, k13_ColorLightestGray, "MANA");
+ _vm->_textMan->printToViewport(5, 132, kDMColorLightestGray, "MANA");
for (uint16 i = kDMSlotReadyHand; i < kDMSlotChest1; i++)
_vm->_championMan->drawSlot(championIndex, i);
@@ -166,35 +166,35 @@ void InventoryMan::drawStatusBoxPortrait(ChampionIndex championIndex) {
DisplayMan &dispMan = *_vm->_displayMan;
dispMan._useByteBoxCoordinates = false;
Box box;
- box._y1 = 0;
- box._y2 = 28;
- box._x1 = championIndex * k69_ChampionStatusBoxSpacing + 7;
- box._x2 = box._x1 + 31;
- dispMan.blitToScreen(_vm->_championMan->_champions[championIndex]._portrait, &box, k16_byteWidth, kM1_ColorNoTransparency, 29);
+ box._rect.top = 0;
+ box._rect.bottom = 28;
+ box._rect.left = championIndex * kDMChampionStatusBoxSpacing + 7;
+ box._rect.right = box._rect.left + 31;
+ dispMan.blitToScreen(_vm->_championMan->_champions[championIndex]._portrait, &box, k16_byteWidth, kDMColorNoTransparency, 29);
}
void InventoryMan::drawPanelHorizontalBar(int16 x, int16 y, int16 pixelWidth, Color color) {
Box box;
- box._x1 = x;
- box._x2 = box._x1 + pixelWidth;
- box._y1 = y;
- box._y2 = box._y1 + 6;
+ box._rect.left = x;
+ box._rect.right = box._rect.left + pixelWidth;
+ box._rect.top = y;
+ box._rect.bottom = box._rect.top + 6;
_vm->_displayMan->_useByteBoxCoordinates = false;
_vm->_displayMan->fillBoxBitmap(_vm->_displayMan->_bitmapViewport, box, color, k112_byteWidthViewport, k136_heightViewport);
}
void InventoryMan::drawPanelFoodOrWaterBar(int16 amount, int16 y, Color color) {
if (amount < -512)
- color = k8_ColorRed;
+ color = kDMColorRed;
else if (amount < 0)
- color = k11_ColorYellow;
+ color = kDMColorYellow;
int16 pixelWidth = amount + 1024;
if (pixelWidth == 3072)
pixelWidth = 3071;
pixelWidth /= 32;
- drawPanelHorizontalBar(115, y + 2, pixelWidth, k0_ColorBlack);
+ drawPanelHorizontalBar(115, y + 2, pixelWidth, kDMColorBlack);
drawPanelHorizontalBar(113, y, pixelWidth, color);
}
@@ -206,36 +206,36 @@ void InventoryMan::drawPanelFoodWaterPoisoned() {
Champion &champ = _vm->_championMan->_champions[_inventoryChampionOrdinal];
closeChest();
DisplayMan &dispMan = *_vm->_displayMan;
- dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k20_PanelEmptyIndice), _boxPanel, k72_byteWidth, k8_ColorRed, 73);
+ dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k20_PanelEmptyIndice), _boxPanel, k72_byteWidth, kDMColorRed, 73);
switch (_vm->getGameLanguage()) { // localized
default:
case Common::EN_ANY:
- dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k30_FoodLabelIndice), boxFood, k24_byteWidth, k12_ColorDarkestGray, 9);
- dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k31_WaterLabelIndice), boxWater, k24_byteWidth, k12_ColorDarkestGray, 9);
+ dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k30_FoodLabelIndice), boxFood, k24_byteWidth, kDMColorDarkestGray, 9);
+ dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k31_WaterLabelIndice), boxWater, k24_byteWidth, kDMColorDarkestGray, 9);
break;
case Common::DE_DEU:
- dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k30_FoodLabelIndice), boxFood, k32_byteWidth, k12_ColorDarkestGray, 9);
- dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k31_WaterLabelIndice), boxWater, k32_byteWidth, k12_ColorDarkestGray, 9);
+ dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k30_FoodLabelIndice), boxFood, k32_byteWidth, kDMColorDarkestGray, 9);
+ dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k31_WaterLabelIndice), boxWater, k32_byteWidth, kDMColorDarkestGray, 9);
break;
case Common::FR_FRA:
- dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k30_FoodLabelIndice), boxFood, k48_byteWidth, k12_ColorDarkestGray, 9);
- dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k31_WaterLabelIndice), boxWater, k24_byteWidth, k12_ColorDarkestGray, 9);
+ dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k30_FoodLabelIndice), boxFood, k48_byteWidth, kDMColorDarkestGray, 9);
+ dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k31_WaterLabelIndice), boxWater, k24_byteWidth, kDMColorDarkestGray, 9);
break;
}
if (champ._poisonEventCount)
dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k32_PoisionedLabelIndice),
- boxPoisoned, k48_byteWidth, k12_ColorDarkestGray, 15);
+ boxPoisoned, k48_byteWidth, kDMColorDarkestGray, 15);
- drawPanelFoodOrWaterBar(champ._food, 69, k5_ColorLightBrown);
- drawPanelFoodOrWaterBar(champ._water, 92, k14_ColorBlue);
+ drawPanelFoodOrWaterBar(champ._food, 69, kDMColorLightBrown);
+ drawPanelFoodOrWaterBar(champ._water, 92, kDMColorBlue);
}
void InventoryMan::drawPanelResurrectReincarnate() {
- _panelContent = k5_PanelContentResurrectReincarnate;
+ _panelContent = kDMPanelContentResurrectReincarnate;
_vm->_displayMan->blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k40_PanelResurectReincaranteIndice),
- _boxPanel, k72_byteWidth, k6_ColorDarkGreen, 73);
+ _boxPanel, k72_byteWidth, kDMColorDarkGreen, 73);
}
void InventoryMan::drawPanel() {
@@ -249,13 +249,13 @@ void InventoryMan::drawPanel() {
Thing thing = cm._champions[_vm->ordinalToIndex(_inventoryChampionOrdinal)].getSlot(kDMSlotActionHand);
- _panelContent = k0_PanelContentFoodWaterPoisoned;
+ _panelContent = kDMPanelContentFoodWaterPoisoned;
switch (thing.getType()) {
case kDMThingTypeContainer:
- _panelContent = k4_PanelContentChest;
+ _panelContent = kDMPanelContentChest;
break;
case kDMThingTypeScroll:
- _panelContent = k2_PanelContentScroll;
+ _panelContent = kDMPanelContentScroll;
break;
default:
thing = Thing::_none;
@@ -302,7 +302,7 @@ void InventoryMan::drawPanelScrollTextLine(int16 yPos, char *text) {
else if (*iter >= '{') // this branch is CHANGE5_03_IMPROVEMENT
*iter -= 96;
}
- _vm->_textMan->printToViewport(162 - (6 * strlen(text) / 2), yPos, k0_ColorBlack, text, k15_ColorWhite);
+ _vm->_textMan->printToViewport(162 - (6 * strlen(text) / 2), yPos, kDMColorBlack, text, kDMColorWhite);
}
void InventoryMan::drawPanelScroll(Scroll *scroll) {
@@ -316,7 +316,7 @@ void InventoryMan::drawPanelScroll(Scroll *scroll) {
*charRed = '\0';
dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k23_PanelOpenScrollIndice),
- _boxPanel, k72_byteWidth, k8_ColorRed, 73);
+ _boxPanel, k72_byteWidth, kDMColorRed, 73);
int16 lineCount = 1;
charRed++;
char *charGreen = charRed; // first char of the second line
@@ -368,7 +368,7 @@ void InventoryMan::openAndDrawChest(Thing thingToOpen, Container *chest, bool is
objMan.drawIconInSlotBox(k9_SlotBoxInventoryActionHand, kDMIconIndiceContainerChestOpen);
}
dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k25_PanelOpenChestIndice),
- _boxPanel, k72_byteWidth, k8_ColorRed, 73);
+ _boxPanel, k72_byteWidth, kDMColorRed, 73);
int16 chestSlotIndex = 0;
Thing thing = chest->getSlot();
int16 thingCount = 0;
@@ -376,12 +376,12 @@ void InventoryMan::openAndDrawChest(Thing thingToOpen, Container *chest, bool is
if (++thingCount > 8)
break; // CHANGE8_08_FIX, make sure that no more than the first 8 objects in a chest are drawn
- objMan.drawIconInSlotBox(chestSlotIndex + k38_SlotBoxChestFirstSlot, objMan.getIconIndex(thing));
+ objMan.drawIconInSlotBox(chestSlotIndex + kDMSlotBoxChestFirstSlot, objMan.getIconIndex(thing));
_chestSlots[chestSlotIndex++] = thing;
thing = _vm->_dungeonMan->getNextThing(thing);
}
while (chestSlotIndex < 8) {
- objMan.drawIconInSlotBox(chestSlotIndex + k38_SlotBoxChestFirstSlot, kDMIconIndiceNone);
+ objMan.drawIconInSlotBox(chestSlotIndex + kDMSlotBoxChestFirstSlot, kDMIconIndiceNone);
_chestSlots[chestSlotIndex++] = Thing::_none;
}
}
@@ -391,7 +391,7 @@ void InventoryMan::drawIconToViewport(IconIndice iconIndex, int16 xPos, int16 yP
Box boxIcon(xPos, xPos + 15, yPos, yPos + 15);
_vm->_objectMan->extractIconFromBitmap(iconIndex, iconBitmap);
- _vm->_displayMan->blitToViewport(iconBitmap, boxIcon, k8_byteWidth, kM1_ColorNoTransparency, 16);
+ _vm->_displayMan->blitToViewport(iconBitmap, boxIcon, k8_byteWidth, kDMColorNoTransparency, 16);
}
void InventoryMan::buildObjectAttributeString(int16 potentialAttribMask, int16 actualAttribMask, const char **attribStrings, char *destString, const char *prefixString, const char *suffixString) {
@@ -454,7 +454,7 @@ void InventoryMan::drawPanelObjectDescriptionString(const char *descString) {
severalLines = true;
}
- _vm->_textMan->printToViewport(_objDescTextXpos, _objDescTextYpos, k13_ColorLightestGray, stringLine);
+ _vm->_textMan->printToViewport(_objDescTextXpos, _objDescTextYpos, kDMColorLightestGray, stringLine);
_objDescTextYpos += 7;
if (severalLines) {
severalLines = false;
@@ -471,7 +471,7 @@ void InventoryMan::drawPanelArrowOrEye(bool pressingEye) {
DisplayMan &dispMan = *_vm->_displayMan;
dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(pressingEye ? k19_EyeForObjectDescriptionIndice : k18_ArrowForChestContentIndice),
- boxArrowOrEye, k8_byteWidth, k8_ColorRed, 9);
+ boxArrowOrEye, k8_byteWidth, kDMColorRed, 9);
}
void InventoryMan::drawPanelObject(Thing thingToDraw, bool pressingEye) {
@@ -496,9 +496,9 @@ void InventoryMan::drawPanelObject(Thing thingToDraw, bool pressingEye) {
else {
IconIndice iconIndex = objMan.getIconIndex(thingToDraw);
dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k20_PanelEmptyIndice),
- _boxPanel, k72_byteWidth, k8_ColorRed, 73);
+ _boxPanel, k72_byteWidth, kDMColorRed, 73);
dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k29_ObjectDescCircleIndice),
- boxObjectDescCircle, k16_byteWidth, k12_ColorDarkestGray, 27);
+ boxObjectDescCircle, k16_byteWidth, kDMColorDarkestGray, 27);
Common::String descString;
Common::String str;
@@ -525,7 +525,7 @@ void InventoryMan::drawPanelObject(Thing thingToDraw, bool pressingEye) {
descString = objMan._objectNames[iconIndex];
}
- textMan.printToViewport(134, 68, k13_ColorLightestGray, descString.c_str());
+ textMan.printToViewport(134, 68, kDMColorLightestGray, descString.c_str());
drawIconToViewport(iconIndex, 111, 59);
@@ -535,7 +535,7 @@ void InventoryMan::drawPanelObject(Thing thingToDraw, bool pressingEye) {
uint16 actualAttribMask = 0;
switch (thingType) {
case kDMThingTypeWeapon: {
- potentialAttribMask = k0x0008_DescriptionMaskCursed | k0x0002_DescriptionMaskPoisoned | k0x0004_DescriptionMaskBroken;
+ potentialAttribMask = kDMDescriptionMaskCursed | kDMDescriptionMaskPoisoned | kDMDescriptionMaskBroken;
Weapon *weapon = (Weapon *)rawThingPtr;
actualAttribMask = (weapon->getCursed() << 3) | (weapon->getPoisoned() << 1) | (weapon->getBroken() << 2);
if ((iconIndex >= kDMIconIndiceWeaponTorchUnlit)
@@ -558,13 +558,13 @@ void InventoryMan::drawPanelObject(Thing thingToDraw, bool pressingEye) {
break;
}
case kDMThingTypeArmour: {
- potentialAttribMask = k0x0008_DescriptionMaskCursed | k0x0004_DescriptionMaskBroken;
+ potentialAttribMask = kDMDescriptionMaskCursed | kDMDescriptionMaskBroken;
Armour *armour = (Armour *)rawThingPtr;
actualAttribMask = (armour->getCursed() << 3) | (armour->getBroken() << 2);
break;
}
case kDMThingTypePotion: {
- potentialAttribMask = k0x0001_DescriptionMaskConsumable;
+ potentialAttribMask = kDMDescriptionMaskConsumable;
Potion *potion = (Potion *)rawThingPtr;
actualAttribMask = _vm->_dungeonMan->_objectInfos[kDMObjectInfoIndexFirstPotion + potion->getType()].getAllowedSlots();
break;
@@ -615,7 +615,7 @@ void InventoryMan::drawPanelObject(Thing thingToDraw, bool pressingEye) {
drawPanelObjectDescriptionString(str.c_str());
} else {
Junk *junk = (Junk *)rawThingPtr;
- potentialAttribMask = k0x0001_DescriptionMaskConsumable;
+ potentialAttribMask = kDMDescriptionMaskConsumable;
actualAttribMask = _vm->_dungeonMan->_objectInfos[kDMObjectInfoIndexFirstJunk + junk->getType()].getAllowedSlots();
}
break;
@@ -801,7 +801,7 @@ void InventoryMan::drawChampionSkillsAndStatistics() {
closeChest();
uint16 championIndex = _vm->ordinalToIndex(_inventoryChampionOrdinal);
Champion *curChampion = &_vm->_championMan->_champions[championIndex];
- _vm->_displayMan->blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k20_PanelEmptyIndice), _boxPanel, k72_byteWidth, k8_ColorRed, 73);
+ _vm->_displayMan->blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k20_PanelEmptyIndice), _boxPanel, k72_byteWidth, kDMColorRed, 73);
int16 textPosY = 58;
for (uint16 idx = kDMSkillFighter; idx <= kDMSkillWizard; idx++) {
int16 skillLevel = MIN((uint16)16, _vm->_championMan->getSkillLevel(championIndex, idx | kDMIgnoreTemporaryExperience));
@@ -819,25 +819,25 @@ void InventoryMan::drawChampionSkillsAndStatistics() {
displayString = Common::String::format("%s %s", _skillLevelNames[skillLevel - 2], _vm->_championMan->_baseSkillName[idx]);
break;
}
- _vm->_textMan->printToViewport(108, textPosY, k13_ColorLightestGray, displayString.c_str());
+ _vm->_textMan->printToViewport(108, textPosY, kDMColorLightestGray, displayString.c_str());
textPosY += 7;
}
textPosY = 86;
for (uint16 idx = kDMStatStrength; idx <= kDMStatAntifire; idx++) {
- _vm->_textMan->printToViewport(108, textPosY, k13_ColorLightestGray, statisticNames[idx]);
+ _vm->_textMan->printToViewport(108, textPosY, kDMColorLightestGray, statisticNames[idx]);
int16 statisticCurrentValue = curChampion->_statistics[idx][kDMStatCurrent];
uint16 statisticMaximumValue = curChampion->_statistics[idx][kDMStatMaximum];
int16 statisticColor;
if (statisticCurrentValue < statisticMaximumValue)
- statisticColor = k8_ColorRed;
+ statisticColor = kDMColorRed;
else if (statisticCurrentValue > statisticMaximumValue)
- statisticColor = k7_ColorLightGreen;
+ statisticColor = kDMColorLightGreen;
else
- statisticColor = k13_ColorLightestGray;
+ statisticColor = kDMColorLightestGray;
_vm->_textMan->printToViewport(174, textPosY, (Color)statisticColor, _vm->_championMan->getStringFromInteger(statisticCurrentValue, true, 3).c_str());
Common::String displayString = "/" + _vm->_championMan->getStringFromInteger(statisticMaximumValue, true, 3);
- _vm->_textMan->printToViewport(192, textPosY, k13_ColorLightestGray, displayString.c_str());
+ _vm->_textMan->printToViewport(192, textPosY, kDMColorLightestGray, displayString.c_str());
textPosY += 7;
}
}
@@ -877,7 +877,7 @@ void InventoryMan::clickOnMouth() {
};
if (_vm->_championMan->_leaderEmptyHanded) {
- if (_panelContent == k0_PanelContentFoodWaterPoisoned)
+ if (_panelContent == kDMPanelContentFoodWaterPoisoned)
return;
_vm->_eventMan->_ignoreMouseMovements = true;
@@ -1021,7 +1021,7 @@ void InventoryMan::clickOnMouth() {
_vm->_sound->requestPlay(k08_soundSWALLOW, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, kDMSoundModePlayImmediately);
setFlag(curChampion->_attributes, kDMAttributeStatistics);
- if (_panelContent == k0_PanelContentFoodWaterPoisoned)
+ if (_panelContent == kDMPanelContentFoodWaterPoisoned)
setFlag(curChampion->_attributes, kDMAttributePanel);
_vm->_championMan->drawChampionState((ChampionIndex)championIndex);
diff --git a/engines/dm/inventory.h b/engines/dm/inventory.h
index c4685575c2..8819e5b109 100644
--- a/engines/dm/inventory.h
+++ b/engines/dm/inventory.h
@@ -35,21 +35,22 @@
namespace DM {
-#define k0x0001_DescriptionMaskConsumable 0x0001 // @ MASK0x0001_DESCRIPTION_CONSUMABLE
-#define k0x0002_DescriptionMaskPoisoned 0x0002 // @ MASK0x0002_DESCRIPTION_POISONED
-#define k0x0004_DescriptionMaskBroken 0x0004 // @ MASK0x0004_DESCRIPTION_BROKEN
-#define k0x0008_DescriptionMaskCursed 0x0008 // @ MASK0x0008_DESCRIPTION_CURSED
-
-#define k69_ChampionStatusBoxSpacing 69 // @ C69_CHAMPION_STATUS_BOX_SPACING
-#define k38_SlotBoxChestFirstSlot 38 // @ C38_SLOT_BOX_CHEST_FIRST_SLOT
+enum DescriptionMask {
+ kDMDescriptionMaskConsumable = 0x0001, // @ MASK0x0001_DESCRIPTION_CONSUMABLE
+ kDMDescriptionMaskPoisoned = 0x0002, // @ MASK0x0002_DESCRIPTION_POISONED
+ kDMDescriptionMaskBroken = 0x0004, // @ MASK0x0004_DESCRIPTION_BROKEN
+ kDMDescriptionMaskCursed = 0x0008 // @ MASK0x0008_DESCRIPTION_CURSED
+};
enum PanelContent {
- k0_PanelContentFoodWaterPoisoned = 0, // @ C00_PANEL_FOOD_WATER_POISONED
- k2_PanelContentScroll = 2, // @ C02_PANEL_SCROLL
- k4_PanelContentChest = 4, // @ C04_PANEL_CHEST
- k5_PanelContentResurrectReincarnate = 5 // @ C05_PANEL_RESURRECT_REINCARNATE
+ kDMPanelContentFoodWaterPoisoned = 0, // @ C00_PANEL_FOOD_WATER_POISONED
+ kDMPanelContentScroll = 2, // @ C02_PANEL_SCROLL
+ kDMPanelContentChest = 4, // @ C04_PANEL_CHEST
+ kDMPanelContentResurrectReincarnate = 5 // @ C05_PANEL_RESURRECT_REINCARNATE
};
+#define kDMChampionStatusBoxSpacing 69 // @ C69_CHAMPION_STATUS_BOX_SPACING
+
class InventoryMan {
DMEngine *_vm;
@@ -93,7 +94,6 @@ public:
void adjustStatisticCurrentValue(Champion *champ, uint16 statIndex, int16 valueDelta); // @ F0348_INVENTORY_AdjustStatisticCurrentValue
void clickOnEye(); // @ F0352_INVENTORY_ProcessCommand71_ClickOnEye
};
-
}
#endif
diff --git a/engines/dm/loadsave.cpp b/engines/dm/loadsave.cpp
index a0b1190ae2..6e9d98656d 100644
--- a/engines/dm/loadsave.cpp
+++ b/engines/dm/loadsave.cpp
@@ -56,24 +56,19 @@ LoadgameResult DMEngine::loadgame(int16 slot) {
int32 _saveVersion;
OriginalSaveFormat _saveFormat;
OriginalSavePlatform _savePlatform;
-
- int32 _gameId;
uint16 _dungeonId;
} dmSaveHeader;
- if (!_newGameFl) {
- fileName = getSavefileName(slot);
- saveFileManager = _system->getSavefileManager();
- file = saveFileManager->openForLoading(fileName);
- }
-
if (_newGameFl) {
//L1366_B_FadePalette = !F0428_DIALOG_RequireGameDiskInDrive_NoDialogDrawn(C0_DO_NOT_FORCE_DIALOG_DM_CSB, true);
_restartGameAllowed = false;
_championMan->_partyChampionCount = 0;
_championMan->_leaderHandObject = Thing::_none;
- _gameId = ((int32)getRandomNumber(65536)) * getRandomNumber(65536);
} else {
+ fileName = getSavefileName(slot);
+ saveFileManager = _system->getSavefileManager();
+ file = saveFileManager->openForLoading(fileName);
+
SaveGameHeader header;
readSaveGameHeader(file, &header);
@@ -83,10 +78,10 @@ LoadgameResult DMEngine::loadgame(int16 slot) {
dmSaveHeader._saveVersion = file->readSint32BE();
dmSaveHeader._saveFormat = (OriginalSaveFormat)file->readSint32BE();
dmSaveHeader._savePlatform = (OriginalSavePlatform)file->readSint32BE();
- dmSaveHeader._gameId = file->readSint32BE();
- dmSaveHeader._dungeonId = file->readUint16BE();
- _gameId = dmSaveHeader._gameId;
+ // Skip _gameId, which was useless
+ file->readSint32BE();
+ dmSaveHeader._dungeonId = file->readUint16BE();
_gameTime = file->readSint32BE();
// G0349_ul_LastRandomNumber = L1371_s_GlobalData.LastRandomNumber;
@@ -121,6 +116,8 @@ LoadgameResult DMEngine::loadgame(int16 slot) {
// read sentinel
uint32 sentinel = file->readUint32BE();
assert(sentinel == 0x6f85e3d3);
+
+ _dungeonId = dmSaveHeader._dungeonId;
}
_dungeonMan->loadDungeonFile(file);
@@ -133,25 +130,22 @@ LoadgameResult DMEngine::loadgame(int16 slot) {
if (fadePalette) {
_displayMan->startEndFadeToPalette(_displayMan->_blankBuffer);
delay(1);
- _displayMan->fillScreen(k0_ColorBlack);
+ _displayMan->fillScreen(kDMColorBlack);
_displayMan->startEndFadeToPalette(_displayMan->_paletteTopAndBottomScreen);
}
} else {
- _dungeonId = dmSaveHeader._dungeonId;
-
_restartGameAllowed = true;
switch (getGameLanguage()) { // localized
- default:
- case Common::EN_ANY:
- _dialog->dialogDraw(nullptr, "LOADING GAME . . .", nullptr, nullptr, nullptr, nullptr, true, true, true);
- break;
case Common::DE_DEU:
_dialog->dialogDraw(nullptr, "SPIEL WIRD GELADEN . . .", nullptr, nullptr, nullptr, nullptr, true, true, true);
break;
case Common::FR_FRA:
_dialog->dialogDraw(nullptr, "CHARGEMENT DU JEU . . .", nullptr, nullptr, nullptr, nullptr, true, true, true);
break;
+ default:
+ _dialog->dialogDraw(nullptr, "LOADING GAME . . .", nullptr, nullptr, nullptr, nullptr, true, true, true);
+ break;
}
}
_championMan->_partyDead = false;
@@ -298,7 +292,9 @@ bool DMEngine::writeCompleteSaveFile(int16 saveSlot, Common::String& saveDescrip
file->writeSint32BE(1); // save version
file->writeSint32BE(_gameVersion->_origSaveFormatToWrite);
file->writeSint32BE(_gameVersion->_origPlatformToWrite);
- file->writeSint32BE(_gameId);
+
+ // Was _gameID, useless.
+ file->writeSint32BE(0);
file->writeUint16BE(_dungeonId);
// write C0_SAVE_PART_GLOBAL_DATA part
diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp
index faf61393ce..894bf658a9 100644
--- a/engines/dm/menus.cpp
+++ b/engines/dm/menus.cpp
@@ -168,7 +168,7 @@ MenuMan::~MenuMan() {
void MenuMan::drawMovementArrows() {
_vm->_eventMan->showMouse();
_vm->_displayMan->blitToScreen(_vm->_displayMan->getNativeBitmapOrGraphic(k13_MovementArrowsIndice),
- &_vm->_displayMan->_boxMovementArrows, k48_byteWidth, kM1_ColorNoTransparency, 45);
+ &_vm->_displayMan->_boxMovementArrows, k48_byteWidth, kDMColorNoTransparency, 45);
_vm->_eventMan->hideMouse();
}
void MenuMan::clearActingChampion() {
@@ -191,13 +191,13 @@ void MenuMan::drawActionIcon(ChampionIndex championIndex) {
Champion &champion = _vm->_championMan->_champions[championIndex];
Box box;
- box._x1 = championIndex * 22 + 233;
- box._x2 = box._x1 + 19;
- box._y1 = 86;
- box._y2 = 120;
+ box._rect.left = championIndex * 22 + 233;
+ box._rect.right = box._rect.left + 19;
+ box._rect.top = 86;
+ box._rect.bottom = 120;
dm._useByteBoxCoordinates = false;
if (!champion._currHealth) {
- dm.fillScreenBox(box, k0_ColorBlack);
+ dm.fillScreenBox(box, kDMColorBlack);
return;
}
byte *bitmapIcon = dm._tmpBitmap;
@@ -208,21 +208,21 @@ void MenuMan::drawActionIcon(ChampionIndex championIndex) {
} else if (_vm->_dungeonMan->_objectInfos[_vm->_dungeonMan->getObjectInfoIndex(thing)]._actionSetIndex) {
iconIndex = _vm->_objectMan->getIconIndex(thing);
} else {
- dm.fillBitmap(bitmapIcon, k4_ColorCyan, 16, 16);
+ dm.fillBitmap(bitmapIcon, kDMColorCyan, 16, 16);
goto T0386006;
}
_vm->_objectMan->extractIconFromBitmap(iconIndex, bitmapIcon);
dm.blitToBitmapShrinkWithPalChange(bitmapIcon, bitmapIcon, 16, 16, 16, 16, palChangesActionAreaObjectIcon);
T0386006:
- dm.fillScreenBox(box, k4_ColorCyan);
+ dm.fillScreenBox(box, kDMColorCyan);
Box box2;
- box2._x1 = box._x1 + 2;
- box2._x2 = box._x2 - 2;
- box2._y1 = 95;
- box2._y2 = 110;
- dm.blitToScreen(bitmapIcon, &box2, k8_byteWidth, kM1_ColorNoTransparency, 16);
+ box2._rect.left = box._rect.left + 2;
+ box2._rect.right = box._rect.right - 2;
+ box2._rect.top = 95;
+ box2._rect.bottom = 110;
+ dm.blitToScreen(bitmapIcon, &box2, k8_byteWidth, kDMColorNoTransparency, 16);
if (champion.getAttributes(kDMAttributeDisableAction) || _vm->_championMan->_candidateChampionOrdinal || _vm->_championMan->_partyIsSleeping) {
- _vm->_displayMan->shadeScreenBox(&box, k0_ColorBlack);
+ _vm->_displayMan->shadeScreenBox(&box, kDMColorBlack);
}
}
@@ -231,14 +231,14 @@ void MenuMan::drawDisabledMenu() {
_vm->_eventMan->highlightBoxDisable();
_vm->_displayMan->_useByteBoxCoordinates = false;
if (_vm->_inventoryMan->_inventoryChampionOrdinal) {
- if (_vm->_inventoryMan->_panelContent == k4_PanelContentChest) {
+ if (_vm->_inventoryMan->_panelContent == kDMPanelContentChest) {
_vm->_inventoryMan->closeChest();
}
} else {
- _vm->_displayMan->shadeScreenBox(&_vm->_displayMan->_boxMovementArrows, k0_ColorBlack);
+ _vm->_displayMan->shadeScreenBox(&_vm->_displayMan->_boxMovementArrows, kDMColorBlack);
}
- _vm->_displayMan->shadeScreenBox(&_boxSpellArea, k0_ColorBlack);
- _vm->_displayMan->shadeScreenBox(&_boxActionArea, k0_ColorBlack);
+ _vm->_displayMan->shadeScreenBox(&_boxSpellArea, kDMColorBlack);
+ _vm->_displayMan->shadeScreenBox(&_boxActionArea, kDMColorBlack);
_vm->_eventMan->setMousePointerToNormal(k0_pointerArrow);
}
}
@@ -305,7 +305,7 @@ void MenuMan::drawActionArea() {
_vm->_eventMan->hideMouse();
dispMan._useByteBoxCoordinates = false;
- dispMan.fillScreenBox(_boxActionArea, k0_ColorBlack);
+ dispMan.fillScreenBox(_boxActionArea, kDMColorBlack);
if (_actionAreaContainsIcons) {
for (uint16 champIndex = kDMChampionFirst; champIndex < champMan._partyChampionCount; ++champIndex)
drawActionIcon((ChampionIndex)champIndex);
@@ -316,12 +316,12 @@ void MenuMan::drawActionArea() {
if (_actionList._actionIndices[1] == kDMActionNone)
box = _boxActionArea1ActionMenu;
dispMan.blitToScreen(_vm->_displayMan->getNativeBitmapOrGraphic(k10_MenuActionAreaIndice),
- &box, k48_byteWidth, kM1_ColorNoTransparency, 45);
+ &box, k48_byteWidth, kDMColorNoTransparency, 45);
textMan.printWithTrailingSpaces(dispMan._bitmapScreen, k160_byteWidthScreen,
- 235, 83, k0_ColorBlack, k4_ColorCyan, champMan._champions[_vm->ordinalToIndex(champMan._actingChampionOrdinal)]._name,
+ 235, 83, kDMColorBlack, kDMColorCyan, champMan._champions[_vm->ordinalToIndex(champMan._actingChampionOrdinal)]._name,
k7_ChampionNameMaximumLength, k200_heightScreen);
for (uint16 actionListIndex = 0; actionListIndex < 3; actionListIndex++) {
- textMan.printWithTrailingSpaces(dispMan._bitmapScreen, k160_byteWidthScreen, 241, 93 + actionListIndex * 12, k4_ColorCyan, k0_ColorBlack,
+ textMan.printWithTrailingSpaces(dispMan._bitmapScreen, k160_byteWidthScreen, 241, 93 + actionListIndex * 12, kDMColorCyan, kDMColorBlack,
getActionName(_actionList._actionIndices[actionListIndex]),
k12_ActionNameMaximumLength, k200_heightScreen);
}
@@ -355,12 +355,12 @@ void MenuMan::drawSpellAreaControls(ChampionIndex champIndex) {
int16 champHP2 = _vm->_championMan->_champions[2]._currHealth;
int16 champHP3 = _vm->_championMan->_champions[3]._currHealth;
_vm->_eventMan->showMouse();
- _vm->_displayMan->fillScreenBox(boxSpellAreaControls, k0_ColorBlack);
+ _vm->_displayMan->fillScreenBox(boxSpellAreaControls, kDMColorBlack);
switch (champIndex) {
case 0:
_vm->_eventMan->highlightScreenBox(233, 277, 42, 49);
- _vm->_textMan->printToLogicalScreen(235, 48, k0_ColorBlack, k4_ColorCyan, champ->_name);
+ _vm->_textMan->printToLogicalScreen(235, 48, kDMColorBlack, kDMColorCyan, champ->_name);
if (_vm->_championMan->_partyChampionCount > 1) {
if (champHP1)
_vm->_eventMan->highlightScreenBox(280, 291, 42, 48);
@@ -379,7 +379,7 @@ void MenuMan::drawSpellAreaControls(ChampionIndex champIndex) {
_vm->_eventMan->highlightScreenBox(233, 244, 42, 48);
_vm->_eventMan->highlightScreenBox(247, 291, 42, 49);
- _vm->_textMan->printToLogicalScreen(249, 48, k0_ColorBlack, k4_ColorCyan, champ->_name);
+ _vm->_textMan->printToLogicalScreen(249, 48, kDMColorBlack, kDMColorCyan, champ->_name);
if (_vm->_championMan->_partyChampionCount > 2) {
if (champHP2)
_vm->_eventMan->highlightScreenBox(294, 305, 42, 48);
@@ -396,7 +396,7 @@ void MenuMan::drawSpellAreaControls(ChampionIndex champIndex) {
_vm->_eventMan->highlightScreenBox(247, 258, 42, 48);
_vm->_eventMan->highlightScreenBox(261, 305, 42, 49);
- _vm->_textMan->printToLogicalScreen(263, 48, k0_ColorBlack, k4_ColorCyan, champ->_name);
+ _vm->_textMan->printToLogicalScreen(263, 48, kDMColorBlack, kDMColorCyan, champ->_name);
if ((_vm->_championMan->_partyChampionCount > 3) && champHP3)
_vm->_eventMan->highlightScreenBox(308, 319, 42, 48);
break;
@@ -412,7 +412,7 @@ void MenuMan::drawSpellAreaControls(ChampionIndex champIndex) {
_vm->_eventMan->highlightScreenBox(261, 272, 42, 48);
_vm->_eventMan->highlightScreenBox(275, 319, 42, 49);
- _vm->_textMan->printToLogicalScreen(277, 48, k0_ColorBlack, k4_ColorCyan, champ->_name);
+ _vm->_textMan->printToLogicalScreen(277, 48, kDMColorBlack, kDMColorCyan, champ->_name);
break;
default:
break;
@@ -427,23 +427,23 @@ void MenuMan::buildSpellAreaLine(int16 spellAreaBitmapLine) {
Champion *magicChampion = &_vm->_championMan->_champions[_vm->_championMan->_magicCasterChampionIndex];
if (spellAreaBitmapLine == k2_SpellAreaAvailableSymbols) {
_vm->_displayMan->_useByteBoxCoordinates = false;
- _vm->_displayMan->blitToBitmap(_bitmapSpellAreaLines, _bitmapSpellAreaLine, boxSpellAreaLine, 0, 12, k48_byteWidth, k48_byteWidth, kM1_ColorNoTransparency, 36, 12);
+ _vm->_displayMan->blitToBitmap(_bitmapSpellAreaLines, _bitmapSpellAreaLine, boxSpellAreaLine, 0, 12, k48_byteWidth, k48_byteWidth, kDMColorNoTransparency, 36, 12);
int16 x = 1;
char character = 96 + (6 * magicChampion->_symbolStep);
for (uint16 symbolIndex = 0; symbolIndex < 6; symbolIndex++) {
spellSymbolString[0] = character++;
x += 14;
- _vm->_textMan->printTextToBitmap(_bitmapSpellAreaLine, 48, x, 8, k4_ColorCyan, k0_ColorBlack, spellSymbolString, 12);
+ _vm->_textMan->printTextToBitmap(_bitmapSpellAreaLine, 48, x, 8, kDMColorCyan, kDMColorBlack, spellSymbolString, 12);
}
} else if (spellAreaBitmapLine == k3_SpellAreaChampionSymbols) {
_vm->_displayMan->_useByteBoxCoordinates = false;
- _vm->_displayMan->blitToBitmap(_bitmapSpellAreaLines, _bitmapSpellAreaLine, boxSpellAreaLine, 0, 24, k48_byteWidth, k48_byteWidth, kM1_ColorNoTransparency, 36, 12);
+ _vm->_displayMan->blitToBitmap(_bitmapSpellAreaLines, _bitmapSpellAreaLine, boxSpellAreaLine, 0, 24, k48_byteWidth, k48_byteWidth, kDMColorNoTransparency, 36, 12);
int16 x = 8;
for (uint16 symbolIndex = 0; symbolIndex < 4; symbolIndex++) {
if ((spellSymbolString[0] = magicChampion->_symbols[symbolIndex]) == '\0')
break;
x += 9;
- _vm->_textMan->printTextToBitmap(_bitmapSpellAreaLine, 48, x, 8, k4_ColorCyan, k0_ColorBlack, spellSymbolString, 12);
+ _vm->_textMan->printTextToBitmap(_bitmapSpellAreaLine, 48, x, 8, kDMColorCyan, kDMColorBlack, spellSymbolString, 12);
}
}
}
@@ -458,14 +458,14 @@ void MenuMan::setMagicCasterAndDrawSpellArea(ChampionIndex champIndex) {
if (_vm->_championMan->_magicCasterChampionIndex == kDMChampionNone) {
_vm->_eventMan->showMouse();
- _vm->_displayMan->blitToScreen(_vm->_displayMan->getNativeBitmapOrGraphic(k9_MenuSpellAreaBackground), &_boxSpellArea, k48_byteWidth, kM1_ColorNoTransparency, 33);
+ _vm->_displayMan->blitToScreen(_vm->_displayMan->getNativeBitmapOrGraphic(k9_MenuSpellAreaBackground), &_boxSpellArea, k48_byteWidth, kDMColorNoTransparency, 33);
_vm->_eventMan->hideMouse();
}
if (champIndex == kDMChampionNone) {
_vm->_championMan->_magicCasterChampionIndex = kDMChampionNone;
_vm->_eventMan->showMouse();
_vm->_displayMan->_useByteBoxCoordinates = false;
- _vm->_displayMan->fillScreenBox(_boxSpellArea, k0_ColorBlack);
+ _vm->_displayMan->fillScreenBox(_boxSpellArea, kDMColorBlack);
_vm->_eventMan->hideMouse();
return;
}
@@ -473,9 +473,9 @@ void MenuMan::setMagicCasterAndDrawSpellArea(ChampionIndex champIndex) {
buildSpellAreaLine(k2_SpellAreaAvailableSymbols);
_vm->_eventMan->showMouse();
drawSpellAreaControls(champIndex);
- _vm->_displayMan->blitToScreen(_bitmapSpellAreaLine, &boxSpellAreaLine2, k48_byteWidth, kM1_ColorNoTransparency, 12);
+ _vm->_displayMan->blitToScreen(_bitmapSpellAreaLine, &boxSpellAreaLine2, k48_byteWidth, kDMColorNoTransparency, 12);
buildSpellAreaLine(k3_SpellAreaChampionSymbols);
- _vm->_displayMan->blitToScreen(_bitmapSpellAreaLine, &boxSpellAreaLine3, k48_byteWidth, kM1_ColorNoTransparency, 12);
+ _vm->_displayMan->blitToScreen(_bitmapSpellAreaLine, &boxSpellAreaLine3, k48_byteWidth, kDMColorNoTransparency, 12);
_vm->_eventMan->hideMouse();
}
@@ -762,7 +762,7 @@ void MenuMan::menusPrintSpellFailureMessage(Champion *champ, uint16 failureType,
skillIndex = (skillIndex - 4) / 4;
_vm->_textMan->printLineFeed();
- _vm->_textMan->printMessage(k4_ColorCyan, champ->_name);
+ _vm->_textMan->printMessage(kDMColorCyan, champ->_name);
Common::String *messages;
switch (_vm->getGameLanguage()) { // localized
@@ -780,8 +780,8 @@ void MenuMan::menusPrintSpellFailureMessage(Champion *champ, uint16 failureType,
Common::String message;
switch (failureType) {
case kDMFailureNeedsMorePractice:
- _vm->_textMan->printMessage(k4_ColorCyan, messages[0].c_str());
- _vm->_textMan->printMessage(k4_ColorCyan, _vm->_championMan->_baseSkillName[skillIndex]);
+ _vm->_textMan->printMessage(kDMColorCyan, messages[0].c_str());
+ _vm->_textMan->printMessage(kDMColorCyan, _vm->_championMan->_baseSkillName[skillIndex]);
if (_vm->getGameLanguage() != Common::FR_FRA || skillIndex == kDMSkillWizard)
message = messages[1];
else
@@ -797,7 +797,7 @@ void MenuMan::menusPrintSpellFailureMessage(Champion *champ, uint16 failureType,
default:
break;
}
- _vm->_textMan->printMessage(k4_ColorCyan, message.c_str());
+ _vm->_textMan->printMessage(kDMColorCyan, message.c_str());
}
Potion *MenuMan::getEmptyFlaskInHand(Champion *champ, Thing *potionThing) {
@@ -865,7 +865,7 @@ void MenuMan::drawAvailableSymbols(uint16 symbolStep) {
for (uint16 L1214_ui_Counter = 0; L1214_ui_Counter < 6; L1214_ui_Counter++) {
displayBuffer[0] = curCharacter++;
textPosX += 14;
- _vm->_textMan->printToLogicalScreen(textPosX, 58, k4_ColorCyan, k0_ColorBlack, displayBuffer);
+ _vm->_textMan->printToLogicalScreen(textPosX, 58, kDMColorCyan, kDMColorBlack, displayBuffer);
}
}
@@ -882,7 +882,7 @@ void MenuMan::drawChampionSymbols(Champion *champ) {
displayBuffer[0] = champ->_symbols[symbolIndex];
textPosX += 9;
- _vm->_textMan->printToLogicalScreen(textPosX, 70, k4_ColorCyan, k0_ColorBlack, displayBuffer);
+ _vm->_textMan->printToLogicalScreen(textPosX, 70, kDMColorCyan, kDMColorBlack, displayBuffer);
}
}
@@ -1491,9 +1491,9 @@ bool MenuMan::isMeleeActionPerformed(int16 champIndex, Champion *champ, int16 ac
if (targetCreatureOrdinal) {
uint16 viewCell = _vm->normalizeModulo4(championCell + 4 - champ->_dir);
switch (viewCell) {
- case k2_ViewCellBackRight: /* Champion is on the back right of the square and tries to attack a creature in the front right of its square */
- case k3_ViewCellBackLeft: /* Champion is on the back left of the square and tries to attack a creature in the front left of its square */
- uint16 cellDelta = (viewCell == k2_ViewCellBackRight) ? 3 : 1;
+ case kDMViewCellBackRight: /* Champion is on the back right of the square and tries to attack a creature in the front right of its square */
+ case kDMViewCellBackLeft: /* Champion is on the back left of the square and tries to attack a creature in the front left of its square */
+ uint16 cellDelta = (viewCell == kDMViewCellBackRight) ? 3 : 1;
/* Check if there is another champion in front */
if (_vm->_championMan->getIndexInCell(_vm->normalizeModulo4(championCell + cellDelta)) != kDMChampionNone) {
_actionDamage = kM1_damageCantReach;
@@ -1502,7 +1502,7 @@ bool MenuMan::isMeleeActionPerformed(int16 champIndex, Champion *champ, int16 ac
break;
}
- if ((actionIndex == kDMActionDisrupt) && !getFlag(_vm->_dungeonMan->getCreatureAttributes(_actionTargetGroupThing), k0x0040_MaskCreatureInfo_nonMaterial))
+ if ((actionIndex == kDMActionDisrupt) && !getFlag(_vm->_dungeonMan->getCreatureAttributes(_actionTargetGroupThing), kDMCreatureMaskNonMaterial))
return false;
uint16 actionHitProbability = actionHitProbabilityArray[actionIndex];
@@ -1551,15 +1551,15 @@ bool MenuMan::isGroupFrightenedByAction(int16 champIndex, uint16 actionIndex, in
Group *targetGroup = (Group *)_vm->_dungeonMan->getThingData(_actionTargetGroupThing);
CreatureInfo *creatureInfo = &_vm->_dungeonMan->_creatureInfos[targetGroup->_type];
uint16 fearResistance = creatureInfo->getFearResistance();
- if ((fearResistance > _vm->getRandomNumber(frightAmount)) || (fearResistance == k15_immuneToFear)) {
+ if ((fearResistance > _vm->getRandomNumber(frightAmount)) || (fearResistance == kDMImmuneToFear)) {
experience >>= 1;
} else {
ActiveGroup *activeGroup = &_vm->_groupMan->_activeGroups[targetGroup->getActiveGroupIndex()];
- if (targetGroup->getBehaviour() == k6_behavior_ATTACK) {
+ if (targetGroup->getBehaviour() == kDMBehaviorAttack) {
_vm->_groupMan->stopAttacking(activeGroup, mapX, mapY);
_vm->_groupMan->startWandering(mapX, mapY);
}
- targetGroup->setBehaviour(k5_behavior_FLEE);
+ targetGroup->setBehaviour(kDMBehaviorFlee);
activeGroup->_delayFleeingFromTarget = ((16 - fearResistance) << 2) / creatureInfo->_movementTicks;
retVal = true;
}
@@ -1593,7 +1593,7 @@ void MenuMan::printMessageAfterReplacements(const char *str) {
*curCharacter = '\0';
if (outputString[1]) /* If the string is not empty (the first character is a new line \n) */
- _vm->_textMan->printMessage(k4_ColorCyan, outputString);
+ _vm->_textMan->printMessage(kDMColorCyan, outputString);
}
void MenuMan::processCommands116To119_setActingChampion(uint16 champIndex) {
@@ -1718,7 +1718,7 @@ void MenuMan::drawActionDamage(int16 damage) {
_vm->_eventMan->showMouse();
_vm->_displayMan->_useByteBoxCoordinates = false;
- _vm->_displayMan->fillScreenBox(_boxActionArea, k0_ColorBlack);
+ _vm->_displayMan->fillScreenBox(_boxActionArea, kDMColorBlack);
if (damage < 0) {
static const char *messagesEN[2] = {"CAN'T REACH", "NEED AMMO"};
static const char *messagesDE[2] = {"ZU WEIT WEG", "MEHR MUNITION"};
@@ -1752,7 +1752,7 @@ void MenuMan::drawActionDamage(int16 damage) {
textPosX = pos[1];
displayString = message[1];
}
- _vm->_textMan->printToLogicalScreen(textPosX, 100, k4_ColorCyan, k0_ColorBlack, displayString);
+ _vm->_textMan->printToLogicalScreen(textPosX, 100, kDMColorCyan, kDMColorBlack, displayString);
} else {
int16 byteWidth;
byte *blitBitmap;
@@ -1767,12 +1767,12 @@ void MenuMan::drawActionDamage(int16 damage) {
uint16 derivedBitmapIndex;
int16 destPixelWidth;
if (damage > 15) {
- derivedBitmapIndex = k2_DerivedBitmapDamageToCreatureMedium;
+ derivedBitmapIndex = kDMDerivedBitmapDamageToCreatureMedium;
destPixelWidth = 64;
byteWidth = k32_byteWidth;
blitBox = &actionAreaMediumDamage;
} else {
- derivedBitmapIndex = k3_DerivedBitmapDamageToCreatureSmall;
+ derivedBitmapIndex = kDMDerivedBitmapDamageToCreatureSmall;
destPixelWidth = 42;
byteWidth = k24_byteWidth;
blitBox = &actionAreaSmallDamage;
@@ -1787,7 +1787,7 @@ void MenuMan::drawActionDamage(int16 damage) {
blitBitmap = _vm->_displayMan->getDerivedBitmap(derivedBitmapIndex);
}
}
- _vm->_displayMan->blitToScreen(blitBitmap, blitBox, byteWidth, kM1_ColorNoTransparency, displayHeight);
+ _vm->_displayMan->blitToScreen(blitBitmap, blitBox, byteWidth, kDMColorNoTransparency, displayHeight);
/* Convert damage value to string */
uint16 charIndex = 5;
int16 textPosX = 274;
@@ -1797,7 +1797,7 @@ void MenuMan::drawActionDamage(int16 damage) {
scoreString[--charIndex] = '0' + (damage % 10);
textPosX -= 3;
} while (damage /= 10);
- _vm->_textMan->printToLogicalScreen(textPosX, 100, k4_ColorCyan, k0_ColorBlack, &scoreString[charIndex]);
+ _vm->_textMan->printToLogicalScreen(textPosX, 100, kDMColorCyan, kDMColorBlack, &scoreString[charIndex]);
}
_vm->_eventMan->hideMouse();
}
diff --git a/engines/dm/movesens.cpp b/engines/dm/movesens.cpp
index 37ae1382aa..d22db51cfa 100644
--- a/engines/dm/movesens.cpp
+++ b/engines/dm/movesens.cpp
@@ -442,7 +442,8 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM
createEventMoveGroup(thing, destMapX, destMapY, mapIndexDestination, audibleTeleporter);
return true; /* The specified group thing cannot be moved because the party or another group is on the destination square */
}
- uint16 movementSoundIndex = getSound(((Group *)_vm->_dungeonMan->_thingData[kDMThingTypeGroup])[thing.getIndex()]._type);
+ Group *tmpGroup = (Group *)_vm->_dungeonMan->_thingData[kDMThingTypeGroup];
+ uint16 movementSoundIndex = getSound((CreatureType)tmpGroup[thing.getIndex()]._type);
if (movementSoundIndex < k34_D13_soundCount)
_vm->_sound->requestPlay(movementSoundIndex, destMapX, destMapY, kDMSoundModePlayIfPrioritized);
@@ -486,7 +487,7 @@ bool MovesensMan::isLevitating(Thing thing) {
ThingType thingType = thing.getType();
bool retVal = false;
if (thingType == kDMThingTypeGroup)
- retVal = getFlag(_vm->_dungeonMan->getCreatureAttributes(thing), k0x0020_MaskCreatureInfo_levitation);
+ retVal = getFlag(_vm->_dungeonMan->getCreatureAttributes(thing), kDMCreatureMaskLevitation);
else if ((thingType == kDMThingTypeProjectile) || (thingType == kDMThingTypeExplosion))
// Fix original bug involving explosions falling in pits
retVal = true;
@@ -594,45 +595,45 @@ void MovesensMan::addEvent(byte type, byte mapX, byte mapY, Cell cell, SensorEff
_vm->_timeline->addEventGetEventIndex(&newEvent);
}
-int16 MovesensMan::getSound(byte creatureType) {
+int16 MovesensMan::getSound(CreatureType creatureType) {
if (_vm->_championMan->_partyIsSleeping)
return 35;
switch (creatureType) {
- case k3_CreatureTypeWizardEyeFlyingEye:
- case k8_CreatureTypeGhostRive:
- case k11_CreatureTypeBlackFlame:
- case k19_CreatureTypeMaterializerZytaz:
- case k23_CreatureTypeLordChaos:
- case k25_CreatureTypeLordOrder:
- case k26_CreatureTypeGreyLord:
+ case kDMCreatureTypeWizardEye:
+ case kDMCreatureTypeGhostRive:
+ case kDMCreatureTypeBlackFlame:
+ case kDMCreatureTypeMaterializerZytaz:
+ case kDMCreatureTypeLordChaos:
+ case kDMCreatureTypeLordOrder:
+ case kDMCreatureTypeGreyLord:
return 35;
- case k2_CreatureTypeGiggler:
- case k9_CreatureTypeStoneGolem:
- case k10_CreatureTypeMummy:
- case k14_CreatureTypeVexirk:
- case k16_CreatureTypeTrolinAntman:
- case k22_CreatureTypeDemon:
+ case kDMCreatureTypeGiggler:
+ case kDMCreatureTypeStoneGolem:
+ case kDMCreatureTypeMummy:
+ case kDMCreatureTypeVexirk:
+ case kDMCreatureTypeAntman:
+ case kDMCreatureTypeDemon:
return k24_soundMOVE_MUMMY_TROLIN_ANTMAN_STONE_GOLEM_GIGGLER_VEXIRK_DEMON;
- case k0_CreatureTypeGiantScorpionScorpion:
- case k4_CreatureTypePainRatHellHound:
- case k5_CreatureTypeRuster:
- case k6_CreatureTypeScreamer:
- case k7_CreatureTypeRockpile:
- case k15_CreatureTypeMagnetaWormWorm:
- case k21_CreatureTypeOitu:
+ case kDMCreatureTypeGiantScorpion:
+ case kDMCreatureTypePainRat:
+ case kDMCreatureTypeRuster:
+ case kDMCreatureTypeScreamer:
+ case kDMCreatureTypeRockpile:
+ case kDMCreatureTypeMagentaWorm:
+ case kDMCreatureTypeOitu:
return k26_soundMOVE_SCREAMER_ROCK_ROCKPILE_MAGENTA_WORM_WORM_PAIN_RAT_HELLHOUND_RUSTER_GIANT_SCORPION_SCORPION_OITU;
- case k24_CreatureTypeRedDragon:
+ case kDMCreatureTypeRedDragon:
return k32_soundMOVE_RED_DRAGON;
- case k12_CreatureTypeSkeleton:
+ case kDMCreatureTypeSkeleton:
return k33_soundMOVE_SKELETON;
- case k18_CreatureTypeAnimatedArmourDethKnight:
+ case kDMCreatureTypeAnimatedArmour:
return k22_soundMOVE_ANIMATED_ARMOUR_DETH_KNIGHT;
- case k1_CreatureTypeSwampSlimeSlime:
- case k20_CreatureTypeWaterElemental:
+ case kDMCreatureTypeSwampSlime:
+ case kDMCreatureTypeWaterElemental:
return k27_soundMOVE_SWAMP_SLIME_SLIME_DEVIL_WATER_ELEMENTAL;
- case k13_CreatureTypeCouatl:
- case k17_CreatureTypeGiantWaspMuncher:
+ case kDMCreatureTypeCouatl:
+ case kDMCreatureTypeGiantWasp:
return k23_soundMOVE_COUATL_GIANT_WASP_MUNCHER;
}
@@ -652,13 +653,13 @@ int16 MovesensMan::getTeleporterRotatedGroupResult(Teleporter *teleporter, Thing
updatedGroupDirections = _vm->normalizeModulo4(groupDirections + rotation);
uint16 updatedGroupCells = _vm->_groupMan->getGroupCells(group, mapIndex);
- if (updatedGroupCells != k255_CreatureTypeSingleCenteredCreature) {
+ if (updatedGroupCells != kDMCreatureTypeSingleCenteredCreature) {
int16 groupCells = updatedGroupCells;
- int16 creatureSize = getFlag(_vm->_dungeonMan->_creatureInfos[group->_type]._attributes, k0x0003_MaskCreatureInfo_size);
+ int16 creatureSize = getFlag(_vm->_dungeonMan->_creatureInfos[group->_type]._attributes, kDMCreatureMaskSize);
int16 relativeRotation = _vm->normalizeModulo4(4 + updatedGroupDirections - groupDirections);
for (int16 creatureIdx = 0; creatureIdx <= group->getCount(); creatureIdx++) {
updatedGroupDirections = _vm->_groupMan->getGroupValueUpdatedWithCreatureValue(updatedGroupDirections, creatureIdx, absoluteRotation ? (uint16)rotation : _vm->normalizeModulo4(groupDirections + rotation));
- if (creatureSize == k0_MaskCreatureSizeQuarter) {
+ if (creatureSize == kDMCreatureSizeQuarter) {
relativeRotation = absoluteRotation ? 1 : 0;
if (relativeRotation)
relativeRotation = rotation;
@@ -672,7 +673,7 @@ int16 MovesensMan::getTeleporterRotatedGroupResult(Teleporter *teleporter, Thing
}
_vm->_dungeonMan->setGroupDirections(group, updatedGroupDirections, mapIndex);
_vm->_dungeonMan->setGroupCells(group, updatedGroupCells, mapIndex);
- if ((mapIndex == _vm->_dungeonMan->_partyMapIndex) && (group->setBehaviour(k6_behavior_ATTACK)))
+ if ((mapIndex == _vm->_dungeonMan->_partyMapIndex) && (group->setBehaviour(kDMBehaviorAttack)))
return group->getActiveGroupIndex() + 2;
return 1;
@@ -724,7 +725,7 @@ void MovesensMan::processThingAdditionOrRemoval(uint16 mapX, uint16 mapY, Thing
squareContainsGroup = true;
else if ((curThingType == kDMstringTypeText) && (thingType == kDMThingTypeParty) && addThing && !partySquare) {
_vm->_dungeonMan->decodeText(_vm->_stringBuildBuffer, curThing, kDMTextTypeMessage);
- _vm->_textMan->printMessage(k15_ColorWhite, _vm->_stringBuildBuffer);
+ _vm->_textMan->printMessage(kDMColorWhite, _vm->_stringBuildBuffer);
} else if ((curThingType > kDMThingTypeGroup) && (curThingType < kDMThingTypeProjectile)) {
squareContainsObject = true;
squareContainsThingOfSameType |= (_vm->_objectMan->getObjectType(curThing) == objectType);
diff --git a/engines/dm/movesens.h b/engines/dm/movesens.h
index f82ad186a3..5d2787fc0b 100644
--- a/engines/dm/movesens.h
+++ b/engines/dm/movesens.h
@@ -30,7 +30,7 @@
#define DM_MOVESENS_H
#include "dm/dm.h"
-
+#include "dm/group.h"
enum SensorEffect {
kDMSensorEffectNone = -1, // @ CM1_EFFECT_NONE
kDMSensorEffectSet = 0, // @ C00_EFFECT_SET
@@ -65,7 +65,7 @@ public:
bool isLevitating(Thing thing); // @ F0264_MOVE_IsLevitating
bool moveIsKilledByProjectileImpact(int16 srcMapX, int16 srcMapY, int16 destMapX, int16 destMapY, Thing thing); // @ F0266_MOVE_IsKilledByProjectileImpact
void addEvent(byte type, byte mapX, byte mapY, Cell cell, SensorEffect effect, int32 time); // @ F0268_SENSOR_AddEvent
- int16 getSound(byte creatureType); // @ F0514_MOVE_GetSound
+ int16 getSound(CreatureType creatureType); // @ F0514_MOVE_GetSound
int16 getTeleporterRotatedGroupResult(Teleporter *teleporter, Thing thing, uint16 mapIndex);// @ F0262_MOVE_GetTeleporterRotatedGroupResult
Thing getTeleporterRotatedProjectileThing(Teleporter *teleporter, Thing projectileThing); // @ F0263_MOVE_GetTeleporterRotatedProjectileThing
void processThingAdditionOrRemoval(uint16 mapX, uint16 mapY, Thing thing, bool partySquare, bool addThing);// @ F0276_SENSOR_ProcessThingAdditionOrRemoval
diff --git a/engines/dm/objectman.cpp b/engines/dm/objectman.cpp
index ffab2392c3..5b3407b42a 100644
--- a/engines/dm/objectman.cpp
+++ b/engines/dm/objectman.cpp
@@ -195,7 +195,7 @@ void ObjectMan::extractIconFromBitmap(uint16 iconIndex, byte *destBitmap) {
iconIndex -= _iconGraphicFirstIndex[counter];
_vm->_displayMan->_useByteBoxCoordinates = true;
Box blitBox(0, 15, 0, 15);
- _vm->_displayMan->blitToBitmap(iconBitmap, destBitmap, blitBox, (iconIndex & 0x000F) << 4, iconIndex & 0x0FF0, 128, 8, kM1_ColorNoTransparency, _iconGraphicHeight[counter], 16);
+ _vm->_displayMan->blitToBitmap(iconBitmap, destBitmap, blitBox, (iconIndex & 0x000F) << 4, iconIndex & 0x0FF0, 128, 8, kDMColorNoTransparency, _iconGraphicHeight[counter], 16);
}
void ObjectMan::drawIconInSlotBox(uint16 slotBoxIndex, int16 iconIndex) {
@@ -205,10 +205,10 @@ void ObjectMan::drawIconInSlotBox(uint16 slotBoxIndex, int16 iconIndex) {
return;
Box blitBox;
- blitBox._x1 = slotBox->_x;
- blitBox._x2 = blitBox._x1 + 15;
- blitBox._y1 = slotBox->_y;
- blitBox._y2 = blitBox._y1 + 15;
+ blitBox._rect.left = slotBox->_x;
+ blitBox._rect.right = blitBox._rect.left + 15;
+ blitBox._rect.top = slotBox->_y;
+ blitBox._rect.bottom = blitBox._rect.top + 15;
uint16 iconGraphicIndex;
for (iconGraphicIndex = 0; iconGraphicIndex < 7; iconGraphicIndex++) {
@@ -231,7 +231,7 @@ void ObjectMan::drawIconInSlotBox(uint16 slotBoxIndex, int16 iconIndex) {
destHeight = 200;
}
_vm->_displayMan->_useByteBoxCoordinates = false;
- _vm->_displayMan->blitToBitmap(iconBitmap, blitDestination, blitBox, (iconIndex & 0x000F) << 4, iconIndex & 0x0FF0, k128_byteWidth, byteWidth, kM1_ColorNoTransparency, _iconGraphicHeight[iconGraphicIndex], destHeight);
+ _vm->_displayMan->blitToBitmap(iconBitmap, blitDestination, blitBox, (iconIndex & 0x000F) << 4, iconIndex & 0x0FF0, k128_byteWidth, byteWidth, kDMColorNoTransparency, _iconGraphicHeight[iconGraphicIndex], destHeight);
}
void ObjectMan::drawLeaderObjectName(Thing thing) {
@@ -257,7 +257,7 @@ void ObjectMan::drawLeaderObjectName(Thing thing) {
} else
objectName = Common::String(_objectNames[iconIndex]);
- _vm->_textMan->printWithTrailingSpaces(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, 233, 37, k4_ColorCyan, k0_ColorBlack, objectName.c_str(), k14_ObjectNameMaximumLength, k200_heightScreen);
+ _vm->_textMan->printWithTrailingSpaces(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, 233, 37, kDMColorCyan, kDMColorBlack, objectName.c_str(), k14_ObjectNameMaximumLength, k200_heightScreen);
}
IconIndice ObjectMan::getIconIndexInSlotBox(uint16 slotBoxIndex) {
@@ -266,13 +266,13 @@ IconIndice ObjectMan::getIconIndexInSlotBox(uint16 slotBoxIndex) {
void ObjectMan::clearLeaderObjectName() {
static Box boxLeaderHandObjectName(233, 319, 33, 38); // @ G0028_s_Graphic562_Box_LeaderHandObjectName
- _vm->_displayMan->fillScreenBox(boxLeaderHandObjectName, k0_ColorBlack);
+ _vm->_displayMan->fillScreenBox(boxLeaderHandObjectName, kDMColorBlack);
}
void ObjectMan::drawIconToScreen(int16 iconIndex, int16 posX, int16 posY) {
static byte iconBitmap[16 * 16];
Box blitBox(posX, posX + 15, posY, posY + 15);
extractIconFromBitmap(iconIndex, iconBitmap);
- _vm->_displayMan->blitToScreen(iconBitmap, &blitBox, k8_byteWidth, kM1_ColorNoTransparency, 16);
+ _vm->_displayMan->blitToScreen(iconBitmap, &blitBox, k8_byteWidth, kDMColorNoTransparency, 16);
}
}
diff --git a/engines/dm/objectman.h b/engines/dm/objectman.h
index bb7d06c606..7a69d75566 100644
--- a/engines/dm/objectman.h
+++ b/engines/dm/objectman.h
@@ -35,7 +35,6 @@ namespace DM {
#define k8_SlotBoxInventoryFirstSlot 8 // @ C08_SLOT_BOX_INVENTORY_FIRST_SLOT
#define k9_SlotBoxInventoryActionHand 9 // @ C09_SLOT_BOX_INVENTORY_ACTION_HAND
-#define k38_SlotBoxChestFirstSlot 38 // @ C38_SLOT_BOX_CHEST_FIRST_SLOT
#define k14_ObjectNameMaximumLength 14 // @ C014_OBJECT_NAME_MAXIMUM_LENGTH
#define k199_ObjectNameCount 199 // @ C199_OBJECT_NAME_COUNT
diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp
index b30fb72dde..dc08ee7f89 100644
--- a/engines/dm/projexpl.cpp
+++ b/engines/dm/projexpl.cpp
@@ -163,14 +163,14 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in
return false;
curCreatureIndex--;
- uint16 curCreatureType = curGroup->_type;
+ CreatureType curCreatureType = curGroup->_type;
CreatureInfo *curCreatureInfo = &_vm->_dungeonMan->_creatureInfos[curCreatureType];
- if ((projectileAssociatedThing == Thing::_explFireBall) && (curCreatureType == k11_CreatureTypeBlackFlame)) {
+ if ((projectileAssociatedThing == Thing::_explFireBall) && (curCreatureType == kDMCreatureTypeBlackFlame)) {
uint16 *curCreatureHealth = &curGroup->_health[curCreatureIndex];
*curCreatureHealth = MIN(1000, *curCreatureHealth + getProjectileImpactAttack(projectileThingData, projectileAssociatedThing));
goto T0217044;
}
- if (getFlag(curCreatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial) && (projectileAssociatedThing != Thing::_explHarmNonMaterial))
+ if (getFlag(curCreatureInfo->_attributes, kDMCreatureMaskNonMaterial) && (projectileAssociatedThing != Thing::_explHarmNonMaterial))
return false;
attack = (uint16)((unsigned long)getProjectileImpactAttack(projectileThingData, projectileAssociatedThing) << 6) / curCreatureInfo->_defense;
@@ -182,7 +182,7 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in
_creatureDamageOutcome = outcome;
if (!createExplosionOnImpact && (outcome == k0_outcomeKilledNoCreaturesInGroup)
&& (projectileAssociatedThingType == kDMThingTypeWeapon)
- && getFlag(curCreatureInfo->_attributes, k0x0400_MaskCreatureInfo_keepThrownSharpWeapon)) {
+ && getFlag(curCreatureInfo->_attributes, kDMCreatureMaskKeepThrownSharpWeapon)) {
Weapon *weapon = (Weapon *)_vm->_dungeonMan->getThingData(projectileAssociatedThing);
WeaponType weaponType = weapon->getType();
if ((weaponType == kDMWeaponDagger) || (weaponType == kDMWeaponArrow)
@@ -208,7 +208,7 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in
}
if ((projectileAssociatedThing == Thing::_explLightningBolt) && !(explosionAttack >>= 1))
goto T0217044;
- createExplosion(projectileAssociatedThing, explosionAttack, mapXCombo, mapYCombo, (projectileAssociatedThing == Thing::_explPoisonCloud) ? (uint16)k255_CreatureTypeSingleCenteredCreature : cell);
+ createExplosion(projectileAssociatedThing, explosionAttack, mapXCombo, mapYCombo, (projectileAssociatedThing == Thing::_explPoisonCloud) ? (uint16)kDMCreatureTypeSingleCenteredCreature : cell);
} else {
uint16 soundIndex;
if ((projectileAssociatedThing).getType() == kDMThingTypeWeapon)
@@ -294,7 +294,7 @@ void ProjExpl::createExplosion(Thing explThing, uint16 attack, uint16 mapXCombo,
projectileMapY >>= 8;
}
- if (cell == k255_CreatureTypeSingleCenteredCreature)
+ if (cell == kDMCreatureTypeSingleCenteredCreature)
explosion->setCentered(true);
else {
explosion->setCentered(false);
@@ -334,7 +334,7 @@ void ProjExpl::createExplosion(Thing explThing, uint16 attack, uint16 mapXCombo,
CreatureInfo *creatureInfo = &_vm->_dungeonMan->_creatureInfos[creatureGroup->_type];
int16 creatureFireResistance = creatureInfo->getFireResistance();
if (creatureFireResistance != kDMImmuneToFire) {
- if (getFlag(creatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial))
+ if (getFlag(creatureInfo->_attributes, kDMCreatureMaskNonMaterial))
attack >>= 2;
if ((attack -= _vm->getRandomNumber((creatureFireResistance << 1) + 1)) > 0)
@@ -480,7 +480,7 @@ void ProjExpl::processEvent25(TimelineEvent *event) {
Group *group = nullptr;
CreatureInfo *creatureInfo = nullptr;
- uint16 creatureType = 0;
+ CreatureType creatureType;
if (groupThing != Thing::_endOfList) {
group = (Group *)_vm->_dungeonMan->getThingData(groupThing);
creatureType = group->_type;
@@ -508,15 +508,15 @@ void ProjExpl::processEvent25(TimelineEvent *event) {
break;
case 0xFF83:
- if ((groupThing != Thing::_endOfList) && getFlag(creatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial)) {
- if ((creatureType == k19_CreatureTypeMaterializerZytaz) && (_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex)) {
+ if ((groupThing != Thing::_endOfList) && getFlag(creatureInfo->_attributes, kDMCreatureMaskNonMaterial)) {
+ if ((creatureType == kDMCreatureTypeMaterializerZytaz) && (_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex)) {
int16 nonMaterialAdditionalAttack = attack >> 3;
attack -= nonMaterialAdditionalAttack;
nonMaterialAdditionalAttack <<= 1;
nonMaterialAdditionalAttack++;
int16 creatureCount = group->getCount();
do {
- if (getFlag(_vm->_groupMan->_activeGroups[group->getActiveGroupIndex()]._aspect[creatureCount], k0x0080_MaskActiveGroupIsAttacking)) /* Materializer / Zytaz can only be damaged while they are attacking */
+ if (getFlag(_vm->_groupMan->_activeGroups[group->getActiveGroupIndex()]._aspect[creatureCount], kDMAspectMaskActiveGroupIsAttacking)) /* Materializer / Zytaz can only be damaged while they are attacking */
_vm->_groupMan->groupGetDamageCreatureOutcome(group, creatureCount, mapX, mapY, attack + _vm->getRandomNumber(nonMaterialAdditionalAttack) + _vm->getRandomNumber(4), true);
} while (--creatureCount >= 0);
} else
diff --git a/engines/dm/sounds.h b/engines/dm/sounds.h
index 92b9340dbd..fe0c0f446f 100644
--- a/engines/dm/sounds.h
+++ b/engines/dm/sounds.h
@@ -32,6 +32,13 @@
namespace DM {
+enum SoundMode {
+ kDMSoundModeDoNotPlaySound = -1, // @ CM1_MODE_DO_NOT_PLAY_SOUND
+ kDMSoundModePlayImmediately = 0, // @ C00_MODE_PLAY_IMMEDIATELY
+ kDMSoundModePlayIfPrioritized = 1, // @ C01_MODE_PLAY_IF_PRIORITIZED
+ kDMSoundModePlayOneTickLater = 2 // @ C02_MODE_PLAY_ONE_TICK_LATER
+};
+
#define k34_D13_soundCount 34 // @ D13_SOUND_COUNT
class SoundData {
diff --git a/engines/dm/text.cpp b/engines/dm/text.cpp
index dcf7e27a8e..c3cadd39db 100644
--- a/engines/dm/text.cpp
+++ b/engines/dm/text.cpp
@@ -79,7 +79,7 @@ void TextMan::printTextToBitmap(byte *destBitmap, uint16 destByteWidth, int16 de
uint16 srcX = (1 + 5) * *begin; // 1 + 5 is not the letter width, arbitrary choice of the unpacking code
Box box((nextX == destX) ? (nextX + 1) : nextX, nextX + k5_LetterWidth + 1, nextY, nextY + k6_LetterHeight - 1);
- _vm->_displayMan->blitToBitmap(srcBitmap, destBitmap, box, (nextX == destX) ? (srcX + 1) : srcX, 0, 6 * 128 / 2, destByteWidth, kM1_ColorNoTransparency,
+ _vm->_displayMan->blitToBitmap(srcBitmap, destBitmap, box, (nextX == destX) ? (srcX + 1) : srcX, 0, 6 * 128 / 2, destByteWidth, kDMColorNoTransparency,
k6_LetterHeight, destHeight);
nextX += k5_LetterWidth + 1;
@@ -103,7 +103,7 @@ void TextMan::printWithTrailingSpaces(byte *destBitmap, int16 destByteWidth, int
}
void TextMan::printLineFeed() {
- printMessage(k0_ColorBlack, "\n");
+ printMessage(kDMColorBlack, "\n");
}
void TextMan::printMessage(Color color, const char *string, bool printWithScroll) {
@@ -141,7 +141,7 @@ void TextMan::printMessage(Color color, const char *string, bool printWithScroll
void TextMan::createNewRow() {
if (_messageAreaCursorRow == 3) {
isTextScrolling(&_textScroller, true);
- memset(_bitmapMessageAreaNewRow, k0_ColorBlack, 320 * 7);
+ memset(_bitmapMessageAreaNewRow, kDMColorBlack, 320 * 7);
_isScrolling = true;
setScrollerCommand(&_textScroller, 1);
@@ -156,9 +156,9 @@ void TextMan::createNewRow() {
void TextMan::printString(Color color, const char* string) {
int16 stringLength = strlen(string);
if (isTextScrolling(&_textScroller, false))
- printToLogicalScreen(_messageAreaCursorColumn * 6, (_messageAreaCursorRow * 7 - 1) + 177, color, k0_ColorBlack, string);
+ printToLogicalScreen(_messageAreaCursorColumn * 6, (_messageAreaCursorRow * 7 - 1) + 177, color, kDMColorBlack, string);
else {
- printTextToBitmap(_bitmapMessageAreaNewRow, k160_byteWidthScreen, _messageAreaCursorColumn * 6, 0, color, k0_ColorBlack, string, 7);
+ printTextToBitmap(_bitmapMessageAreaNewRow, k160_byteWidthScreen, _messageAreaCursorColumn * 6, 0, color, kDMColorBlack, string, 7);
_isScrolling = true;
if (isTextScrolling(&_textScroller, false))
setScrollerCommand(&_textScroller, 1);
@@ -192,15 +192,16 @@ void TextMan::moveCursor(int16 column, int16 row) {
void TextMan::clearExpiredRows() {
_vm->_displayMan->_useByteBoxCoordinates = false;
Box displayBox;
- displayBox._x1 = 0;
- displayBox._x2 = 319;
+ displayBox._rect.left = 0;
+ displayBox._rect.right = 319;
for (uint16 rowIndex = 0; rowIndex < 4; rowIndex++) {
int32 expirationTime = _messageAreaRowExpirationTime[rowIndex];
if ((expirationTime == -1) || (expirationTime > _vm->_gameTime) || _isScrolling)
continue;
- displayBox._y2 = (displayBox._y1 = 172 + (rowIndex * 7)) + 6;
+ displayBox._rect.top = 172 + (rowIndex * 7);
+ displayBox._rect.bottom = displayBox._rect.top + 6;
isTextScrolling(&_textScroller, true);
- _vm->_displayMan->fillBoxBitmap(_vm->_displayMan->_bitmapScreen, displayBox, k0_ColorBlack, k160_byteWidthScreen, k200_heightScreen);
+ _vm->_displayMan->fillBoxBitmap(_vm->_displayMan->_bitmapScreen, displayBox, kDMColorBlack, k160_byteWidthScreen, k200_heightScreen);
_messageAreaRowExpirationTime[rowIndex] = -1;
}
}
@@ -217,14 +218,14 @@ void TextMan::printEndGameString(int16 x, int16 y, Color textColor, const char*
wrkStringPtr++;
*wrkStringPtr = *text++;
}
- printToLogicalScreen(x, y, textColor, k12_ColorDarkestGray, modifiedString);
+ printToLogicalScreen(x, y, textColor, kDMColorDarkestGray, modifiedString);
}
void TextMan::clearAllRows() {
isTextScrolling(&_textScroller, true);
Box tmpBox(0, 319, 169, 199);
- _vm->_displayMan->fillScreenBox(tmpBox, k0_ColorBlack);
+ _vm->_displayMan->fillScreenBox(tmpBox, kDMColorBlack);
_messageAreaCursorRow = 3;
_messageAreaCursorColumn = 0;
diff --git a/engines/dm/text.h b/engines/dm/text.h
index ab40925447..94a1266235 100644
--- a/engines/dm/text.h
+++ b/engines/dm/text.h
@@ -60,7 +60,7 @@ public:
void printTextToBitmap(byte *destBitmap, uint16 destByteWidth, int16 destX, int16 destY,
Color textColor, Color bgColor, const char *text, uint16 destHeight); // @ F0040_TEXT_Print
void printToLogicalScreen(uint16 destX, uint16 destY, Color textColor, Color bgColor, const char *text); // @ F0053_TEXT_PrintToLogicalScreen
- void printToViewport(int16 posX, int16 posY, Color textColor, const char *text, Color bgColor = k12_ColorDarkestGray); // @ F0052_TEXT_PrintToViewport
+ void printToViewport(int16 posX, int16 posY, Color textColor, const char *text, Color bgColor = kDMColorDarkestGray); // @ F0052_TEXT_PrintToViewport
void printWithTrailingSpaces(byte *destBitmap, int16 destByteWidth, int16 destX, int16 destY, Color textColor, Color bgColor,
const char *text, int16 strLenght, int16 destHeight); // @ F0041_TEXT_PrintWithTrailingSpaces
void printLineFeed(); // @ F0051_TEXT_MESSAGEAREA_PrintLineFeed
diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp
index e0b6484f27..8c3f11c288 100644
--- a/engines/dm/timeline.cpp
+++ b/engines/dm/timeline.cpp
@@ -410,7 +410,7 @@ void Timeline::processEventDoorAnimation(TimelineEvent *event) {
}
Thing groupThing = _vm->_groupMan->groupGetThing(mapX, mapY);
uint16 creatureAttributes = _vm->_dungeonMan->getCreatureAttributes(groupThing);
- if ((groupThing != Thing::_endOfList) && !getFlag(creatureAttributes, k0x0040_MaskCreatureInfo_nonMaterial)) {
+ if ((groupThing != Thing::_endOfList) && !getFlag(creatureAttributes, kDMCreatureMaskNonMaterial)) {
if (doorState >= (verticalDoorFl ? CreatureInfo::getHeight(creatureAttributes) : 1)) { /* Creature height or 1 */
if (_vm->_groupMan->getDamageAllCreaturesOutcome((Group *)_vm->_dungeonMan->getThingData(groupThing), mapX, mapY, 5, true) != k2_outcomeKilledAllCreaturesInGroup)
_vm->_groupMan->processEvents29to41(mapX, mapY, kM3_TMEventTypeCreateReactionEvent29DangerOnSquare, 0);
@@ -460,7 +460,7 @@ void Timeline::processEventSquareFakewall(TimelineEvent *event) {
addEventGetEventIndex(event);
} else {
Thing groupThing = _vm->_groupMan->groupGetThing(mapX, mapY);
- if ((groupThing != Thing::_endOfList) && !getFlag(_vm->_dungeonMan->getCreatureAttributes(groupThing), k0x0040_MaskCreatureInfo_nonMaterial)) {
+ if ((groupThing != Thing::_endOfList) && !getFlag(_vm->_dungeonMan->getCreatureAttributes(groupThing), kDMCreatureMaskNonMaterial)) {
event->_mapTime++;
addEventGetEventIndex(event);
} else
@@ -719,7 +719,7 @@ void Timeline::processEventSquareCorridor(TimelineEvent *event) {
if (!textCurrentlyVisible && textString->isVisible() && (_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (mapX == _vm->_dungeonMan->_partyMapX) && (mapY == _vm->_dungeonMan->_partyMapY)) {
_vm->_dungeonMan->decodeText(_vm->_stringBuildBuffer, curThing, kDMTextTypeMessage);
- _vm->_textMan->printMessage(k15_ColorWhite, _vm->_stringBuildBuffer);
+ _vm->_textMan->printMessage(kDMColorWhite, _vm->_stringBuildBuffer);
}
} else if (curThingType == kDMThingTypeSensor) {
Sensor *curSensor = (Sensor *)_vm->_dungeonMan->getThingData(curThing);
@@ -734,7 +734,7 @@ void Timeline::processEventSquareCorridor(TimelineEvent *event) {
if (healthMultiplier == 0)
healthMultiplier = _vm->_dungeonMan->_currMap->_difficulty;
- _vm->_groupMan->groupGetGenerated(curSensor->getData(), healthMultiplier, creatureCount, (Direction)_vm->getRandomNumber(4), mapX, mapY);
+ _vm->_groupMan->groupGetGenerated((CreatureType)curSensor->getData(), healthMultiplier, creatureCount, (Direction)_vm->getRandomNumber(4), mapX, mapY);
if (curSensor->getAttrAudibleA())
_vm->_sound->requestPlay(k17_soundBUZZ, mapX, mapY, kDMSoundModePlayIfPrioritized);
@@ -778,7 +778,7 @@ T0252001:
if (!randomDirectionMoveRetried) {
randomDirectionMoveRetried = true;
Group *group = (Group *)_vm->_dungeonMan->getThingData(Thing(event->_Cu._slot));
- if ((group->_type == k23_CreatureTypeLordChaos) && !_vm->getRandomNumber(4)) {
+ if ((group->_type == kDMCreatureTypeLordChaos) && !_vm->getRandomNumber(4)) {
switch (_vm->getRandomNumber(4)) {
case 0:
mapX--;
diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp
index e49e56d6f0..55db7fb8e3 100644
--- a/engines/fullpipe/gameloader.cpp
+++ b/engines/fullpipe/gameloader.cpp
@@ -66,7 +66,7 @@ GameLoader::GameLoader() {
_field_F8 = 0;
_sceneSwitcher = 0;
_preloadCallback = 0;
- _readSavegameCallback = 0;
+ _savegameCallback = 0;
_gameVar = 0;
_preloadSceneId = 0;
_preloadEntranceId = 0;
@@ -598,14 +598,6 @@ void GameLoader::updateSystems(int counterdiff) {
}
}
-void GameLoader::readSavegame(const char *fname) {
- warning("STUB: readSavegame(%s)", fname);
-}
-
-void GameLoader::writeSavegame(Scene *sc, const char *fname) {
- warning("STUB: writeSavegame(sc, %s)", fname);
-}
-
Sc2::Sc2() {
_sceneId = 0;
_field_2 = 0;
diff --git a/engines/fullpipe/gameloader.h b/engines/fullpipe/gameloader.h
index bb9b934b59..fc5db9c62c 100644
--- a/engines/fullpipe/gameloader.h
+++ b/engines/fullpipe/gameloader.h
@@ -80,6 +80,14 @@ struct FullpipeSavegameHeader {
Graphics::Surface *thumbnail;
};
+struct SaveHeader {
+ int32 saveSize;
+ char magic[32];
+ int32 updateCounter;
+ int32 unkField;
+ int32 encSize;
+};
+
class GameLoader : public CObject {
public:
GameLoader();
@@ -110,7 +118,7 @@ class GameLoader : public CObject {
Sc2Array _sc2array;
void *_sceneSwitcher;
bool (*_preloadCallback)(PreloadItem &pre, int flag);
- void *_readSavegameCallback;
+ void (*_savegameCallback)(MfcArchive *archive, bool mode);
int16 _field_F8;
int16 _field_FA;
PreloadItems _preloadItems;
diff --git a/engines/fullpipe/interaction.cpp b/engines/fullpipe/interaction.cpp
index 6bbf98e37b..accba788f9 100644
--- a/engines/fullpipe/interaction.cpp
+++ b/engines/fullpipe/interaction.cpp
@@ -290,8 +290,8 @@ LABEL_38:
return false;
}
- subj->_flags |= 1;
- obj->_flags |= 1;
+ subj->_flags |= 0x100;
+ obj->_flags |= 0x100;
} else {
bool someFlag = false;
PicAniInfo aniInfo;
@@ -389,7 +389,7 @@ LABEL_38:
ani->queueMessageQueue(mq);
}
} else {
- obj->_flags |= 1;
+ obj->_flags |= 0x100;
if (inter->_flags & 0x10000)
return true;
diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp
index 13ac78a358..8424e7e976 100644
--- a/engines/fullpipe/inventory.cpp
+++ b/engines/fullpipe/inventory.cpp
@@ -106,6 +106,17 @@ bool Inventory2::loadPartial(MfcArchive &file) { // Inventory2_SerializePartiall
return true;
}
+bool Inventory2::savePartial(MfcArchive &file) {
+ file.writeUint32LE(_inventoryItems.size());
+
+ for (uint i = 0; i < _inventoryItems.size(); i++) {
+ file.writeUint16LE(_inventoryItems[i]->itemId);
+ file.writeUint16LE(_inventoryItems[i]->count);
+ }
+
+ return true;
+}
+
void Inventory2::addItem(int itemId, int count) {
if (getInventoryPoolItemIndexById(itemId) >= 0)
_inventoryItems.push_back(new InventoryItem(itemId, count));
diff --git a/engines/fullpipe/inventory.h b/engines/fullpipe/inventory.h
index 46b55c5669..9f9b9961c6 100644
--- a/engines/fullpipe/inventory.h
+++ b/engines/fullpipe/inventory.h
@@ -101,6 +101,7 @@ class Inventory2 : public Inventory {
virtual ~Inventory2();
bool loadPartial(MfcArchive &file);
+ bool savePartial(MfcArchive &file);
void addItem(int itemId, int count);
void addItem2(StaticANIObject *obj);
void removeItem(int itemId, int count);
diff --git a/engines/fullpipe/lift.cpp b/engines/fullpipe/lift.cpp
index 10b41546b5..113ddf719e 100644
--- a/engines/fullpipe/lift.cpp
+++ b/engines/fullpipe/lift.cpp
@@ -358,7 +358,7 @@ void FullpipeEngine::lift_walkAndGo() {
mq->chain(0);
- _aniMan->_flags |= 1;
+ _aniMan->_flags |= 0x100;
}
}
@@ -423,12 +423,12 @@ void FullpipeEngine::lift_goAnimation() {
mq->addExCommandToEnd(ex);
- _aniMan->_flags &= 0xFEFF;
+ _aniMan->_flags &= ~0x100;
if (!mq->chain(_aniMan))
delete mq;
- _aniMan->_flags |= 1;
+ _aniMan->_flags |= 0x100;
return;
}
diff --git a/engines/fullpipe/module.mk b/engines/fullpipe/module.mk
index 01aba1bd82..62f9c5f77a 100644
--- a/engines/fullpipe/module.mk
+++ b/engines/fullpipe/module.mk
@@ -23,6 +23,7 @@ MODULE_OBJS = \
scenes.o \
sound.o \
stateloader.o \
+ statesaver.o \
statics.o \
utils.o \
scenes/sceneIntro.o \
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index b910c815a2..ba627a96a1 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -1675,8 +1675,9 @@ int MctlGraph::getDirByStatics(int idx, int staticsId) {
int MctlGraph::getDirByMovement(int idx, int movId) {
for (int i = 0; i < 4; i++)
- if (_items2[idx]->_subItems[i]._walk[0]._movementId == movId || _items2[idx]->_subItems[i]._turn[0]._movementId == movId ||
- _items2[idx]->_subItems[i]._turnS[0]._movementId == movId)
+ if (_items2[idx]->_subItems[i]._walk[0]._movementId == movId
+ || _items2[idx]->_subItems[i]._walk[1]._movementId == movId
+ || _items2[idx]->_subItems[i]._walk[2]._movementId == movId)
return i;
return -1;
diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h
index c9da43986c..9f0ccf18de 100644
--- a/engines/fullpipe/objects.h
+++ b/engines/fullpipe/objects.h
@@ -61,6 +61,7 @@ struct PicAniInfo {
int32 someDynamicPhaseIndex;
bool load(MfcArchive &file);
+ void save(MfcArchive &file);
PicAniInfo() { memset(this, 0, sizeof(PicAniInfo)); }
};
@@ -87,6 +88,7 @@ class GameVar : public CObject {
virtual ~GameVar();
virtual bool load(MfcArchive &file);
+ virtual void save(MfcArchive &file);
GameVar *getSubVarByName(const char *name);
bool setSubVarAsInt(const char *name, int value);
int getSubVarAsInt(const char *name);
diff --git a/engines/fullpipe/scenes/scene04.cpp b/engines/fullpipe/scenes/scene04.cpp
index 6810744f8a..3bdc338630 100644
--- a/engines/fullpipe/scenes/scene04.cpp
+++ b/engines/fullpipe/scenes/scene04.cpp
@@ -413,7 +413,7 @@ void sceneHandler04_jumpOnLadder() {
g_fp->_aniMan->changeStatics2(ST_MAN_LADDERDOWN);
- g_fp->_aniMan->_flags |= 1;
+ g_fp->_aniMan->_flags |= 0x100;
AniHandler aniHandler;
MakeQueueStruct mkQueue;
@@ -527,7 +527,7 @@ void sceneHandler04_gotoLadder(ExCommand *ex) {
if (mq->chain(g_fp->_aniMan)) {
g_fp->_aniMan->_priority = 12;
- g_fp->_aniMan->_flags |= 1;
+ g_fp->_aniMan->_flags |= 0x100;
} else {
delete mq;
}
diff --git a/engines/fullpipe/scenes/scene16.cpp b/engines/fullpipe/scenes/scene16.cpp
index 89b797757b..52daef3b8a 100644
--- a/engines/fullpipe/scenes/scene16.cpp
+++ b/engines/fullpipe/scenes/scene16.cpp
@@ -269,7 +269,7 @@ void sceneHandler16_drink() {
mq->setFlags(mq->getFlags() | 1);
mq->chain(0);
} else {
- g_fp->_aniMan->_flags |= 1;
+ g_fp->_aniMan->_flags |= 0x100;
mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_MANDRINK), 0, 1);
diff --git a/engines/fullpipe/scenes/scene18and19.cpp b/engines/fullpipe/scenes/scene18and19.cpp
index e6754e4ba4..a6f77a33fd 100644
--- a/engines/fullpipe/scenes/scene18and19.cpp
+++ b/engines/fullpipe/scenes/scene18and19.cpp
@@ -538,7 +538,7 @@ void sceneHandler18and19_girlJumpTo() {
void sceneHandler18and19_manStandArmchair() {
g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT);
- g_fp->_aniMan->_flags |= 1;
+ g_fp->_aniMan->_flags |= 0x100;
g_fp->_aniMan->_priority = 35;
g_fp->_aniMan->startAnim(MV_MAN18_STANDKRESLO, 0, -1);
}
diff --git a/engines/fullpipe/scenes/scene25.cpp b/engines/fullpipe/scenes/scene25.cpp
index dfb767ee91..9bc8f412f1 100644
--- a/engines/fullpipe/scenes/scene25.cpp
+++ b/engines/fullpipe/scenes/scene25.cpp
@@ -516,7 +516,7 @@ void sceneHandler25_walkOnLadder(StaticANIObject *ani, Common::Point *pnt, Messa
ani->restartMessageQueue(mq);
}
- ani->_flags |= 1;
+ ani->_flags |= 0x100;
}
bool sceneHandler25_isOnLadder(ExCommand *cmd) {
diff --git a/engines/fullpipe/scenes/scene28.cpp b/engines/fullpipe/scenes/scene28.cpp
index d7d2d213ee..b9cdf7ae1c 100644
--- a/engines/fullpipe/scenes/scene28.cpp
+++ b/engines/fullpipe/scenes/scene28.cpp
@@ -185,6 +185,8 @@ void sceneHandler28_turnOn2() {
}
void sceneHandler28_startWork1() {
+ debugC(2, kDebugSceneLogic, "scene28: startWork");
+
g_fp->_aniMan->hide();
StaticANIObject *man = g_fp->_currentScene->getStaticANIObject1ById(ANI_MAN_28, -1);
@@ -202,7 +204,7 @@ void sceneHandler28_lift0Start() {
}
void sceneHandler28_lift1Start() {
- g_fp->_aniMan->_flags |= 1;
+ g_fp->_aniMan->_flags |= 0x100;
g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0);
@@ -218,7 +220,7 @@ void sceneHandler28_lift3Start() {
}
void sceneHandler28_lift4Start() {
- g_fp->_aniMan->_flags |= 1;
+ g_fp->_aniMan->_flags |= 0x100;
g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0);
@@ -230,7 +232,7 @@ void sceneHandler28_lift5Start() {
}
void sceneHandler28_lift6Start() {
- g_fp->_aniMan->_flags |= 1;
+ g_fp->_aniMan->_flags |= 0x100;
g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0);
@@ -242,10 +244,12 @@ void sceneHandler28_lift6Start() {
chainQueue(QU_SC28_LIFT6_START, 1);
}
-void sceneHandler28_clickLift(int keycode) {
+void sceneHandler28_clickLift(int numLift) {
int x = 0;
- switch (keycode) {
+ debugC(2, kDebugSceneLogic, "scene28: clickLift(%d)", numLift);
+
+ switch (numLift) {
case 0: x = 600; break;
case 1: x = 824; break;
case 2: x = 1055; break;
@@ -258,17 +262,20 @@ void sceneHandler28_clickLift(int keycode) {
if (abs(x - g_fp->_aniMan->_ox) > 1 || abs(472 - g_fp->_aniMan->_oy) > 1
|| g_fp->_aniMan->_movement
|| g_fp->_aniMan->_statics->_staticsId != ST_MAN_UP) {
+ debugC(2, kDebugSceneLogic, "scene28: clickLift: overwrite");
+
MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_fp->_aniMan, x, 472, 1, ST_MAN_UP);
if (mq) {
ExCommand *ex = new ExCommand(0, 17, MSG_SC28_CLICKLIFT, 0, 0, 0, 1, 0, 0, 0);
ex->_excFlags |= 3;
+ ex->_param = numLift;
mq->addExCommandToEnd(ex);
postExCommand(g_fp->_aniMan->_id, 2, x, 472, 0, -1);
}
} else {
- switch (keycode) {
+ switch (numLift) {
case 0:
sceneHandler28_lift0Start();
break;
diff --git a/engines/fullpipe/scenes/scene34.cpp b/engines/fullpipe/scenes/scene34.cpp
index 6b74551e49..bc4ff18bae 100644
--- a/engines/fullpipe/scenes/scene34.cpp
+++ b/engines/fullpipe/scenes/scene34.cpp
@@ -189,7 +189,7 @@ void sceneHandler34_fromCactus(ExCommand *cmd) {
mq->setFlags(mq->getFlags() | 1);
mq->chain(0);
- g_fp->_aniMan->_flags |= 1;
+ g_fp->_aniMan->_flags |= 0x100;
}
void sceneHandler34_animateLeaveBoard(ExCommand *cmd) {
diff --git a/engines/fullpipe/scenes/scene35.cpp b/engines/fullpipe/scenes/scene35.cpp
index 7a290ade3b..3cdbb42c1e 100644
--- a/engines/fullpipe/scenes/scene35.cpp
+++ b/engines/fullpipe/scenes/scene35.cpp
@@ -88,7 +88,7 @@ void sceneHandler35_startFlow() {
g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene35_bellyInflater, ST_PDV_SMALL, QU_PDV_SML_TRY, 0);
g_vars->scene35_bellyInflater->changeStatics2(ST_PDV_SMALL);
- g_vars->scene35_bellyInflater->_flags &= 0xFEFF;
+ g_vars->scene35_bellyInflater->_flags &= ~0x100;
MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC35_EATHOZE), 0, 0);
@@ -105,7 +105,7 @@ void sceneHandler35_startFlow() {
if (!mq->chain(g_vars->scene35_bellyInflater))
delete mq;
- g_vars->scene35_bellyInflater->_flags |= 1;
+ g_vars->scene35_bellyInflater->_flags |= 0x100;
getCurrSceneSc2MotionController()->enableLinks(sO_CloseThing, 1);
diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp
index 02053aa94e..1323c23f77 100644
--- a/engines/fullpipe/stateloader.cpp
+++ b/engines/fullpipe/stateloader.cpp
@@ -37,6 +37,19 @@
namespace Fullpipe {
+void GameLoader::readSavegame(const char *fname) {
+ warning("STUB: readSavegame(%s)", fname);
+}
+
+void gameLoaderSavegameCallback(MfcArchive *archive, bool mode) {
+ if (mode)
+ for (int i = 0; i < 200; i++)
+ archive->writeUint32LE(g_fp->_mapTable[i]);
+ else
+ for (int i = 0; i < 200; i++)
+ g_fp->_mapTable[i] = archive->readUint32LE();
+}
+
bool FullpipeEngine::loadGam(const char *fname, int scene) {
_gameLoader = new GameLoader();
@@ -60,7 +73,7 @@ bool FullpipeEngine::loadGam(const char *fname, int scene) {
// _sceneSwitcher = sceneSwitcher; // substituted with direct call
_gameLoader->_preloadCallback = preloadCallback;
- // _readSavegameCallback = gameLoaderReadSavegameCallback; // TODO
+ _gameLoader->_savegameCallback = gameLoaderSavegameCallback;
_aniMan = accessScene(SC_COMMON)->getAniMan();
_scene2 = 0;
diff --git a/engines/fullpipe/statesaver.cpp b/engines/fullpipe/statesaver.cpp
new file mode 100644
index 0000000000..8f4077877c
--- /dev/null
+++ b/engines/fullpipe/statesaver.cpp
@@ -0,0 +1,161 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/memstream.h"
+
+#include "fullpipe/fullpipe.h"
+
+#include "fullpipe/gameloader.h"
+#include "fullpipe/objects.h"
+
+namespace Fullpipe {
+
+void GameLoader::writeSavegame(Scene *sc, const char *fname) {
+ GameVar *v = _gameVar->getSubVarByName("OBJSTATES")->getSubVarByName("SAVEGAME");
+
+ if (!v) {
+ v = _gameVar->getSubVarByName("OBJSTATES")->addSubVarAsInt("SAVEGAME", 0);
+
+ if (!v) {
+ warning("No state to save");
+ return;
+ }
+ }
+
+ SaveHeader header;
+
+ v->setSubVarAsInt("Scene", sc->_sceneId);
+
+ saveScenePicAniInfos(sc->_sceneId);
+ memset(&header, 0, sizeof(header));
+
+ header.saveSize = 48;
+ strcpy(header.magic, "FullPipe Savegame");
+ header.updateCounter = _updateCounter;
+ header.unkField = 1;
+
+ Common::MemoryWriteStreamDynamic stream;
+
+ MfcArchive *archive = new MfcArchive(&stream);
+
+ v = _gameVar->getSubVarByName("OBJSTATES");
+
+ GameVar *nxt = 0;
+ GameVar *prv = 0;
+ GameVar *par;
+ if (v) {
+ nxt = v->_nextVarObj;
+ prv = v->_prevVarObj;
+ par = v->_parentVarObj;
+ v->_parentVarObj = 0;
+ v->_nextVarObj = 0;
+ v->_prevVarObj = 0;
+ }
+
+ archive->writeObject(v);
+
+ if (v) {
+ v->_parentVarObj = par;
+ v->_nextVarObj = nxt;
+ v->_prevVarObj = prv;
+ }
+
+ getGameLoaderInventory()->savePartial(*archive);
+
+ archive->writeUint32LE(_sc2array.size());
+
+ for (uint i = 0; i < _sc2array.size(); i++) {
+ archive->writeUint32LE(_sc2array[i]._picAniInfosCount);
+
+ for (uint j = 0; j < _sc2array[i]._picAniInfosCount; j++) {
+ _sc2array[i]._picAniInfos[j]->save(*archive);
+ }
+ }
+
+ header.encSize = stream.size();
+
+ // Now obfuscate the data
+ for (uint i = 0; i < header.encSize; i++)
+ stream.getData()[i] += i & 0x7f;
+
+ if (_savegameCallback)
+ _savegameCallback(archive, true);
+
+ // Now dump it into save file
+ Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(fname);
+
+ saveFile->write(&header, sizeof(header));
+
+ saveFile->write(stream.getData(), stream.size());
+
+ saveFile->finalize();
+
+ delete saveFile;
+}
+
+
+void PicAniInfo::save(MfcArchive &file) {
+ debugC(5, kDebugLoading, "PicAniInfo::save()");
+
+ file.writeUint32LE(type);
+ file.writeUint16LE(objectId);
+ file.writeUint16LE(field_6);
+ file.writeUint32LE(field_8);
+ file.writeUint16LE(sceneId);
+ file.writeUint16LE(field_E);
+ file.writeSint32LE(ox);
+ file.writeSint32LE(oy);
+ file.writeUint32LE(priority);
+ file.writeUint16LE(staticsId);
+ file.writeUint16LE(movementId);
+ file.writeUint16LE(dynamicPhaseIndex);
+ file.writeUint16LE(flags);
+ file.writeUint32LE(field_24);
+ file.writeUint32LE(someDynamicPhaseIndex);
+}
+
+void GameVar::save(MfcArchive &file) {
+ file.writePascalString(_varName);
+ file.writeUint32LE(_varType);
+
+ switch (_varType) {
+ case 0:
+ file.writeUint32LE(_value.intValue);
+ break;
+ case 1:
+ file.writeUint32LE(_value.intValue); // FIXME
+ break;
+ case 2:
+ file.writePascalString(_value.stringValue);
+ break;
+ default:
+ error("Unknown var type: %d (0x%x)", _varType, _varType);
+ }
+
+ file.writeObject(_parentVarObj);
+ file.writeObject(_prevVarObj);
+ file.writeObject(_nextVarObj);
+ file.writeObject(_field_14);
+ file.writeObject(_subVars);
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index 0539edd047..620cb50788 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -191,9 +191,9 @@ StaticANIObject::StaticANIObject(StaticANIObject *src) : GameObject(src) {
Movement *newmov;
if (src->_movements[i]->_currMovement) {
- // WORKAROUND: Original uses weird construction here:
- // new Movement(getMovementById(src->getMovementIdById(mov->_id)), this);
- newmov = new Movement(src->getMovementById(src->getMovementIdById(src->_movements[i]->_id)), this);
+ // This is weird code. Logically it should be
+ // newmov = new Movement(src->getMovementById(src->getMovementIdById(src->_movements[i]->_id)), this);
+ newmov = new Movement(getMovementById(src->getMovementIdById(src->_movements[i]->_id)), this);
newmov->_id = src->_movements[i]->_id;
} else {
newmov = new Movement(src->_movements[i], 0, -1, this);
@@ -440,7 +440,7 @@ int StaticANIObject::getMovementIdById(int itemId) {
if (mov->_currMovement) {
if (mov->_id == itemId)
- return mov->_id;
+ return mov->_currMovement->_id;
if (mov->_currMovement->_id == itemId)
return mov->_id;
diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp
index de7cbbbaab..5403adec68 100644
--- a/engines/fullpipe/utils.cpp
+++ b/engines/fullpipe/utils.cpp
@@ -109,6 +109,17 @@ char *MfcArchive::readPascalString(bool twoByte) {
return tmp;
}
+void MfcArchive::writePascalString(char *str, bool twoByte) {
+ int len = strlen(str);
+
+ if (twoByte)
+ writeUint16LE(len);
+ else
+ writeByte(len);
+
+ write(str, len);
+}
+
MemoryObject::MemoryObject() {
_memfilename = 0;
_mfield_8 = 0;
@@ -347,6 +358,20 @@ static CObject *createObject(int objectId) {
}
MfcArchive::MfcArchive(Common::SeekableReadStream *stream) {
+ _stream = stream;
+ _wstream = 0;
+
+ init();
+}
+
+MfcArchive::MfcArchive(Common::WriteStream *stream) {
+ _wstream = stream;
+ _stream = 0;
+
+ init();
+}
+
+void MfcArchive::init() {
for (int i = 0; classMap[i].name; i++) {
_classMap[classMap[i].name] = classMap[i].id;
}
@@ -354,8 +379,6 @@ MfcArchive::MfcArchive(Common::SeekableReadStream *stream) {
_lastIndex = 1;
_level = 0;
- _stream = stream;
-
_objectMap.push_back(0);
_objectIdMap.push_back(kNullObject);
}
@@ -379,7 +402,9 @@ CObject *MfcArchive::parseClass(bool *isCopyReturned) {
debugC(7, kDebugLoading, "parseClass::obTag = %d (%04x) at 0x%08x", obTag, obTag, pos() - 2);
- if (obTag == 0xffff) {
+ if (obTag == 0x0000) {
+ return NULL;
+ } else if (obTag == 0xffff) {
int schema = readUint16LE();
debugC(7, kDebugLoading, "parseClass::schema = %d", schema);
@@ -434,6 +459,26 @@ CObject *MfcArchive::parseClass(bool *isCopyReturned) {
return res;
}
+void MfcArchive::writeObject(CObject *obj) {
+ if (obj == NULL) {
+ writeUint16LE(0);
+ } else if (_objectHash.contains(obj)) {
+ int32 idx = _objectHash[obj];
+
+ if (idx < 0x7fff) {
+ writeUint16LE(idx);
+ } else {
+ writeUint16LE(0x7fff);
+ writeUint32LE(idx);
+ }
+ } else {
+ writeUint16LE(0xffff); // New class
+ _objectHash[obj] = _lastIndex++;
+
+ obj->save(*this);
+ }
+}
+
char *genFileName(int superId, int sceneId, const char *ext) {
char *s = (char *)calloc(256, 1);
diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h
index da3ab7ee4f..44bda68cac 100644
--- a/engines/fullpipe/utils.h
+++ b/engines/fullpipe/utils.h
@@ -32,36 +32,64 @@ namespace Fullpipe {
class CObject;
class NGIArchive;
+struct Pointer_EqualTo {
+ bool operator()(const void *x, const void *y) const { return x == y; }
+};
+
+struct Pointer_Hash {
+ uint operator()(const void *x) const {
+#ifdef SCUMM_64BITS
+ uint64 v = (uint64)x;
+ return (v >> 32) ^ (v & 0xffffffff);
+#else
+ return (uint)x;
+#endif
+ }
+};
+
+typedef Common::HashMap<void *, int, Pointer_Hash, Pointer_EqualTo> ObjHash;
+
typedef Common::HashMap<Common::String, int, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> ClassMap;
-class MfcArchive : public Common::SeekableReadStream {
+class MfcArchive : public Common::SeekableReadStream, public Common::WriteStream {
ClassMap _classMap;
Common::Array<CObject *> _objectMap;
Common::Array<int> _objectIdMap;
+ ObjHash _objectHash;
int _lastIndex;
int _level;
Common::SeekableReadStream *_stream;
+ Common::WriteStream *_wstream;
- public:
+public:
MfcArchive(Common::SeekableReadStream *file);
+ MfcArchive(Common::WriteStream *file);
char *readPascalString(bool twoByte = false);
+ void writePascalString(char *str, bool twoByte = false);
int readCount();
double readDouble();
CObject *parseClass(bool *isCopyReturned);
CObject *readClass();
+ void writeObject(CObject *obj);
+
void incLevel() { _level++; }
void decLevel() { _level--; }
int getLevel() { return _level; }
virtual bool eos() const { return _stream->eos(); }
virtual uint32 read(void *dataPtr, uint32 dataSize) { return _stream->read(dataPtr, dataSize); }
- virtual int32 pos() const { return _stream->pos(); }
+ virtual int32 pos() const { return _stream ? _stream->pos() : _wstream->pos(); }
virtual int32 size() const { return _stream->size(); }
virtual bool seek(int32 offset, int whence = SEEK_SET) { return _stream->seek(offset, whence); }
+
+ virtual uint32 write(const void *dataPtr, uint32 dataSize) { return _wstream->write(dataPtr, dataSize); }
+
+private:
+ void init();
};
enum ObjType {
@@ -84,6 +112,7 @@ public:
CObject() : _objtype(kObjTypeDefault) {}
virtual bool load(MfcArchive &in) { return true; }
+ virtual void save(MfcArchive &out) { error("Not implemented for obj type: %d", _objtype); }
virtual ~CObject() {}
bool loadFile(const char *fname);
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index c1a4b12292..664e7fa0c4 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -3181,10 +3181,41 @@ static const uint16 qfg1vgaPatchWhiteStagDagger[] = {
PATCH_END
};
+// The dagger range has a script bug that can freeze the game or cause Brutus to kill you even after you've killed him.
+// This is a bug in the original game.
+//
+// When Bruno leaves, a 300 tick countdown starts. If you kill Brutus or leave room 73 within those 300 ticks then
+// the game is left in a broken state. For the rest of the game, if you ever return to the dagger range from the
+// east or west during the first half of the day then the game will freeze or Brutus will come back to life
+// and kill you, even if you already killed him.
+//
+// Special thanks, credits and kudos to sluicebox, who did a ton of research on this and even found this game bug originally.
+//
+// Applies to at least: English floppy, Mac floppy
+// Responsible method: brutusWaits::changeState
+// Fixes bug #9558
+static const uint16 qfg1vgaSignatureBrutusScriptFreeze[] = {
+ 0x78, // push1
+ 0x38, SIG_UINT16(0x144), // pushi 144h (324d)
+ 0x45, 0x05, 0x02, // call export 5 of script 0
+ SIG_MAGICDWORD,
+ 0x34, SIG_UINT16(0x12c), // ldi 12Ch (300d)
+ 0x65, 0x20, // aTop ticks
+ SIG_END
+};
+
+static const uint16 qfg1vgaPatchBrutusScriptFreeze[] = {
+ 0x34, PATCH_UINT16(0), // ldi 0 (waste 7 bytes)
+ 0x35, 0x00, // ldi 0
+ 0x35, 0x00, // ldi 0
+ PATCH_END
+};
+
// script, description, signature patch
static const SciScriptPatcherEntry qfg1vgaSignatures[] = {
{ true, 41, "moving to castle gate", 1, qfg1vgaSignatureMoveToCastleGate, qfg1vgaPatchMoveToCastleGate },
{ true, 55, "healer's hut, no delay for buy/steal", 1, qfg1vgaSignatureHealerHutNoDelay, qfg1vgaPatchHealerHutNoDelay },
+ { true, 73, "brutus script freeze glitch", 1, qfg1vgaSignatureBrutusScriptFreeze, qfg1vgaPatchBrutusScriptFreeze },
{ true, 77, "white stag dagger throw animation glitch", 1, qfg1vgaSignatureWhiteStagDagger, qfg1vgaPatchWhiteStagDagger },
{ true, 96, "funny room script bug fixed", 1, qfg1vgaSignatureFunnyRoomFix, qfg1vgaPatchFunnyRoomFix },
{ true, 210, "cheetaur description fixed", 1, qfg1vgaSignatureCheetaurDescription, qfg1vgaPatchCheetaurDescription },
diff --git a/engines/sherlock/debugger.cpp b/engines/sherlock/debugger.cpp
index 55243c4bc7..39bc1b90ab 100644
--- a/engines/sherlock/debugger.cpp
+++ b/engines/sherlock/debugger.cpp
@@ -47,6 +47,7 @@ Debugger::Debugger(SherlockEngine *vm) : GUI::Debugger(), _vm(vm) {
registerCmd("listfiles", WRAP_METHOD(Debugger, cmdListFiles));
registerCmd("dumpfile", WRAP_METHOD(Debugger, cmdDumpFile));
registerCmd("locations", WRAP_METHOD(Debugger, cmdLocations));
+ registerCmd("flag", WRAP_METHOD(Debugger, cmdFlag));
}
void Debugger::postEnter() {
@@ -159,5 +160,27 @@ bool Debugger::cmdLocations(int argc, const char **argv) {
return false;
}
+bool Debugger::cmdFlag(int argc, const char **argv) {
+ if (argc < 2) {
+ debugPrintf("Format: flag <number> [set | clear | toggle]\n");
+ } else {
+ int flagNum = strToInt(argv[1]);
+
+ if (argc == 2) {
+ debugPrintf("Flag %d is %s\n", flagNum, _vm->_flags[flagNum] ? "Set" : "Clear");
+ } else {
+ if (!strcmp(argv[2], "set"))
+ _vm->_flags[flagNum] = true;
+ else if (!strcmp(argv[2], "clear"))
+ _vm->_flags[flagNum] = false;
+ else if (!strcmp(argv[2], "toggle"))
+ _vm->_flags[flagNum] = !_vm->_flags[flagNum];
+
+ debugPrintf("Flag %d is now %s\n", flagNum, _vm->_flags[flagNum] ? "Set" : "Clear");
+ }
+ }
+
+ return true;
+}
} // End of namespace Sherlock
diff --git a/engines/sherlock/debugger.h b/engines/sherlock/debugger.h
index bcc4448c32..ae74690bed 100644
--- a/engines/sherlock/debugger.h
+++ b/engines/sherlock/debugger.h
@@ -68,6 +68,11 @@ private:
* Show all locations on the map
*/
bool cmdLocations(int argc, const char **argv);
+
+ /**
+ * Get or set the value of a flag
+ */
+ bool cmdFlag(int argc, const char **argv);
protected:
SherlockEngine *_vm;
Common::String _3doPlayMovieFile;
diff --git a/engines/titanic/core/dont_save_file_item.h b/engines/titanic/core/dont_save_file_item.h
index f5ec4f791d..38620474d9 100644
--- a/engines/titanic/core/dont_save_file_item.h
+++ b/engines/titanic/core/dont_save_file_item.h
@@ -41,6 +41,11 @@ public:
* Load the data for the class from file
*/
virtual void load(SimpleFile *file);
+
+ /**
+ * Returns true if the item is a file item
+ */
+ virtual bool isFileItem() const { return false; }
};
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/fpoint.cpp b/engines/titanic/star_control/fpoint.cpp
index f3d7008324..a2829572f8 100644
--- a/engines/titanic/star_control/fpoint.cpp
+++ b/engines/titanic/star_control/fpoint.cpp
@@ -21,8 +21,17 @@
*/
#include "titanic/star_control/fpoint.h"
+#include "common/algorithm.h"
namespace Titanic {
+void FPoint::normalize() {
+ double hyp = sqrt(_x * _x + _y * _y);
+ assert(hyp != 0.0);
+
+ double fraction = 1.0 / hyp;
+ _x *= fraction;
+ _y *= fraction;
+}
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/fpoint.h b/engines/titanic/star_control/fpoint.h
index f2cef18ea5..33181d937b 100644
--- a/engines/titanic/star_control/fpoint.h
+++ b/engines/titanic/star_control/fpoint.h
@@ -34,6 +34,25 @@ public:
public:
FPoint() : _x(0), _y(0) {}
FPoint(double x, double y) : _x(x), _y(y) {}
+
+ bool operator==(const FPoint &p) const { return _x == p._x && _y == p._y; }
+ bool operator!=(const FPoint &p) const { return _x != p._x || _y != p._y; }
+
+ void operator+=(const FPoint &delta) {
+ _x += delta._x;
+ _y += delta._y;
+ }
+
+ void operator-=(const FPoint &delta) {
+ _x -= delta._x;
+ _y -= delta._y;
+ }
+
+ /**
+ * Normalises the X and Y coordinates as fractions relative to the
+ * value of the hypotenuse formed by a triangle from the origin (0,0)
+ */
+ void normalize();
};
} // End of namespace Titanic
diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp
index be7ade8877..c8e912c85e 100644
--- a/engines/xeen/combat.cpp
+++ b/engines/xeen/combat.cpp
@@ -799,8 +799,7 @@ void Combat::doMonsterTurn(int monsterId) {
intf.draw3d(true);
intf.draw3d(true);
- File f(Common::String::format("%s.voc", monsterData._attackVoc.c_str()));
- sound.playSample(&f, 0);
+ sound.playSound(Common::String::format("%s.voc", monsterData._attackVoc.c_str()));
monsterId = monster._spriteId;
}
@@ -1386,7 +1385,7 @@ void Combat::attack2(int damage, RangeType rangeType) {
damage = 0;
if (!damage) {
- sound.playSample(&_missVoc, 1);
+ sound.playSound(_missVoc, 1);
sound.playFX(6);
} else {
if (!isDarkCc && monster._spriteId == 89)
@@ -1449,17 +1448,17 @@ void Combat::attack2(int damage, RangeType rangeType) {
}
if (damage < 1) {
- sound.playSample(&_missVoc, 1);
+ sound.playSound(_missVoc, 1);
sound.playFX(6);
} else {
_monsterScale[_monsterIndex] = getDamageScale(damage);
intf.draw3d(true);
- sound.playSample(nullptr, 0);
+ sound.stopSound();
File powVoc(Common::String::format("pow%d.voc",
POW_WEAPON_VOCS[_attackWeaponId]));
sound.playFX(60 + POW_WEAPON_VOCS[_attackWeaponId]);
- sound.playSample(&powVoc, 1);
+ sound.playSound(powVoc, 1);
if (monster._hp > damage) {
monster._hp -= damage;
diff --git a/engines/xeen/debugger.cpp b/engines/xeen/debugger.cpp
index d9b4990e97..34bc0a3d49 100644
--- a/engines/xeen/debugger.cpp
+++ b/engines/xeen/debugger.cpp
@@ -47,6 +47,7 @@ static int strToInt(const char *s) {
Debugger::Debugger(XeenEngine *vm) : GUI::Debugger(), _vm(vm) {
registerCmd("continue", WRAP_METHOD(Debugger, cmdExit));
registerCmd("spell", WRAP_METHOD(Debugger, cmdSpell));
+ registerCmd("dump", WRAP_METHOD(Debugger, cmdDump));
_spellId = -1;
}
@@ -82,4 +83,34 @@ bool Debugger::cmdSpell(int argc, const char **argv) {
return true;
}
+bool Debugger::cmdDump(int argc, const char **argv) {
+ File f;
+
+ if (argc < 2) {
+ debugPrintf("Format: dump <resource name>\n");
+ } else {
+ if (argc == 2)
+ f.open(argv[1]);
+ else
+ f.open(argv[1], (ArchiveType)strToInt(argv[2]));
+
+ if (f.isOpen()) {
+ Common::DumpFile df;
+ df.open(argv[1]);
+ byte *data = new byte[f.size()];
+ f.read(data, f.size());
+ df.write(data, f.size());
+
+ f.close();
+ df.close();
+ delete[] data;
+ debugPrintf("Saved\n");
+ } else {
+ debugPrintf("Could not find resource with that name\n");
+ }
+ }
+
+ return true;
+}
+
} // End of namespace Xeen
diff --git a/engines/xeen/debugger.h b/engines/xeen/debugger.h
index e7f8ef6b7d..8599835866 100644
--- a/engines/xeen/debugger.h
+++ b/engines/xeen/debugger.h
@@ -36,6 +36,7 @@ private:
int _spellId;
bool cmdSpell(int argc, const char **argv);
+ bool cmdDump(int argc, const char **argv);
public:
Debugger(XeenEngine *vm);
diff --git a/engines/xeen/dialogs_char_info.cpp b/engines/xeen/dialogs_char_info.cpp
index 0494c22b9c..5a4e3ccd30 100644
--- a/engines/xeen/dialogs_char_info.cpp
+++ b/engines/xeen/dialogs_char_info.cpp
@@ -474,14 +474,14 @@ bool CharacterInfo::expandStat(int attrib, const Character &c) {
case 16:
// Gold
- msg = Common::String::format(IN_PARTY_IN_BANK, STAT_NAMES[attrib],
+ msg = Common::String::format(IN_PARTY_IN_BANK, CONSUMABLE_NAMES[0],
party._gold, party._bankGold);
bounds.setHeight(43);
break;
case 17:
// Gems
- msg = Common::String::format(IN_PARTY_IN_BANK, STAT_NAMES[attrib],
+ msg = Common::String::format(IN_PARTY_IN_BANK, CONSUMABLE_NAMES[1],
party._gems, party._bankGems);
bounds.setHeight(43);
break;
@@ -489,7 +489,7 @@ bool CharacterInfo::expandStat(int attrib, const Character &c) {
case 18: {
// Food
int food = (party._food / party._activeParty.size()) / 3;
- msg = Common::String::format(FOOD_TEXT, STAT_NAMES[attrib],
+ msg = Common::String::format(FOOD_TEXT, CONSUMABLE_NAMES[2],
party._food, food, food != 1 ? "s" : "");
break;
}
@@ -528,7 +528,7 @@ bool CharacterInfo::expandStat(int attrib, const Character &c) {
lines[19] = Common::String::format(HEROISM, party._heroism);
msg = Common::String::format("\x2\x3""c%s\x3l%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\x1",
- STAT_NAMES[attrib], lines[0].c_str(), lines[1].c_str(),
+ CONSUMABLE_NAMES[3], lines[0].c_str(), lines[1].c_str(),
lines[2].c_str(), lines[3].c_str(), lines[4].c_str(),
lines[5].c_str(), lines[6].c_str(), lines[7].c_str(),
lines[8].c_str(), lines[9].c_str(), lines[10].c_str(),
diff --git a/engines/xeen/dialogs_items.cpp b/engines/xeen/dialogs_items.cpp
index 59bf35dfb8..23d7071500 100644
--- a/engines/xeen/dialogs_items.cpp
+++ b/engines/xeen/dialogs_items.cpp
@@ -718,7 +718,7 @@ int ItemsDialog::calcItemCost(Character *c, int itemIndex, ItemsMode mode,
if (i._material < 37)
amount2 = ELEMENTAL_DAMAGE[i._material] * 100;
else if (i._material > 58)
- amount3 = METAL_BASE_MULTIPLIERS[i._material] * 100;
+ amount3 = METAL_BASE_MULTIPLIERS[i._material - 37] * 100;
switch (mode) {
case ITEMMODE_BLACKSMITH:
@@ -907,9 +907,8 @@ int ItemsDialog::doItemOptions(Character &c, int actionIndex, int itemIndex, Ite
desc.c_str(), cost))) {
if (party.subtract(0, cost, 0, WT_FREEZE_WAIT)) {
if (isDarkCc) {
- sound.playSample(0, 0);
- File f("choice2.voc");
- sound.playSample(&f, 0);
+ sound.stopSound();
+ sound.playSound("choice2.voc");
}
// Add entry to the end of the list
diff --git a/engines/xeen/dialogs_options.cpp b/engines/xeen/dialogs_options.cpp
index 72445bf055..b2390e344f 100644
--- a/engines/xeen/dialogs_options.cpp
+++ b/engines/xeen/dialogs_options.cpp
@@ -123,7 +123,6 @@ void OptionsMenu::showTitles2() {
EventsManager &events = *_vm->_events;
Sound &sound = *_vm->_sound;
- File voc("elect.voc");
SpriteResource titleSprites("title2b.raw");
SpriteResource kludgeSprites("kludge.int");
SpriteResource title2Sprites[8] = {
@@ -135,7 +134,7 @@ void OptionsMenu::showTitles2() {
kludgeSprites.draw(screen, 0);
screen.saveBackground();
- sound.playSample(&voc, 0);
+ sound.playSound("elect.voc");
for (int i = 0; i < 30 && !_vm->shouldQuit(); ++i) {
events.updateGameCounter();
@@ -144,7 +143,7 @@ void OptionsMenu::showTitles2() {
screen._windows[0].update();
if (i == 19)
- sound.playSample(nullptr, 0);
+ sound.stopSound();
while (!_vm->shouldQuit() && events.timeElapsed() < 2)
events.pollEventsAndWait();
diff --git a/engines/xeen/dialogs_quests.cpp b/engines/xeen/dialogs_quests.cpp
index 284e15781b..38011f1106 100644
--- a/engines/xeen/dialogs_quests.cpp
+++ b/engines/xeen/dialogs_quests.cpp
@@ -245,7 +245,7 @@ void Quests::addButtons() {
}
void Quests::loadQuestNotes() {
- File f("qnotes.bin", *_vm->_files->_sideArchives[_vm->getGameID() == GType_Clouds ? 0 : 1]);
+ File f("qnotes.bin", _vm->getGameID() == GType_Clouds ? GAME_ARCHIVE : ALTSIDE_ARCHIVE);
while (f.pos() < f.size())
_questNotes.push_back(f.readString());
f.close();
diff --git a/engines/xeen/dialogs_spells.cpp b/engines/xeen/dialogs_spells.cpp
index 1e0600faf9..77d1b4ef6e 100644
--- a/engines/xeen/dialogs_spells.cpp
+++ b/engines/xeen/dialogs_spells.cpp
@@ -59,10 +59,9 @@ Character *SpellsDialog::execute(ButtonContainer *priorDialog, Character *c, int
do {
if (!isCasting) {
if (!c->guildMember()) {
- sound.playSample(nullptr, 0);
+ sound.stopSound();
intf._overallFrame = 5;
- File f(isDarkCc ? "skull1.voc" : "guild11.voc");
- sound.playSample(&f, 1);
+ sound.playSound(isDarkCc ? "skull1.voc" : "guild11.voc", 1);
break;
}
@@ -239,10 +238,9 @@ Character *SpellsDialog::execute(ButtonContainer *priorDialog, Character *c, int
if (Confirm::show(_vm, msg, castingCopy + 1)) {
if (party.subtract(0, spellCost, 0, WT_FREEZE_WAIT)) {
++c->_spells[spellIndex];
- sound.playSample(nullptr, 0);
+ sound.stopSound();
intf._overallFrame = 0;
- File f(isDarkCc ? "guild12.voc" : "parrot2.voc");
- sound.playSample(&f, 1);
+ sound.playSound(isDarkCc ? "guild12.voc" : "parrot2.voc", 1);
} else {
sound.playFX(21);
}
diff --git a/engines/xeen/files.cpp b/engines/xeen/files.cpp
index bcee6bf9f6..b928677aac 100644
--- a/engines/xeen/files.cpp
+++ b/engines/xeen/files.cpp
@@ -183,37 +183,78 @@ Common::SeekableReadStream *CCArchive::createReadStreamForMember(const Common::S
/*------------------------------------------------------------------------*/
+CCArchive *FileManager::_archives[3];
+
FileManager::FileManager(XeenEngine *vm) {
Common::File f;
int sideNum = 0;
+ File::_currentArchive = ANY_ARCHIVE;
_isDarkCc = vm->getGameID() == GType_DarkSide;
- _sideArchives[0] = _sideArchives[1] = nullptr;
+ _archives[0] = _archives[1] = _archives[2] = nullptr;
if (vm->getGameID() != GType_DarkSide) {
- _sideArchives[0] = new CCArchive("xeen.cc", "xeen", true);
- SearchMan.add("xeen", _sideArchives[0]);
+ _archives[0] = new CCArchive("xeen.cc", "xeen", true);
+ SearchMan.add("xeen", _archives[0]);
sideNum = 1;
}
if (vm->getGameID() == GType_DarkSide || vm->getGameID() == GType_WorldOfXeen) {
- _sideArchives[sideNum] = new CCArchive("dark.cc", "dark", true);
- SearchMan.add("dark", _sideArchives[sideNum]);
+ _archives[sideNum] = new CCArchive("dark.cc", "dark", true);
+ SearchMan.add("dark", _archives[sideNum]);
+ }
+
+ if (f.exists("intro.cc")) {
+ _archives[2] = new CCArchive("intro.cc", "intro", true);
+ SearchMan.add("intro", _archives[2]);
}
+}
- SearchMan.add("intro", new CCArchive("intro.cc", "intro", true));
+void FileManager::setGameCc(bool isDarkCc) {
+ _isDarkCc = isDarkCc;
+ File::_currentArchive = isDarkCc ? ALTSIDE_ARCHIVE : GAME_ARCHIVE;
}
/*------------------------------------------------------------------------*/
-void File::openFile(const Common::String &filename) {
- if (!Common::File::open(filename))
+ArchiveType File::_currentArchive;
+
+File::File(const Common::String &filename) {
+ File::open(filename);
+}
+
+File::File(const Common::String &filename, ArchiveType archiveType) {
+ File::open(filename, archiveType);
+}
+
+File::File(const Common::String &filename, Common::Archive &archive) {
+ File::open(filename, archive);
+}
+
+bool File::open(const Common::String &filename) {
+ return File::open(filename, _currentArchive);
+}
+
+bool File::open(const Common::String &filename, ArchiveType archiveType) {
+ if (archiveType == ANY_ARCHIVE) {
+ Common::File::open(filename);
+ } else {
+ CCArchive &archive = *FileManager::_archives[archiveType];
+ if (!Common::File::open(filename, archive))
+ // If not in the designated archive, try opening from any archive,
+ // or as a standalone file in the filesystem
+ Common::File::open(filename);
+ }
+
+ if (!isOpen())
error("Could not open file - %s", filename.c_str());
+ return true;
}
-void File::openFile(const Common::String &filename, Common::Archive &archive) {
+bool File::open(const Common::String &filename, Common::Archive &archive) {
if (!Common::File::open(filename, archive))
error("Could not open file - %s", filename.c_str());
+ return true;
}
Common::String File::readString() {
@@ -226,5 +267,4 @@ Common::String File::readString() {
return result;
}
-
} // End of namespace Xeen
diff --git a/engines/xeen/files.h b/engines/xeen/files.h
index fc75031a72..fa595976f4 100644
--- a/engines/xeen/files.h
+++ b/engines/xeen/files.h
@@ -28,12 +28,17 @@
#include "common/file.h"
#include "common/serializer.h"
#include "graphics/surface.h"
-#include "xeen/xsurface.h"
namespace Xeen {
+enum ArchiveType {
+ ANY_ARCHIVE = -1, GAME_ARCHIVE = 0, ALTSIDE_ARCHIVE = 1,
+ INTRO_ARCHIVE = 2
+};
+
class XeenEngine;
class CCArchive;
+class File;
#define SYNC_AS(SUFFIX,STREAM,TYPE,SIZE) \
template<typename T> \
@@ -48,20 +53,26 @@ class CCArchive;
} \
_bytesSynced += SIZE; \
}
+
/*
* Main resource manager
*/
class FileManager {
+ friend class File;
+private:
+ static CCArchive *_archives[3];
public:
bool _isDarkCc;
- CCArchive *_sideArchives[2];
public:
/**
* Instantiates the resource manager
*/
FileManager(XeenEngine *vm);
- void setGameCc(bool isDarkCc) { _isDarkCc = isDarkCc; }
+ /**
+ * Set which game side files to use
+ */
+ void setGameCc(bool isDarkCc);
};
/**
@@ -69,22 +80,33 @@ public:
*/
class File : public Common::File {
public:
+ static ArchiveType _currentArchive;
+
+ /**
+ * Sets which archive is used by default
+ */
+ static void setCurrentArchive(ArchiveType arcType) { _currentArchive = arcType; }
+public:
File() : Common::File() {}
- File(const Common::String &filename) { openFile(filename); }
- File(const Common::String &filename, Common::Archive &archive) {
- openFile(filename, archive);
- }
+ File(const Common::String &filename);
+ File(const Common::String &filename, ArchiveType archiveType);
+ File(const Common::String &filename, Common::Archive &archive);
virtual ~File() {}
/**
* Opens the given file, throwing an error if it can't be opened
*/
- void openFile(const Common::String &filename);
+ virtual bool open(const Common::String &filename);
+
+ /**
+ * Opens the given file, throwing an error if it can't be opened
+ */
+ virtual bool open(const Common::String &filename, ArchiveType archiveType);
/**
* Opens the given file, throwing an error if it can't be opened
*/
- void openFile(const Common::String &filename, Common::Archive &archive);
+ virtual bool open(const Common::String &filename, Common::Archive &archive);
Common::String readString();
};
diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp
index 9aca904fb8..bdb871bb6e 100644
--- a/engines/xeen/interface.cpp
+++ b/engines/xeen/interface.cpp
@@ -1088,17 +1088,13 @@ void Interface::rest() {
while (!_vm->shouldQuit() && events.timeElapsed() < 7)
events.pollEventsAndWait();
- File f("dreams2.voc");
- sound.playSample(&f, 1);
- while (!_vm->shouldQuit() && sound.playSample(1, 0))
+ sound.playSound("dreams2.voc", 1);
+ while (!_vm->shouldQuit() && sound.isPlaying())
events.pollEventsAndWait();
- f.close();
- f.openFile("laff1.voc");
- sound.playSample(&f, 1);
- while (!_vm->shouldQuit() && sound.playSample(1, 0))
+ sound.playSound("laff1.voc", 1);
+ while (!_vm->shouldQuit() && sound.isPlaying())
events.pollEventsAndWait();
- f.close();
events.updateGameCounter();
while (!_vm->shouldQuit() && events.timeElapsed() < 7)
@@ -1312,8 +1308,6 @@ void Interface::handleFalling() {
Screen &screen = *_vm->_screen;
Sound &sound = *_vm->_sound;
Window &w = screen._windows[3];
- File voc1("scream.voc");
- File voc2("unnh.voc");
saveFall();
for (uint idx = 0; idx < party._activeParty.size(); ++idx) {
@@ -1323,7 +1317,7 @@ void Interface::handleFalling() {
screen._windows[33].update();
sound.playFX(11);
- sound.playSample(&voc1, 0);
+ sound.playSound("scream.voc");
for (int idx = 0, incr = 2; idx < 133; ++incr, idx += incr) {
fall(idx);
@@ -1335,8 +1329,8 @@ void Interface::handleFalling() {
assembleBorder();
w.update();
- sound.playSample(nullptr, 0);
- sound.playSample(&voc2, 0);
+ sound.stopSound();
+ sound.playSound("unnh.voc");
sound.playFX(31);
fall(127);
diff --git a/engines/xeen/map.cpp b/engines/xeen/map.cpp
index 6816423a19..c683987c91 100644
--- a/engines/xeen/map.cpp
+++ b/engines/xeen/map.cpp
@@ -1069,27 +1069,27 @@ void Map::load(int mapId) {
// Read in the object sprites
_mobData._objectSprites[i]._sprites.load(filename,
- *_vm->_files->_sideArchives[_sideObjects]);
+ _sideObjects ? ALTSIDE_ARCHIVE : GAME_ARCHIVE);
}
// Load sprites for the monsters
for (uint i = 0; i < _mobData._monsterSprites.size(); ++i) {
- CCArchive *archive = _vm->_files->_sideArchives[
+ ArchiveType archiveType =
_mobData._monsterSprites[i]._spriteId == 91 && _vm->getGameID() == GType_WorldOfXeen ?
- 0 : _sideMonsters];
+ ALTSIDE_ARCHIVE : GAME_ARCHIVE;
filename = Common::String::format("%03d.mon", _mobData._monsterSprites[i]._spriteId);
- _mobData._monsterSprites[i]._sprites.load(filename, *archive);
+ _mobData._monsterSprites[i]._sprites.load(filename, archiveType);
filename = Common::String::format("%03d.att", _mobData._monsterSprites[i]._spriteId);
- _mobData._monsterSprites[i]._attackSprites.load(filename, *archive);
+ _mobData._monsterSprites[i]._attackSprites.load(filename, archiveType);
}
// Load wall picture sprite resources
for (uint i = 0; i < _mobData._wallItemSprites.size(); ++i) {
filename = Common::String::format("%03d.pic", _mobData._wallItems[i]._spriteId);
_mobData._wallItemSprites[i]._sprites.load(filename,
- *_vm->_files->_sideArchives[_sidePictures]);
+ _sidePictures ? ALTSIDE_ARCHIVE : GAME_ARCHIVE);
}
// Handle loading miscellaneous sprites for the map
diff --git a/engines/xeen/music.cpp b/engines/xeen/music.cpp
index ae3d5aba83..ef6bb6237a 100644
--- a/engines/xeen/music.cpp
+++ b/engines/xeen/music.cpp
@@ -31,37 +31,52 @@ namespace Xeen {
/*------------------------------------------------------------------------*/
-MusicDriver::MusicDriver() : _fieldF(false), _field1E(false), _lowMusicIgnored(false),
+MusicDriver::MusicDriver() : _musicPlaying(false), _fxPlaying(false),
_musCountdownTimer(0), _fxCountdownTimer(0), _musDataPtr(nullptr),
- _fxDataPtr(nullptr), _fxStartPtr(nullptr), _musStartPtr(nullptr) {
+ _fxDataPtr(nullptr), _fxStartPtr(nullptr), _musStartPtr(nullptr),
+ _exclude7(false), _frameCtr(0) {
_channels.resize(CHANNEL_COUNT);
}
+MusicDriver::~MusicDriver() {
+ _musicPlaying = _fxPlaying = false;
+ _musCountdownTimer = _fxCountdownTimer = 0;
+}
+
void MusicDriver::execute() {
bool isFX = false;
- bool flag = !_field1E;
- const byte *srcP = _musDataPtr;
+ const byte *srcP = nullptr;
+ const byte *startP = nullptr;
+
+ // Single iteration loop to avoid use of GOTO
+ do {
+ if (_musicPlaying) {
+ startP = _musStartPtr;
+ srcP = _musDataPtr;
+ isFX = false;
+ if (_musCountdownTimer == 0 || --_musCountdownTimer == 0)
+ break;
+ }
- if (!flag) {
- if (_musCountdownTimer && --_musCountdownTimer == 0)
- flag = true;
- }
- if (flag && _lowMusicIgnored) {
- srcP = _fxDataPtr;
- isFX = true;
- if (!_fxCountdownTimer || --_fxCountdownTimer == 0)
- flag = false;
- }
+ if (_fxPlaying) {
+ startP = _fxStartPtr;
+ srcP = _fxDataPtr;
+ isFX = true;
+ if (_fxCountdownTimer == 0 || --_fxCountdownTimer == 0)
+ break;
+ }
- if (flag) {
- // Do paused handling and exit immediately
pausePostProcess();
return;
- }
+ } while (0);
+
+ ++_frameCtr;
+ debugC(3, kDebugSound, "\nMusicDriver frame - #%x", _frameCtr);
// Main loop
bool breakFlag = false;
while (!breakFlag) {
+ debugCN(3, kDebugSound, "MUSCODE %.4x - %.2x ", (srcP - startP), *srcP);
byte nextByte = *srcP++;
int cmd = (nextByte >> 4) & 15;
int param = (nextByte & 15);
@@ -73,6 +88,7 @@ void MusicDriver::execute() {
bool MusicDriver::musCallSubroutine(const byte *&srcP, byte param) {
+ debugC(3, kDebugSound, "musCallSubroutine");
if (_musSubroutines.size() < 16) {
const byte *returnP = srcP + 2;
srcP = _musStartPtr + READ_LE_UINT16(srcP);
@@ -86,9 +102,10 @@ bool MusicDriver::musCallSubroutine(const byte *&srcP, byte param) {
bool MusicDriver::musSetCountdown(const byte *&srcP, byte param) {
// Set the countdown timer
if (!param)
- param = *++srcP;
+ param = *srcP++;
_musCountdownTimer = param;
_musDataPtr = srcP;
+ debugC(3, kDebugSound, "musSetCountdown %d", param);
// Do paused handling and break out of processing loop
pausePostProcess();
@@ -96,22 +113,26 @@ bool MusicDriver::musSetCountdown(const byte *&srcP, byte param) {
}
bool MusicDriver::cmdNoOperation(const byte *&srcP, byte param) {
+ debugC(3, kDebugSound, "cmdNoOperation");
return false;
}
bool MusicDriver::musSkipWord(const byte *&srcP, byte param) {
+ debugC(3, kDebugSound, "musSkipWord");
srcP += 2;
return false;
}
-
bool MusicDriver::cmdFreezeFrequency(const byte *&srcP, byte param) {
+ debugC(3, kDebugSound, "cmdFreezeFrequency %d", param);
_channels[param]._changeFrequency = false;
return false;
}
bool MusicDriver::cmdChangeFrequency(const byte *&srcP, byte param) {
- if (param != 7 || !_fieldF) {
+ debugC(3, kDebugSound, "cmdChangeFrequency %d", param);
+
+ if (param != 7 || !_exclude7) {
_channels[param]._freqCtrChange = (int8)*srcP++;
_channels[param]._freqCtr = 0xFF;
_channels[param]._changeFrequency = true;
@@ -125,16 +146,22 @@ bool MusicDriver::cmdChangeFrequency(const byte *&srcP, byte param) {
}
bool MusicDriver::musEndSubroutine(const byte *&srcP, byte param) {
+ debugC(3, kDebugSound, "musEndSubroutine %d", param);
+
if (param != 15) {
- _field1E = 0;
+ // Music has ended, so flag it stopped
+ _musicPlaying = false;
return true;
}
+ // Returning from subroutine, or looping back to start of music
srcP = _musSubroutines.empty() ? _musStartPtr : _musSubroutines.pop()._returnP;
return false;
}
bool MusicDriver::fxCallSubroutine(const byte *&srcP, byte param) {
+ debugC(3, kDebugSound, "fxCallSubroutine");
+
if (_fxSubroutines.size() < 16) {
const byte *startP = srcP + 2;
srcP = _musStartPtr + READ_LE_UINT16(srcP);
@@ -148,9 +175,10 @@ bool MusicDriver::fxCallSubroutine(const byte *&srcP, byte param) {
bool MusicDriver::fxSetCountdown(const byte *&srcP, byte param) {
// Set the countdown timer
if (!param)
- param = *++srcP;
+ param = *srcP++;
_fxCountdownTimer = param;
- _musDataPtr = srcP;
+ _fxDataPtr = srcP;
+ debugC(3, kDebugSound, "fxSetCountdown %d", param);
// Do paused handling and break out of processing loop
pausePostProcess();
@@ -158,8 +186,11 @@ bool MusicDriver::fxSetCountdown(const byte *&srcP, byte param) {
}
bool MusicDriver::fxEndSubroutine(const byte *&srcP, byte param) {
+ debugC(3, kDebugSound, "fxEndSubroutine %d", param);
+
if (param != 15) {
- _lowMusicIgnored = false;
+ // FX has ended, so flag it stopped
+ _fxPlaying = false;
return true;
}
@@ -168,25 +199,39 @@ bool MusicDriver::fxEndSubroutine(const byte *&srcP, byte param) {
}
void MusicDriver::playFX(uint effectId, const byte *data) {
- if (!_lowMusicIgnored || effectId < 7 || effectId >= 11) {
+ if (!_fxPlaying || effectId < 7 || effectId >= 11) {
_musStartPtr = nullptr;
_fxDataPtr = _fxStartPtr = data;
_fxCountdownTimer = 0;
_channels[7]._changeFrequency = _channels[8]._changeFrequency = false;
resetFX();
- _lowMusicIgnored = true;
+ _fxPlaying = true;
+ }
+
+ debugC(1, kDebugSound, "Starting FX %d", effectId);
+}
+
+void MusicDriver::stopFX() {
+ if (_fxPlaying) {
+ resetFX();
+ _fxPlaying = false;
+ _fxStartPtr = _fxDataPtr = nullptr;
}
}
void MusicDriver::playSong(const byte *data) {
- _musDataPtr = data;
+ _musDataPtr = _musStartPtr = data;
_musSubroutines.clear();
_musCountdownTimer = 0;
- _field1E = true;
+ _musicPlaying = true;
+ debugC(1, kDebugSound, "Starting song");
}
int MusicDriver::songCommand(uint commandId, byte volume) {
- if (RESTART_MUSIC == 1) {
+ if (commandId == STOP_SONG) {
+ _musicPlaying = false;
+ } else if (commandId == RESTART_SONG) {
+ _musicPlaying = true;
_musDataPtr = nullptr;
_musSubroutines.clear();
}
@@ -195,25 +240,25 @@ int MusicDriver::songCommand(uint commandId, byte volume) {
}
const CommandFn MusicDriver::MUSIC_COMMANDS[16] = {
- &MusicDriver::musCallSubroutine, &MusicDriver::musSetCountdown,
- &MusicDriver::musSetInstrument, &MusicDriver::cmdNoOperation,
- &MusicDriver::musSetPitchWheel, &MusicDriver::musSkipWord,
- &MusicDriver::musSetPanning, &MusicDriver::cmdNoOperation,
- &MusicDriver::musFade, &MusicDriver::musStartNote,
- &MusicDriver::musSetVolume, &MusicDriver::musInjectMidi,
- &MusicDriver::musPlayInstrument, &MusicDriver::cmdFreezeFrequency,
- &MusicDriver::cmdChangeFrequency, &MusicDriver::musEndSubroutine
+ &MusicDriver::musCallSubroutine, &MusicDriver::musSetCountdown,
+ &MusicDriver::musSetInstrument, &MusicDriver::cmdNoOperation,
+ &MusicDriver::musSetPitchWheel, &MusicDriver::musSkipWord,
+ &MusicDriver::musSetPanning, &MusicDriver::cmdNoOperation,
+ &MusicDriver::musFade, &MusicDriver::musStartNote,
+ &MusicDriver::musSetVolume, &MusicDriver::musInjectMidi,
+ &MusicDriver::musPlayInstrument, &MusicDriver::cmdFreezeFrequency,
+ &MusicDriver::cmdChangeFrequency, &MusicDriver::musEndSubroutine
};
const CommandFn MusicDriver::FX_COMMANDS[16] = {
- &MusicDriver::fxCallSubroutine, &MusicDriver::fxSetCountdown,
- &MusicDriver::fxSetInstrument, &MusicDriver::fxSetVolume,
- &MusicDriver::fxMidiReset, &MusicDriver::fxMidiDword,
- &MusicDriver::fxSetPanning, &MusicDriver::fxChannelOff,
- &MusicDriver::fxFade, &MusicDriver::fxStartNote,
- &MusicDriver::cmdNoOperation, &MusicDriver::fxInjectMidi,
- &MusicDriver::fxPlayInstrument, &MusicDriver::cmdFreezeFrequency,
- &MusicDriver::cmdChangeFrequency, &MusicDriver::fxEndSubroutine
+ &MusicDriver::fxCallSubroutine, &MusicDriver::fxSetCountdown,
+ &MusicDriver::fxSetInstrument, &MusicDriver::fxSetVolume,
+ &MusicDriver::fxMidiReset, &MusicDriver::fxMidiDword,
+ &MusicDriver::fxSetPanning, &MusicDriver::fxChannelOff,
+ &MusicDriver::fxFade, &MusicDriver::fxStartNote,
+ &MusicDriver::cmdNoOperation, &MusicDriver::fxInjectMidi,
+ &MusicDriver::fxPlayInstrument, &MusicDriver::cmdFreezeFrequency,
+ &MusicDriver::cmdChangeFrequency, &MusicDriver::fxEndSubroutine
};
/*------------------------------------------------------------------------*/
@@ -258,20 +303,21 @@ void AdlibMusicDriver::playSong(const byte *data) {
Common::StackLock slock(_driverMutex);
MusicDriver::playSong(data);
_field180 = 0;
+ resetFrequencies();
}
int AdlibMusicDriver::songCommand(uint commandId, byte volume) {
Common::StackLock slock(_driverMutex);
+ MusicDriver::songCommand(commandId, volume);
- if (commandId == STOP_MUSIC) {
- _field1E = 0;
+ if (commandId == STOP_SONG) {
_field180 = 0;
resetFrequencies();
- } else if (commandId == RESTART_MUSIC) {
+ } else if (commandId == RESTART_SONG) {
_field180 = 0;
- _field1E = true;
+ _musicPlaying = true;
} else if (commandId < 0x100) {
- if (_field1E) {
+ if (_musicPlaying) {
_field180 = commandId;
_field182 = 63;
}
@@ -286,6 +332,7 @@ int AdlibMusicDriver::songCommand(uint commandId, byte volume) {
void AdlibMusicDriver::write(int reg, int val) {
_queue.push(RegisterValue(reg, val));
+ debugC(9, kDebugSound, "%.2x %.2x", reg, val);
}
void AdlibMusicDriver::flush() {
@@ -300,7 +347,7 @@ void AdlibMusicDriver::flush() {
void AdlibMusicDriver::pausePostProcess() {
if (_field180 && ((_field181 += _field180) < 0)) {
if (--_field182 < 0) {
- _field1E = false;
+ _musicPlaying = false;
_field180 = 0;
resetFrequencies();
} else {
@@ -311,7 +358,7 @@ void AdlibMusicDriver::pausePostProcess() {
}
}
- for (int channelNum = 8; channelNum != 6 || (channelNum == 7 && _fieldF); --channelNum) {
+ for (int channelNum = 8; channelNum != 6 || (channelNum == 7 && _exclude7); --channelNum) {
Channel &chan = _channels[channelNum];
if (!chan._changeFrequency || (chan._freqCtr += chan._freqCtrChange) >= 0)
continue;
@@ -349,7 +396,7 @@ void AdlibMusicDriver::pausePostProcess() {
}
void AdlibMusicDriver::resetFX() {
- if (!_fieldF) {
+ if (!_exclude7) {
_channels[7]._frequency = 0;
setFrequency(7, 0);
_channels[7]._volume = 63;
@@ -386,7 +433,7 @@ void AdlibMusicDriver::setOutputLevel(byte channelNum, uint level) {
void AdlibMusicDriver::playInstrument(byte channelNum, const byte *data) {
byte op1 = OPERATOR1_INDEXES[channelNum];
byte op2 = OPERATOR2_INDEXES[channelNum];
-
+ debugC(2, kDebugSound, "---START-playInstrument - %d", channelNum);
write(0x20 + op1, *data++);
write(0x40 + op1, *data++);
write(0x60 + op1, *data++);
@@ -408,10 +455,13 @@ void AdlibMusicDriver::playInstrument(byte channelNum, const byte *data) {
write(0x60 + op2, *data++);
write(0x80 + op2, *data++);
write(0xE0 + op2, *data++);
- write(0xC0 + op2, *data++);
+ write(0xC0 + channelNum, *data++);
+
+ debugC(2, kDebugSound, "---END-playInstrument");
}
bool AdlibMusicDriver::musSetInstrument(const byte *&srcP, byte param) {
+ debugC(3, kDebugSound, "musSetInstrument %d", param);
_musInstrumentPtrs[param] = srcP;
srcP += 26;
@@ -420,12 +470,14 @@ bool AdlibMusicDriver::musSetInstrument(const byte *&srcP, byte param) {
bool AdlibMusicDriver::musSetPitchWheel(const byte *&srcP, byte param) {
// Adlib does not support this
+ debugC(3, kDebugSound, "musSetPitchWheel");
srcP += 2;
return false;
}
bool AdlibMusicDriver::musSetPanning(const byte *&srcP, byte param) {
// Adlib does not support this
+ debugC(3, kDebugSound, "musSetPanning");
++srcP;
return false;
}
@@ -434,6 +486,7 @@ bool AdlibMusicDriver::musFade(const byte *&srcP, byte param) {
++srcP;
if (param < 7)
setFrequency(param, _channels[param]._frequency);
+ debugC(3, kDebugSound, "musFade");
return false;
}
@@ -443,18 +496,24 @@ bool AdlibMusicDriver::musStartNote(const byte *&srcP, byte param) {
byte note = *srcP++;
++srcP; // Second byte is fade, which is unused by Adlib
uint freq = calcFrequency(note);
+ debugC(3, kDebugSound, "musStartNote %x -> %x", note, freq);
+
setFrequency(param, freq);
- _channels[param]._frequency = freq | 0x2000;
+ freq |= 0x2000;
+ _channels[param]._frequency = freq;
setFrequency(param, freq);
} else {
srcP += 2;
+ debugC(3, kDebugSound, "musStartNote skipped");
}
return false;
}
bool AdlibMusicDriver::musSetVolume(const byte *&srcP, byte param) {
- if (*srcP++ == 2 && !_field180) {
+ debugC(3, kDebugSound, "musSetVolume %d", (int)*srcP);
+
+ if (*srcP++ == 5 && !_field180) {
_channels[param]._volume = *srcP;
setOutputLevel(param, *srcP);
}
@@ -466,6 +525,7 @@ bool AdlibMusicDriver::musSetVolume(const byte *&srcP, byte param) {
bool AdlibMusicDriver::musInjectMidi(const byte *&srcP, byte param) {
// Adlib does not support MIDI. So simply keep skipping over bytes
// until an 'F7' byte is found that flags the end of the MIDI data
+ debugC(3, kDebugSound, "musInjectMidi");
while (*srcP++ != 0xF7)
;
@@ -473,13 +533,17 @@ bool AdlibMusicDriver::musInjectMidi(const byte *&srcP, byte param) {
}
bool AdlibMusicDriver::musPlayInstrument(const byte *&srcP, byte param) {
+ byte instrument = *srcP++;
+ debugC(3, kDebugSound, "musPlayInstrument %d, %d", param, instrument);
+
if (param < 7)
- playInstrument(param, _musInstrumentPtrs[param]);
+ playInstrument(param, _musInstrumentPtrs[instrument]);
return false;
}
bool AdlibMusicDriver::fxSetInstrument(const byte *&srcP, byte param) {
+ debugC(3, kDebugSound, "fxSetInstrument %d", param);
_fxInstrumentPtrs[param] = srcP;
srcP += 11;
@@ -487,7 +551,9 @@ bool AdlibMusicDriver::fxSetInstrument(const byte *&srcP, byte param) {
}
bool AdlibMusicDriver::fxSetVolume(const byte *&srcP, byte param) {
- if (!_field180 && (!_fieldF || param != 7)) {
+ debugC(3, kDebugSound, "fxSetVolume %d", (int)*srcP);
+
+ if (!_field180 && (!_exclude7 || param != 7)) {
_channels[param]._volume = *srcP;
setOutputLevel(param, *srcP);
}
@@ -497,16 +563,20 @@ bool AdlibMusicDriver::fxSetVolume(const byte *&srcP, byte param) {
}
bool AdlibMusicDriver::fxMidiReset(const byte *&srcP, byte param) {
+ debugC(3, kDebugSound, "fxMidiReset");
return false;
}
bool AdlibMusicDriver::fxMidiDword(const byte *&srcP, byte param) {
+ debugC(3, kDebugSound, "fxMidiDword");
return false;
}
bool AdlibMusicDriver::fxSetPanning(const byte *&srcP, byte param) {
byte note = *srcP++;
- if (!_fieldF || param != 7) {
+ debugC(3, kDebugSound, "fxSetPanning - %x", note);
+
+ if (!_exclude7 || param != 7) {
uint freq = calcFrequency(note);
setFrequency(param, freq);
_channels[param]._frequency = freq;
@@ -516,6 +586,7 @@ bool AdlibMusicDriver::fxSetPanning(const byte *&srcP, byte param) {
}
bool AdlibMusicDriver::fxChannelOff(const byte *&srcP, byte param) {
+ debugC(3, kDebugSound, "fxChannelOff %d", param);
_channels[param]._frequency &= ~0x2000;
write(0xB0 + param, _channels[param]._frequency);
return false;
@@ -523,7 +594,9 @@ bool AdlibMusicDriver::fxChannelOff(const byte *&srcP, byte param) {
bool AdlibMusicDriver::fxFade(const byte *&srcP, byte param) {
uint freq = calcFrequency(*srcP++);
- if (!_fieldF || param != 7) {
+ debugC(3, kDebugSound, "fxFade %d %x", param, freq);
+
+ if (!_exclude7 || param != 7) {
_channels[param]._frequency = freq;
setFrequency(param, freq);
}
@@ -532,14 +605,18 @@ bool AdlibMusicDriver::fxFade(const byte *&srcP, byte param) {
}
bool AdlibMusicDriver::fxStartNote(const byte *&srcP, byte param) {
- if (!_fieldF || param != 7) {
+ if (!_exclude7 || param != 7) {
byte note = *srcP++;
uint freq = calcFrequency(note);
+ debugC(3, kDebugSound, "fxStartNote %x -> %x", note, freq);
+
setFrequency(param, freq);
- _channels[param]._frequency = freq | 0x2000;
+ freq |= 0x2000;
+ _channels[param]._frequency = freq;
setFrequency(param, freq);
} else {
++srcP;
+ debugC(3, kDebugSound, "fxStartNote skipped");
}
return false;
@@ -549,12 +626,16 @@ bool AdlibMusicDriver::fxInjectMidi(const byte *&srcP, byte param) {
// Surpringly, unlike the musInjectMidi, this version doesn't have
// any logic to skip over following MIDI data. Which must mean the opcode
// and/or it's data aren't present in the admus driver file
+ debugC(3, kDebugSound, "fxInjectMidi");
return false;
}
bool AdlibMusicDriver::fxPlayInstrument(const byte *&srcP, byte param) {
- if (!_fieldF || param != 7)
- playInstrument(param, _fxInstrumentPtrs[param]);
+ byte instrument = *srcP++;
+ debugC(3, kDebugSound, "fxPlayInstrument %d, %d", param, instrument);
+
+ if (!_exclude7 || param != 7)
+ playInstrument(param, _fxInstrumentPtrs[instrument]);
return false;
}
@@ -576,50 +657,68 @@ const uint AdlibMusicDriver::WAVEFORMS[24] = {
/*------------------------------------------------------------------------*/
-Music::Music(Audio::Mixer *mixer) : _mixer(mixer), _musicDriver(nullptr),
- _songData(nullptr) {
- _mixer = mixer;
+Music::Music() : _musicDriver(nullptr), _songData(nullptr),
+ _archiveType(ANY_ARCHIVE), _effectsData(nullptr) {
_musicDriver = new AdlibMusicDriver();
- loadEffectsData();
}
Music::~Music() {
+ stopSong();
delete _musicDriver;
delete[] _effectsData;
delete[] _songData;
}
void Music::loadEffectsData() {
- File file("admus");
- Common::String md5str = Common::computeStreamMD5AsString(file, 8192);
+ // Check whether it's the first load, or switching from intro to game data
+ if (_effectsData && !(_archiveType == INTRO_ARCHIVE && File::_currentArchive != INTRO_ARCHIVE))
+ return;
- if (md5str != "be8989a5e868913f0e53963046e3ea13")
- error("Unknown music driver encountered");
+ // Stop any prior FX
+ stopFX();
+ delete[] _effectsData;
+ _archiveType = File::_currentArchive;
- // Load in the driver data
+ // Load in an entire driver so we have quick access to the effects data
+ // that's hardcoded within it
+ File file("blastmus");
byte *effectsData = new byte[file.size()];
file.seek(0);
file.read(effectsData, file.size());
file.close();
_effectsData = effectsData;
+ // Locate the playFX routine
+ const byte *playFX = effectsData + READ_LE_UINT16(effectsData + 10) + 12;
+ assert(READ_BE_UINT16(playFX + 28) == 0x81FB);
+ uint numEffects = READ_LE_UINT16(playFX + 30);
+
+ assert(READ_BE_UINT16(playFX + 36) == 0x8B87);
+ const byte *table = effectsData + READ_LE_UINT16(playFX + 38);
+
// Extract the effects offsets
- _effectsOffsets.resize(180);
- const int EFFECTS_OFFSET = 0x91D;
- for (int idx = 0; idx < 180; ++idx)
- _effectsOffsets[idx] = READ_LE_UINT16(&effectsData[EFFECTS_OFFSET + idx * 2]);
+ _effectsOffsets.resize(numEffects);
+ for (uint idx = 0; idx < numEffects; ++idx)
+ _effectsOffsets[idx] = READ_LE_UINT16(&table[idx * 2]);
}
void Music::playFX(uint effectId) {
+ stopFX();
+ loadEffectsData();
+
if (effectId < _effectsOffsets.size()) {
const byte *dataP = &_effectsData[_effectsOffsets[effectId]];
_musicDriver->playFX(effectId, dataP);
}
}
+void Music::stopFX() {
+ _musicDriver->stopFX();
+}
+
int Music::songCommand(uint commandId, byte volume) {
int result = _musicDriver->songCommand(commandId, volume);
- if (commandId == STOP_MUSIC) {
+ if (commandId == STOP_SONG) {
delete[] _songData;
_songData = nullptr;
}
@@ -628,8 +727,7 @@ int Music::songCommand(uint commandId, byte volume) {
}
void Music::playSong(Common::SeekableReadStream &stream) {
- if (_songData)
- stopMusic();
+ stopSong();
byte *songData = new byte[stream.size()];
stream.seek(0);
@@ -639,7 +737,7 @@ void Music::playSong(Common::SeekableReadStream &stream) {
_musicDriver->playSong(_songData);
}
-void Music::playSong(const Common::String &name) {
+void Music::playSong(const Common::String &name, int param) {
File f(name);
playSong(f);
}
diff --git a/engines/xeen/music.h b/engines/xeen/music.h
index a715471088..d675a37d08 100644
--- a/engines/xeen/music.h
+++ b/engines/xeen/music.h
@@ -29,6 +29,7 @@
#include "common/mutex.h"
#include "common/queue.h"
#include "common/stack.h"
+#include "xeen/files.h"
#define CHANNEL_COUNT 9
@@ -39,7 +40,7 @@ namespace OPL {
namespace Xeen {
enum MusicCommand {
- STOP_MUSIC = 0, RESTART_MUSIC = 1, SET_VOLUME = 0x100,
+ STOP_SONG = 0, RESTART_SONG = 1, SET_VOLUME = 0x100,
GET_STATUS = 0xFFE0
};
@@ -77,10 +78,10 @@ private:
Common::Stack<Subroutine> _musSubroutines, _fxSubroutines;
int _musCountdownTimer;
int _fxCountdownTimer;
- bool _lowMusicIgnored;
const byte *_fxDataPtr, *_musDataPtr;
const byte *_fxStartPtr;
const byte *_musStartPtr;
+ uint _frameCtr;
private:
/**
* Executes the next command
@@ -90,8 +91,9 @@ private:
bool command(const byte *&srcP);
protected:
Common::Array<Channel> _channels;
- bool _fieldF;
- bool _field1E;
+ bool _exclude7;
+ bool _musicPlaying;
+ bool _fxPlaying;
protected:
/**
* Executes a series of commands until instructed to stop
@@ -148,7 +150,7 @@ public:
/**
* Destructor
*/
- virtual ~MusicDriver() {}
+ virtual ~MusicDriver();
/**
* Starts an special effect playing
@@ -156,6 +158,11 @@ public:
virtual void playFX(uint effectId, const byte *data);
/**
+ * Stop any playing FX
+ */
+ void stopFX();
+
+ /**
* Plays a song
*/
virtual void playSong(const byte *data);
@@ -298,6 +305,7 @@ private:
const byte *_effectsData;
Common::Array<uint16> _effectsOffsets;
const byte *_songData;
+ ArchiveType _archiveType;
private:
/**
* Loads effects data that was embedded in the music driver
@@ -308,11 +316,9 @@ private:
* Updates any playing music
*/
void update();
-
protected:
- Audio::Mixer *_mixer;
public:
- Music(Audio::Mixer *mixer);
+ Music();
~Music();
/**
@@ -321,6 +327,11 @@ public:
void playFX(uint effectId);
/**
+ * Stops any currently playing FX
+ */
+ void stopFX();
+
+ /**
* Executes special music command
*/
int songCommand(uint commandId, byte volume = 0);
@@ -328,12 +339,17 @@ public:
/**
* Stops any currently playing music
*/
- void stopMusic() { songCommand(STOP_MUSIC); }
+ void stopSong() { songCommand(STOP_SONG); }
/**
- * Restart the music
+ * Restart a previously playing song (which must still be loaded)
*/
- void restartMusic() { songCommand(RESTART_MUSIC); }
+ void restartSong() { songCommand(RESTART_SONG); }
+
+ /**
+ * Sets the music volume
+ */
+ void setMusicVolume(byte volume) { songCommand(SET_VOLUME, volume); }
/**
* Plays a song
@@ -343,7 +359,14 @@ public:
/**
* Plays a song
*/
- void playSong(const Common::String &name);
+ void playSong(const Common::String &name, int param = 0);
+
+ /**
+ * Plays a song
+ */
+ void playSong(const byte *data) {
+ _musicDriver->playSong(data);
+ }
};
} // End of namespace Xeen
diff --git a/engines/xeen/screen.cpp b/engines/xeen/screen.cpp
index 03b751a6b9..59978cf3d5 100644
--- a/engines/xeen/screen.cpp
+++ b/engines/xeen/screen.cpp
@@ -438,6 +438,8 @@ void Screen::fadeInner(int step) {
_vm->_events->pollEventsAndWait();
}
+
+ update();
}
void Screen::updatePalette() {
diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp
index 0bf1792b26..64b387499d 100644
--- a/engines/xeen/scripts.cpp
+++ b/engines/xeen/scripts.cpp
@@ -1095,9 +1095,8 @@ void Scripts::cmdSeatTextSml(Common::Array<byte> &params) {
void Scripts::cmdPlayEventVoc(Common::Array<byte> &params) {
Sound &sound = *_vm->_sound;
- sound.playSample(nullptr, 0);
- File f(EVENT_SAMPLES[params[0]]);
- sound.playSample(&f, 1);
+ sound.stopSound();
+ sound.playSound(EVENT_SAMPLES[params[0]], 1);
cmdNoAction(params);
}
diff --git a/engines/xeen/sound.cpp b/engines/xeen/sound.cpp
index 46532fa887..64858dfb1f 100644
--- a/engines/xeen/sound.cpp
+++ b/engines/xeen/sound.cpp
@@ -20,61 +20,45 @@
*
*/
+#include "audio/decoders/raw.h"
#include "audio/decoders/voc.h"
#include "xeen/sound.h"
#include "xeen/xeen.h"
namespace Xeen {
-Sound *Voc::_sound;
-
-Voc::Voc(const Common::String &name) {
- if (!open(name))
- error("Could not open - %s", name.c_str());
-}
-
-void Voc::init(XeenEngine *vm) {
- _sound = vm->_sound;
-}
-
-void Voc::play() {
- _sound->playSound(this, _soundHandle);
-}
-
-void Voc::stop() {
- _sound->stopSound(_soundHandle);
-}
-
/*------------------------------------------------------------------------*/
-Sound::Sound(XeenEngine *vm, Audio::Mixer *mixer): Music(mixer) {
-
+Sound::Sound(XeenEngine *vm, Audio::Mixer *mixer): Music(), _mixer(mixer) {
}
-void Sound::proc2(Common::SeekableReadStream &f) {
- // TODO
+Sound::~Sound() {
+ stopSound();
}
-void Sound::startMusic(int v1) {
- // TODO
-}
+void Sound::playSound(Common::SeekableReadStream &s, int unused) {
+ stopSound();
-void Sound::stopMusic(int id) {
- // TODO
+ Common::SeekableReadStream *srcStream = s.readStream(s.size());
+ Audio::SeekableAudioStream *stream = Audio::makeVOCStream(srcStream,
+ Audio::FLAG_UNSIGNED, DisposeAfterUse::YES);
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, stream);
}
-void Sound::playSound(Common::SeekableReadStream *s, Audio::SoundHandle &soundHandle,
- Audio::Mixer::SoundType soundType) {
- Audio::SeekableAudioStream *stream = Audio::makeVOCStream(s, 0);
- _mixer->playStream(soundType, &soundHandle, stream);
+void Sound::playSound(const Common::String &name, int unused) {
+ File f;
+ if (!f.open(name))
+ error("Could not open sound - %s", name.c_str());
+
+ playSound(f);
}
-void Sound::playMusic(Common::SeekableReadStream *s, Audio::SoundHandle &soundHandle) {
- // TODO
+void Sound::stopSound() {
+ _mixer->stopHandle(_soundHandle);
}
-void Sound::stopSound(Audio::SoundHandle &soundHandle) {
- _mixer->stopHandle(soundHandle);
+bool Sound::isPlaying() const {
+ return _mixer->isSoundHandleActive(_soundHandle);
}
} // End of namespace Xeen
diff --git a/engines/xeen/sound.h b/engines/xeen/sound.h
index 5dd80c0e55..71d44e694b 100644
--- a/engines/xeen/sound.h
+++ b/engines/xeen/sound.h
@@ -32,64 +32,35 @@
namespace Xeen {
-class Sound;
-
-class Voc: public Common::File {
+class Sound : public Music {
private:
- static Sound *_sound;
+ Audio::Mixer *_mixer;
Audio::SoundHandle _soundHandle;
public:
- Voc() {}
- Voc(const Common::String &name);
- virtual ~Voc() { stop(); }
- static void init(XeenEngine *vm);
-
- /**
- * Start playing the sound
- */
- void play();
-
- /**
- * Stop playing the sound
- */
- void stop();
-};
-
-class Sound : public Music {
-public:
Sound(XeenEngine *vm, Audio::Mixer *mixer);
-
- void proc2(Common::SeekableReadStream &f);
-
- void loadMusic(const Common::String &name, int v2) {}
-
- void startMusic(int v1);
-
- void stopMusic(int id);
-
- void playSong(Common::SeekableReadStream &f) {}
+ virtual ~Sound();
/**
* Play a given sound
*/
- void playSound(Common::SeekableReadStream *s, Audio::SoundHandle &soundHandle,
- Audio::Mixer::SoundType soundType = Audio::Mixer::kSFXSoundType);
+ void playSound(Common::SeekableReadStream &s, int unused = 0);
/**
- * Play a given music
+ * Play a given sound
*/
- void playMusic(Common::SeekableReadStream *s, Audio::SoundHandle &soundHandle);
+ void playSound(const Common::String &name, int unused = 0);
/**
* Stop playing a sound
+ * @remarks In the original, passing 1 to playSound stopped the sound
*/
- void stopSound(Audio::SoundHandle &soundHandle);
-
- void playSample(const Common::SeekableReadStream *stream, int v2 = 1) {}
-
- bool playSample(int v1, int v2) { return false; }
+ void stopSound();
- void playFX(int id) {}
+ /**
+ * Returns true if a sound is currently playing
+ * @remarks In the original, passing 0 to playSound returned play status
+ */
+ bool isPlaying() const;
};
} // End of namespace Xeen
diff --git a/engines/xeen/sprites.cpp b/engines/xeen/sprites.cpp
index 4804f0aa66..3758a0f4ad 100644
--- a/engines/xeen/sprites.cpp
+++ b/engines/xeen/sprites.cpp
@@ -71,8 +71,8 @@ void SpriteResource::load(const Common::String &filename) {
load(f);
}
-void SpriteResource::load(const Common::String &filename, Common::Archive &archive) {
- File f(filename, archive);
+void SpriteResource::load(const Common::String &filename, ArchiveType archiveType) {
+ File f(filename, archiveType);
load(f);
}
diff --git a/engines/xeen/sprites.h b/engines/xeen/sprites.h
index 9a241c2100..f660daa053 100644
--- a/engines/xeen/sprites.h
+++ b/engines/xeen/sprites.h
@@ -27,6 +27,7 @@
#include "common/array.h"
#include "common/file.h"
#include "graphics/surface.h"
+#include "xeen/files.h"
#include "xeen/xsurface.h"
namespace Xeen {
@@ -88,7 +89,7 @@ public:
/**
* Load a sprite resource from a given file and archive
*/
- void load(const Common::String &filename, Common::Archive &archive);
+ void load(const Common::String &filename, ArchiveType archiveType);
/**
* Clears the sprite resource
diff --git a/engines/xeen/town.cpp b/engines/xeen/town.cpp
index 7cba3853f2..795d4cddd6 100644
--- a/engines/xeen/town.cpp
+++ b/engines/xeen/town.cpp
@@ -101,7 +101,7 @@ int Town::townAction(int actionId) {
addButton(Common::Rect(288, 108, 312, 128), Common::KEYCODE_ESCAPE, &_icons1);
intf._overallFrame = 1;
- sound.playSample(nullptr, 0);
+ sound.stopSound();
vocName = isDarkCc ? "bank1.voc" : "banker.voc";
break;
@@ -114,7 +114,7 @@ int Town::townAction(int actionId) {
addButton(Common::Rect(234, 74, 308, 82), 0);
addButton(Common::Rect(234, 84, 308, 92), 0);
- sound.playSample(nullptr, 0);
+ sound.stopSound();
vocName = isDarkCc ? "see2.voc" : "whaddayo.voc";
break;
@@ -129,7 +129,7 @@ int Town::townAction(int actionId) {
addButton(Common::Rect(234, 84, 308, 92), 0);
_vm->_mode = MODE_17;
- sound.playSample(nullptr, 0);
+ sound.stopSound();
vocName = isDarkCc ? "parrot1.voc" : "guild10.voc";
break;
@@ -145,7 +145,7 @@ int Town::townAction(int actionId) {
addButton(Common::Rect(234, 84, 308, 92), Common::KEYCODE_r);
_vm->_mode = MODE_17;
- sound.playSample(nullptr, 0);
+ sound.stopSound();
vocName = isDarkCc ? "hello1.voc" : "hello.voc";
break;
@@ -158,7 +158,7 @@ int Town::townAction(int actionId) {
addButton(Common::Rect(234, 74, 308, 82), Common::KEYCODE_u);
addButton(Common::Rect(234, 84, 308, 92), 0);
- sound.playSample(nullptr, 0);
+ sound.stopSound();
vocName = isDarkCc ? "help2.voc" : "maywe2.voc";
break;
@@ -171,7 +171,7 @@ int Town::townAction(int actionId) {
addButton(Common::Rect(281, 108, 305, 128), Common::KEYCODE_ESCAPE, &_icons1);
addButton(Common::Rect(242, 108, 266, 128), Common::KEYCODE_t);
- sound.playSample(nullptr, 0);
+ sound.stopSound();
vocName = isDarkCc ? "training.voc" : "youtrn1.voc";
break;
@@ -203,7 +203,7 @@ int Town::townAction(int actionId) {
break;
}
- sound.loadMusic(TOWN_ACTION_MUSIC[actionId], 223);
+ sound.playSong(TOWN_ACTION_MUSIC[actionId], 223);
_townSprites.resize(TOWN_ACTION_FILES[isDarkCc][actionId]);
for (uint idx = 0; idx < _townSprites.size(); ++idx) {
@@ -239,8 +239,7 @@ int Town::townAction(int actionId) {
if (actionId == 0)
intf._overallFrame = 2;
- File voc(vocName);
- sound.playSample(&voc, 1);
+ sound.playSound(vocName, 1);
do {
townWait();
@@ -253,17 +252,15 @@ int Town::townAction(int actionId) {
case 1:
// Leave blacksmith
if (isDarkCc) {
- sound.playSample(nullptr, 0);
- File f("come1.voc");
- sound.playSample(&f, 1);
+ sound.stopSound();
+ sound.playSound("come1.voc", 1);
}
break;
case 3: {
// Leave Tavern
- sound.playSample(nullptr, 0);
- File f(isDarkCc ? "gdluck1.voc" : "goodbye.voc");
- sound.playSample(&f, 1);
+ sound.stopSound();
+ sound.playSound(isDarkCc ? "gdluck1.voc" : "goodbye.voc", 1);
map.mazeData()._mazeNumber = party._mazeId;
break;
@@ -559,10 +556,9 @@ Character *Town::doGuildOptions(Character *c) {
intf.highlightChar(_buttonValue);
if (!c->guildMember()) {
- sound.playSample(nullptr, 0);
+ sound.stopSound();
intf._overallFrame = 5;
- File f(isDarkCc ? "skull1.voc" : "guild11.voc");
- sound.playSample(&f, 1);
+ sound.playSound(isDarkCc ? "skull1.voc" : "guild11.voc", 1);
}
}
} else if (_buttonValue == Common::KEYCODE_s) {
@@ -608,9 +604,8 @@ Character *Town::doTavernOptions(Character *c) {
// Drink
if (!c->noActions()) {
if (party.subtract(0, 1, 0, WT_2)) {
- sound.playSample(nullptr, 0);
- File f("gulp.voc");
- sound.playSample(&f, 0);
+ sound.stopSound();
+ sound.playSound("gulp.voc");
_v21 = 1;
screen._windows[10].writeString(Common::String::format(TAVERN_TEXT,
@@ -668,9 +663,8 @@ Character *Town::doTavernOptions(Character *c) {
ErrorScroll::show(_vm, FOOD_PACKS_FULL, WT_2);
} else if (party.subtract(0, _v23, 0, WT_2)) {
party._food = _v22;
- sound.playSample(nullptr, 0);
- File f(isDarkCc ? "thanks2.voc" : "thankyou.voc");
- sound.playSample(&f, 1);
+ sound.stopSound();
+ sound.playSound(isDarkCc ? "thanks2.voc" : "thankyou.voc", 1);
}
}
@@ -747,9 +741,8 @@ Character *Town::doTavernOptions(Character *c) {
screen._windows[10].update();
townWait();
} else if (party.subtract(0, 1, 0, WT_2)) {
- sound.playSample(nullptr, 0);
- File f(isDarkCc ? "thanks2.voc" : "thankyou.voc");
- sound.playSample(&f, 1);
+ sound.stopSound();
+ sound.playSound(isDarkCc ? "thanks2.voc" : "thankyou.voc", 1);
if (party._mazeId == (isDarkCc ? 29 : 28)) {
_v24 = 30;
@@ -808,9 +801,8 @@ Character *Town::doTempleOptions(Character *c) {
case Common::KEYCODE_d:
if (_donation && party.subtract(0, _donation, 0, WT_2)) {
- sound.playSample(nullptr, 0);
- File f("coina.voc");
- sound.playSample(&f, 1);
+ sound.stopSound();
+ sound.playSound("coina.voc", 1);
_dayOfWeek = (_dayOfWeek + 1) / 10;
if (_dayOfWeek == (party._day / 10)) {
@@ -824,9 +816,8 @@ Character *Town::doTempleOptions(Character *c) {
party._blessed = amt;
intf.drawParty(true);
- sound.playSample(nullptr, 0);
- Voc voc("ahh.voc");
- voc.play();
+ sound.stopSound();
+ sound.playSound("ahh.voc");
_flag1 = true;
_donation = 0;
}
@@ -855,9 +846,8 @@ Character *Town::doTempleOptions(Character *c) {
_v1 = 1440;
intf.drawParty(true);
- sound.playSample(nullptr, 0);
- File f("ahh.voc");
- sound.playSample(&f, 1);
+ sound.stopSound();
+ sound.playSound("ahh.voc", 1);
}
break;
@@ -872,9 +862,8 @@ Character *Town::doTempleOptions(Character *c) {
_v1 = 1440;
intf.drawParty(true);
- sound.playSample(nullptr, 0);
- File f("ahh.voc");
- sound.playSample(&f, 1);
+ sound.stopSound();
+ sound.playSound("ahh.voc", 1);
}
break;
@@ -909,7 +898,7 @@ Character *Town::doTrainingOptions(Character *c) {
case Common::KEYCODE_t:
if (_experienceToNextLevel) {
- sound.playSample(nullptr, 0);
+ sound.stopSound();
_drawFrameIndex = 0;
Common::String name;
@@ -919,15 +908,13 @@ Character *Town::doTrainingOptions(Character *c) {
name = isDarkCc ? "gtlost.voc" : "trainin0.voc";
}
- File f(name);
- sound.playSample(&f);
+ sound.playSound(name);
} else if (!c->noActions()) {
if (party.subtract(0, (c->_level._permanent * c->_level._permanent) * 10, 0, WT_2)) {
_drawFrameIndex = 0;
- sound.playSample(nullptr, 0);
- File f(isDarkCc ? "prtygd.voc" : "trainin2.voc");
- sound.playSample(&f, 1);
+ sound.stopSound();
+ sound.playSound(isDarkCc ? "prtygd.voc" : "trainin2.voc", 1);
c->_experience -= c->nextExperienceLevel() -
(c->getCurrentExperience() - c->_experience);
@@ -983,7 +970,7 @@ void Town::depositWithdrawl(int choice) {
drawButtons(&screen._windows[35]);
screen._windows[35].update();
- sound.playSample(nullptr, 0);
+ sound.stopSound();
File voc("coina.voc");
bool flag = false;
@@ -1038,7 +1025,7 @@ void Town::depositWithdrawl(int choice) {
gems = party._gems;
}
- sound.playSample(&voc, 0);
+ sound.playSound(voc);
msg = Common::String::format(GOLD_GEMS_2, DEPOSIT_WITHDRAWL[choice],
XeenEngine::printMil(gold).c_str(), XeenEngine::printMil(gems).c_str());
screen._windows[35].writeString(msg);
@@ -1061,7 +1048,7 @@ void Town::drawTownAnim(bool flag) {
bool isDarkCc = _vm->_files->_isDarkCc;
if (_townActionId == 1) {
- if (sound.playSample(1, 0)) {
+ if (sound.isPlaying()) {
if (isDarkCc) {
_townSprites[_drawFrameIndex / 8].draw(screen, _drawFrameIndex % 8, _townPos);
_townSprites[2].draw(screen, _vm->getRandomNumber(11) == 1 ? 9 : 10,
@@ -1085,9 +1072,9 @@ void Town::drawTownAnim(bool flag) {
switch (_townActionId) {
case 0:
- if (sound.playSample(1, 0) || (isDarkCc && intf._overallFrame)) {
+ if (sound.isPlaying() || (isDarkCc && intf._overallFrame)) {
if (isDarkCc) {
- if (sound.playSample(1, 0) || intf._overallFrame == 1) {
+ if (sound.isPlaying() || intf._overallFrame == 1) {
_townSprites[4].draw(screen, _vm->getRandomNumber(13, 18),
Common::Point(8, 30));
} else if (intf._overallFrame > 1) {
@@ -1103,7 +1090,7 @@ void Town::drawTownAnim(bool flag) {
break;
case 2:
- if (sound.playSample(1, 0)) {
+ if (sound.isPlaying()) {
if (isDarkCc) {
if (intf._overallFrame) {
intf._overallFrame ^= 1;
@@ -1116,19 +1103,19 @@ void Town::drawTownAnim(bool flag) {
break;
case 3:
- if (sound.playSample(1, 0) && isDarkCc) {
+ if (sound.isPlaying() && isDarkCc) {
_townSprites[4].draw(screen, _vm->getRandomNumber(7), Common::Point(153, 49));
}
break;
case 4:
- if (sound.playSample(1, 0)) {
+ if (sound.isPlaying()) {
_townSprites[3].draw(screen, _vm->getRandomNumber(2, 4), Common::Point(8, 8));
}
break;
case 5:
- if (sound.playSample(1, 0)) {
+ if (sound.isPlaying()) {
if (isDarkCc) {
_townSprites[_drawFrameIndex / 8].draw(screen, _drawFrameIndex % 8, _townPos);
}
@@ -1169,8 +1156,7 @@ void Town::drawTownAnim(bool flag) {
sound.playFX(45);
if (_townActionId == 5 && _drawFrameIndex == 23) {
- File f("spit1.voc");
- sound.playSample(&f, 0);
+ sound.playSound("spit1.voc");
}
} else {
if (_townMaxId == 32 && _drawFrameIndex == 0)
diff --git a/engines/xeen/worldofxeen/darkside_cutscenes.cpp b/engines/xeen/worldofxeen/darkside_cutscenes.cpp
index 514bcac901..a30f354d67 100644
--- a/engines/xeen/worldofxeen/darkside_cutscenes.cpp
+++ b/engines/xeen/worldofxeen/darkside_cutscenes.cpp
@@ -32,14 +32,12 @@ bool DarkSideCutscenes::showDarkSideTitle() {
Screen &screen = *_vm->_screen;
Sound &sound = *_vm->_sound;
- // TODO: Starting method, and sound
- //sub_28F40
screen.loadPalette("dark.pal");
SpriteResource nwc[4] = {
SpriteResource("nwc1.int"), SpriteResource("nwc2.int"),
SpriteResource("nwc3.int"), SpriteResource("nwc4.int")
};
- Voc voc[3];
+ File voc[3];
voc[0].open("dragon1.voc");
voc[1].open("dragon2.voc");
voc[2].open("dragon3.voc");
@@ -55,6 +53,9 @@ bool DarkSideCutscenes::showDarkSideTitle() {
screen.draw();
screen.fadeIn(4);
+ sound.setMusicVolume(0x5f);
+ sound.playFX(1);
+
// Initial loop for dragon roaring
int nwcIndex = 0, nwcFrame = 0;
for (int idx = 0; idx < 55 && !_vm->shouldQuit(); ++idx) {
@@ -66,7 +67,7 @@ bool DarkSideCutscenes::showDarkSideTitle() {
switch (idx) {
case 17:
- voc[0].play();
+ sound.playSound(voc[0]);
break;
case 34:
case 44:
@@ -74,7 +75,7 @@ bool DarkSideCutscenes::showDarkSideTitle() {
nwcFrame = 0;
break;
case 35:
- voc[1].play();
+ sound.playSound(voc[1]);
break;
default:
++nwcFrame;
@@ -93,19 +94,19 @@ bool DarkSideCutscenes::showDarkSideTitle() {
switch (idx) {
case 3:
- sound.startMusic(40);
+ sound.playFX(40);
break;
case 11:
- sound.startMusic(0);
+ sound.playFX(0);
case 27:
case 30:
- sound.startMusic(3);
+ sound.playFX(3);
break;
case 31:
- sound.proc2(voc[2]);
+ sound.playSound(voc[2]);
break;
case 33:
- sound.startMusic(2);
+ sound.playFX(2);
break;
default:
break;
@@ -114,21 +115,20 @@ bool DarkSideCutscenes::showDarkSideTitle() {
if (events.wait(2, true))
return false;
}
+ if (_vm->shouldQuit())
+ return false;
// Pause for a bit
if (events.wait(10, true))
return false;
- voc[0].stop();
- voc[1].stop();
- voc[2].stop();
- sound.stopMusic(95);
+ sound.setMusicVolume(95);
- screen.loadBackground("jvc.raw");
screen.fadeOut(8);
+ screen.loadBackground("jvc.raw");
screen.draw();
screen.fadeIn(4);
-
+
events.updateGameCounter();
events.wait(60, true);
return true;
@@ -158,7 +158,7 @@ bool DarkSideCutscenes::showDarkSideIntro() {
SpriteResource sprites[3] = {
SpriteResource("title.int"), SpriteResource("pyratop.int"), SpriteResource("pyramid.int")
};
- Voc voc[2];
+ File voc[2];
voc[0].open("pharoh1a.voc");
voc[1].open("pharoh1b.voc");
@@ -221,7 +221,7 @@ bool DarkSideCutscenes::showDarkSideIntro() {
screen.draw();
if (idx == 2)
- sound.stopMusic(48);
+ sound.setMusicVolume(48);
if (events.wait(2, true))
return false;
}
@@ -236,10 +236,10 @@ bool DarkSideCutscenes::showDarkSideIntro() {
bool DarkSideCutscenes::showDarkSideEnding() {
EventsManager &events = *_vm->_events;
Screen &screen = *_vm->_screen;
- Sound &sound = *_vm->_sound;
+// Sound &sound = *_vm->_sound;
- Voc voc("ido2.voc");
-// Music newBright("newbrigh.m");
+ //Voc voc("ido2.voc");
+ // Music newBright("newbrigh.m");
SpriteResource box("box.vga");
// newBright.play();
diff --git a/engines/xeen/worldofxeen/worldofxeen.cpp b/engines/xeen/worldofxeen/worldofxeen.cpp
index 86a6ee3da7..a71efbb162 100644
--- a/engines/xeen/worldofxeen/worldofxeen.cpp
+++ b/engines/xeen/worldofxeen/worldofxeen.cpp
@@ -34,6 +34,8 @@ WorldOfXeenEngine::WorldOfXeenEngine(OSystem *syst, const XeenGameDescription *g
}
void WorldOfXeenEngine::showIntro() {
+ File::setCurrentArchive(INTRO_ARCHIVE);
+
// **DEBUG**
if (gDebugLevel == 0)
return;
diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp
index c67ee07b69..a07bf1b8af 100644
--- a/engines/xeen/xeen.cpp
+++ b/engines/xeen/xeen.cpp
@@ -34,8 +34,16 @@
namespace Xeen {
+XeenEngine *g_vm = nullptr;
+
XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc)
: Engine(syst), _gameDescription(gameDesc), _randomSource("Xeen") {
+ // Set up debug channels
+ DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
+ DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts");
+ DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics handling");
+ DebugMan.addDebugChannel(kDebugSound, "sound", "Sound processing");
+
_combat = nullptr;
_debugger = nullptr;
_events = nullptr;
@@ -55,6 +63,7 @@ XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc)
_noDirectionSense = false;
_mode = MODE_0;
_startupWindowActive = false;
+ g_vm = this;
}
XeenEngine::~XeenEngine() {
@@ -73,15 +82,10 @@ XeenEngine::~XeenEngine() {
delete _eventData;
delete _resources;
delete _files;
+ g_vm = nullptr;
}
void XeenEngine::initialize() {
- // Set up debug channels
- DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
- DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts");
- DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics handling");
- DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling");
-
// Create sub-objects of the engine
_files = new FileManager(this);
_resources = new Resources();
@@ -98,7 +102,6 @@ void XeenEngine::initialize() {
_sound = new Sound(this, _mixer);
_spells = new Spells(this);
_town = new Town(this);
- Voc::init(this);
File f("029.obj");
_eventData = f.readStream(f.size());
@@ -120,6 +123,7 @@ Common::Error XeenEngine::run() {
showIntro();
if (shouldQuit())
return Common::kNoError;
+ File::setCurrentArchive(GAME_ARCHIVE);
showMainMenu();
if (shouldQuit())
diff --git a/engines/xeen/xeen.h b/engines/xeen/xeen.h
index d0a69394e1..8f641a8343 100644
--- a/engines/xeen/xeen.h
+++ b/engines/xeen/xeen.h
@@ -208,6 +208,8 @@ public:
static Common::String printK2(uint value);
};
+extern XeenEngine *g_vm;
+
} // End of namespace Xeen
#endif /* XEEN_XEEN_H */
diff --git a/gui/themes/translations.dat b/gui/themes/translations.dat
index 49e03a05b9..39158f70c8 100644
--- a/gui/themes/translations.dat
+++ b/gui/themes/translations.dat
Binary files differ
diff --git a/po/hu_HU.po b/po/hu_HU.po
index bfc4e3405d..3203057bd8 100644..100755
--- a/po/hu_HU.po
+++ b/po/hu_HU.po
@@ -1182,7 +1182,7 @@ msgstr "ScummVM mentщsekhez hasznсlt hely ezen a tсrolѓn"
#: gui/options.cpp:1314
msgid "Last sync time:"
-msgstr "Utolsѓ szinkronizсlсs ideje:"
+msgstr "Utolsѓ szinkron:"
#: gui/options.cpp:1314
msgid "When the last saves sync for this storage occured"
diff --git a/po/nl_NL.po b/po/nl_NL.po
index bb6f59d77f..3b4d06b1df 100644
--- a/po/nl_NL.po
+++ b/po/nl_NL.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: ScummVM 1.9.0git\n"
"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
"POT-Creation-Date: 2016-09-05 10:12+0200\n"
-"PO-Revision-Date: 2016-07-05 10:07+0200\n"
+"PO-Revision-Date: 2016-09-15 10:55+0200\n"
"Last-Translator: Ben Castricum <scummvm@bencastricum.nl>\n"
"Language-Team: Ben Castricum <scummvm@bencastricum.nl>\n"
"Language: Nederlands\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: Poedit 1.8.8\n"
+"X-Generator: Poedit 1.8.9\n"
"X-Poedit-SourceCharset: iso-8859-1\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
@@ -78,9 +78,8 @@ msgid "Choose"
msgstr "Selecteer"
#: gui/downloaddialog.cpp:48
-#, fuzzy
msgid "Select directory where to download game data"
-msgstr "Selecteer map met speldata"
+msgstr "Selecteer map voor de te downloaden speldata"
#: gui/downloaddialog.cpp:49 gui/editgamedialog.cpp:472 gui/launcher.cpp:173
msgid "Select directory with game data"
@@ -88,30 +87,30 @@ msgstr "Selecteer map met speldata"
#: gui/downloaddialog.cpp:51 gui/downloaddialog.cpp:263
msgid "From: "
-msgstr ""
+msgstr "Van: "
#: gui/downloaddialog.cpp:52 gui/downloaddialog.cpp:264
msgid "To: "
-msgstr ""
+msgstr "Naar:"
#: gui/downloaddialog.cpp:63
msgid "Cancel download"
-msgstr ""
+msgstr "Download annuleren"
#: gui/downloaddialog.cpp:65
msgctxt "lowres"
msgid "Cancel download"
-msgstr ""
+msgstr "Download annuleren"
#: gui/downloaddialog.cpp:67
msgid "Hide"
-msgstr ""
+msgstr "Verberg"
#: gui/downloaddialog.cpp:117
msgid ""
"It looks like your connection is limited. Do you really want to download "
"files with it?"
-msgstr ""
+msgstr "Uw verbinding lijkt beperkt. Wilt u echt bestanden ermee downloaden?"
#: gui/downloaddialog.cpp:118 gui/downloaddialog.cpp:152
#: gui/filebrowser-dialog.cpp:132 gui/fluidsynth-dialog.cpp:217
@@ -146,6 +145,8 @@ msgid ""
"Cannot create a directory to download - the specified directory has a file "
"with the same name."
msgstr ""
+"Kan geen download folder creыren - de gespecificeerde folder bevat een file "
+"met dezelfde naam."
#: gui/downloaddialog.cpp:146 gui/editgamedialog.cpp:293
#: gui/fluidsynth-dialog.cpp:153 gui/KeysDialog.cpp:42 gui/launcher.cpp:501
@@ -173,16 +174,18 @@ msgid ""
"The \"%s\" already exists in the specified directory.\n"
"Do you really want to download files into that directory?"
msgstr ""
+"De \"%s\" bestaat al in de gespecificeerde map.\n"
+"Wilt u echt bestanden in die map downloaden?"
#: gui/downloaddialog.cpp:251
#, c-format
msgid "Downloaded %s %s / %s %s"
-msgstr ""
+msgstr "%s %s / %s %s gedownload"
#: gui/downloaddialog.cpp:258
-#, fuzzy, c-format
+#, c-format
msgid "Download speed: %s %s"
-msgstr "Klaar met zoeken!"
+msgstr "Download snelheid: %s %s"
#: gui/editgamedialog.cpp:132
msgid "Game"
@@ -411,6 +414,9 @@ msgid ""
"Saves sync feature doesn't work with non-default directories. If you want "
"your saves to sync, use default directory."
msgstr ""
+"Synchronisatie van opgeslagen spellen optie werkt niet met niet-standaard "
+"mappen. Als u de opgeslagen spellen wilt synchroniseren, gebruik dan de "
+"standaard map."
#: gui/editgamedialog.cpp:536
msgid "This game ID is already taken. Please choose another one."
@@ -699,7 +705,7 @@ msgstr ""
#: gui/launcher.cpp:344
msgid "This directory cannot be used yet, it is being downloaded into!"
-msgstr ""
+msgstr "Deze map kan nog niet gebruikt worden, er wordt al in gedownload!"
#: gui/launcher.cpp:394
msgid "Do you really want to remove this game configuration?"
@@ -1153,24 +1159,24 @@ msgstr "Controleer nu"
#: gui/options.cpp:1284
msgid "Cloud"
-msgstr ""
+msgstr "Cloud"
#: gui/options.cpp:1286
msgctxt "lowres"
msgid "Cloud"
-msgstr ""
+msgstr "Cloud"
#: gui/options.cpp:1297
msgid "Storage:"
-msgstr ""
+msgstr "Opslag:"
#: gui/options.cpp:1297
msgid "Active cloud storage"
-msgstr ""
+msgstr "Actieve cloud opslag"
#: gui/options.cpp:1304 gui/options.cpp:1855
msgid "<none>"
-msgstr ""
+msgstr "<geen>"
#: gui/options.cpp:1308 backends/platform/wii/options.cpp:114
msgid "Username:"
@@ -1178,101 +1184,97 @@ msgstr "Gebruikersnaam:"
#: gui/options.cpp:1308
msgid "Username used by this storage"
-msgstr ""
+msgstr "Gebruikersnaam gebruikt voor deze opslag"
#: gui/options.cpp:1311
msgid "Used space:"
-msgstr ""
+msgstr "Gebruikte ruimte:"
#: gui/options.cpp:1311
msgid "Space used by ScummVM's saves on this storage"
-msgstr ""
+msgstr "Ruimte in gebruikt door ScummVM's opgeslagen spellen op deze opslag"
#: gui/options.cpp:1314
msgid "Last sync time:"
-msgstr ""
+msgstr "Laatste synchronisatie:"
#: gui/options.cpp:1314
msgid "When the last saves sync for this storage occured"
-msgstr ""
+msgstr "Wanneer de laatste synchronisatie voor deze opslag is geweest."
#: gui/options.cpp:1317 gui/storagewizarddialog.cpp:72
msgid "Connect"
-msgstr ""
+msgstr "Verbinden"
#: gui/options.cpp:1317
msgid "Open wizard dialog to connect your cloud storage account"
msgstr ""
+"Open de Wizard dialoogvenster voor verbinden met uw cloud opslag account"
#: gui/options.cpp:1318
msgid "Refresh"
-msgstr ""
+msgstr "Ververs"
#: gui/options.cpp:1318
msgid "Refresh current cloud storage information (username and usage)"
-msgstr ""
+msgstr "Ververs de huidige opslag informatie (gebruikersnaam en gebruik)"
#: gui/options.cpp:1319
-#, fuzzy
msgid "Download"
-msgstr "Omlaag"
+msgstr "Download"
#: gui/options.cpp:1319
msgid "Open downloads manager dialog"
-msgstr ""
+msgstr "Open downloads manager dialoogvenster"
#: gui/options.cpp:1321
msgid "Run server"
-msgstr ""
+msgstr "Start server"
#: gui/options.cpp:1321
msgid "Run local webserver"
-msgstr ""
+msgstr "Draai lokale webserver"
#: gui/options.cpp:1322 gui/options.cpp:1965
-#, fuzzy
msgid "Not running"
-msgstr "Fout tijdens het starten van spel:"
+msgstr "Draait niet"
#: gui/options.cpp:1326
-#, fuzzy
msgid "/root/ Path:"
-msgstr "Extra Pad:"
+msgstr "/root/ Pad:"
#: gui/options.cpp:1326 gui/options.cpp:1328 gui/options.cpp:1329
-#, fuzzy
msgid "Specifies which directory the Files Manager can access"
-msgstr "Bepaalt waar opgeslagen spellen worden bewaard."
+msgstr "Bepaalt welke map de Bestanden Manager gebruiken mag"
#: gui/options.cpp:1328
-#, fuzzy
msgctxt "lowres"
msgid "/root/ Path:"
-msgstr "Extra Pad:"
+msgstr "/root/ Pad:"
#: gui/options.cpp:1338
-#, fuzzy
msgid "Server's port:"
-msgstr "Server:"
+msgstr "Serverport:"
#: gui/options.cpp:1338
msgid ""
"Which port is used by the server\n"
"Auth with server is not available with non-default port"
msgstr ""
+"Welke port is gebruikt voor de server\n"
+"Auth met server is niet beschikbaar met een niet standaard port"
#: gui/options.cpp:1498
msgid "You have to restart ScummVM before your changes will take effect."
msgstr "U dient ScummVM opnieuw op te starten om de wijzigingen te activeren."
#: gui/options.cpp:1521
-#, fuzzy
msgid "Failed to change cloud storage!"
-msgstr "Opslaan van spel mislukt."
+msgstr "Veranderen van cloud opslag mislukt!"
#: gui/options.cpp:1524
msgid "Another cloud storage is already active."
-msgstr ""
+msgstr "Er is al een andere cloud opslag actief."
#: gui/options.cpp:1562
msgid "The chosen directory cannot be written to. Please select another one."
@@ -1292,9 +1294,8 @@ msgid "Select directory for plugins"
msgstr "Selecteer map voor plugins"
#: gui/options.cpp:1604
-#, fuzzy
msgid "Select directory for Files Manager /root/"
-msgstr "Selecteer map voor extra bestanden"
+msgstr "Selecteer map voor Bestanden Manager /root/"
#: gui/options.cpp:1666
msgid ""
@@ -1307,31 +1308,29 @@ msgstr ""
#: gui/options.cpp:1862
#, c-format
msgid "%llu bytes"
-msgstr ""
+msgstr "%llu bytes"
#: gui/options.cpp:1870
msgid "<right now>"
-msgstr ""
+msgstr "<nu>"
#: gui/options.cpp:1872
-#, fuzzy
msgid "<never>"
-msgstr "Nooit"
+msgstr "<nooit>"
#: gui/options.cpp:1956
-#, fuzzy
msgid "Stop server"
-msgstr "Server:"
+msgstr "Stop server"
#: gui/options.cpp:1957
msgid "Stop local webserver"
-msgstr ""
+msgstr "Stop lokale webserver"
#: gui/options.cpp:2046
msgid ""
"Request failed.\n"
"Check your Internet connection."
-msgstr ""
+msgstr "Verzoek mislukt. Controleer uw Internet verbinding."
#. I18N: You must leave "#" as is, only word 'next' is translatable
#: gui/predictivedialog.cpp:86
@@ -1405,7 +1404,6 @@ msgid "Unknown Author"
msgstr "Onbekende Auteur"
#: gui/remotebrowser.cpp:128
-#, fuzzy
msgid "ScummVM could not access the directory!"
msgstr "ScummVM kon de opgegeven map niet openen!"
@@ -1477,72 +1475,71 @@ msgstr "Geef een omschrijving voor slot %d:"
#: gui/storagewizarddialog.cpp:56
#, c-format
msgid "%s Storage Connection Wizard"
-msgstr ""
+msgstr "%s Opslag Verbindings Wizard"
#: gui/storagewizarddialog.cpp:59
msgid "Navigate to the following URL:"
-msgstr ""
+msgstr "Navigeer naar de volgende URL:"
#: gui/storagewizarddialog.cpp:62
msgid "Obtain the code from the storage, enter it"
-msgstr ""
+msgstr "Verkrijg de code van de opslag, voer het in"
#: gui/storagewizarddialog.cpp:63
msgid "in the following field and press 'Connect':"
-msgstr ""
+msgstr "in het volgende veld, en druk op 'Verbind';"
#: gui/storagewizarddialog.cpp:70
-#, fuzzy
msgid "Open URL"
-msgstr "OpenGL"
+msgstr "Open URL"
#: gui/storagewizarddialog.cpp:71
msgid "Paste"
-msgstr ""
+msgstr "Plakken"
#: gui/storagewizarddialog.cpp:71
msgid "Pastes clipboard contents into fields"
-msgstr ""
+msgstr "Pakt de inhoud van het clipboard in the velden"
#: gui/storagewizarddialog.cpp:79
msgid "You will be directed to ScummVM's page where"
-msgstr ""
+msgstr "U wordt doorgestuurd naar ScummVM's pagina waar"
#: gui/storagewizarddialog.cpp:80
msgid "you should allow it to access your storage."
-msgstr ""
+msgstr "u zou het toegang moeten geven tot uw opslag"
#: gui/storagewizarddialog.cpp:113
msgid "Another Storage is active. Do you want to interrupt it?"
-msgstr ""
+msgstr "Een andere opslag is actief. Wilt u die onderbreken?"
#: gui/storagewizarddialog.cpp:122
msgid "Wait until current Storage finishes up and try again."
-msgstr ""
+msgstr "Wacht totdat de huidige opslag klaar is en probeer het opnieuw."
#: gui/storagewizarddialog.cpp:183
#, c-format
msgid "Field %s has a mistake in it."
-msgstr ""
+msgstr "Er zit een fout in veld %s."
#: gui/storagewizarddialog.cpp:185
#, c-format
msgid "Fields %s have mistakes in them."
-msgstr ""
+msgstr "Er zitten fouten in de velden %s."
#: gui/storagewizarddialog.cpp:200
msgid "All OK!"
-msgstr ""
+msgstr "Alles OK!"
#: gui/storagewizarddialog.cpp:202
msgid "Invalid code"
-msgstr ""
+msgstr "Ongeldige code"
#: gui/storagewizarddialog.cpp:210
msgid ""
"Failed to open URL!\n"
"Please navigate to this page manually."
-msgstr ""
+msgstr "URL openen mislukt! Navigeer a.u.b. handmatig naar deze pagina."
#: gui/themebrowser.cpp:45
msgid "Select a Theme"
@@ -2023,19 +2020,20 @@ msgid "C64 Audio Emulator"
msgstr "C64 Audio Emulator"
#: backends/cloud/storage.cpp:210
-#, fuzzy
msgid "Saves sync complete."
-msgstr "Klaar met zoeken!"
+msgstr "Klaar met synchronisatie van opgeslagen spellen."
#: backends/cloud/storage.cpp:221
msgid "Saves sync was cancelled."
-msgstr ""
+msgstr "Synchronisatie van opgeslagen spellen was geannuleerd."
#: backends/cloud/storage.cpp:223
msgid ""
"Saves sync failed.\n"
"Check your Internet connection."
msgstr ""
+"Synchronisatie van opgeslagen spellen is mislukt.\n"
+"Controleer a.u.b. uw Internet verbinding."
#: backends/cloud/storage.cpp:327
#, c-format
@@ -2043,16 +2041,16 @@ msgid ""
"Download complete.\n"
"Failed to download %u files."
msgstr ""
+"Download klaar.\n"
+"%u bestanden konden niet gedownload worden."
#: backends/cloud/storage.cpp:329
-#, fuzzy
msgid "Download complete."
-msgstr "Klaar met zoeken!"
+msgstr "Download klaar."
#: backends/cloud/storage.cpp:339
-#, fuzzy
msgid "Download failed."
-msgstr "Laad bestand"
+msgstr "Download mislukt."
#: backends/events/default/default-events.cpp:196
msgid "Do you really want to return to the Launcher?"
@@ -3252,11 +3250,12 @@ msgstr "Gebruik hoge resolutie beelden"
#: engines/sci/detection.cpp:410
msgid "Enable black-lined video"
-msgstr ""
+msgstr "Activeer black-lined video"
#: engines/sci/detection.cpp:411
msgid "Draw black lines over videos to increase their apparent sharpness"
msgstr ""
+"Teken zwarte lijntjes over videos om de scherpte ogenschijnlijk te verhogen"
#: engines/sci/detection.cpp:420
msgid "Prefer digital sound effects"
diff --git a/po/uk_UA.po b/po/uk_UA.po
index e69c92aaae..21f7ecb1ea 100644
--- a/po/uk_UA.po
+++ b/po/uk_UA.po
@@ -6,10 +6,10 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: ScummVM 1.3.0svn\n"
-"Report-Msgid-Bugs-To: scummvm-devel@lists.sf.net\n"
+"Project-Id-Version: ScummVM 1.9.0git\n"
+"Report-Msgid-Bugs-To: scummvm-devel@lists.scummvm.org\n"
"POT-Creation-Date: 2016-09-05 10:12+0200\n"
-"PO-Revision-Date: 2015-11-06 10:07+0300\n"
+"PO-Revision-Date: 2016-09-17 22:36+0200\n"
"Last-Translator: Eugene Sandulenko <sev@scummvm.org>\n"
"Language-Team: Ukrainian\n"
"Language: Ukrainian\n"
@@ -78,9 +78,8 @@ msgid "Choose"
msgstr "Вибрати"
#: gui/downloaddialog.cpp:48
-#, fuzzy
msgid "Select directory where to download game data"
-msgstr "Виберіть папку з файлами гри"
+msgstr "Виберіть папку куди завантажувати файли гри"
#: gui/downloaddialog.cpp:49 gui/editgamedialog.cpp:472 gui/launcher.cpp:173
msgid "Select directory with game data"
@@ -88,30 +87,32 @@ msgstr "Виберіть папку з файлами гри"
#: gui/downloaddialog.cpp:51 gui/downloaddialog.cpp:263
msgid "From: "
-msgstr ""
+msgstr "Від: "
#: gui/downloaddialog.cpp:52 gui/downloaddialog.cpp:264
msgid "To: "
-msgstr ""
+msgstr "До: "
#: gui/downloaddialog.cpp:63
msgid "Cancel download"
-msgstr ""
+msgstr "Припинити завантаження"
#: gui/downloaddialog.cpp:65
msgctxt "lowres"
msgid "Cancel download"
-msgstr ""
+msgstr "Припинити"
#: gui/downloaddialog.cpp:67
msgid "Hide"
-msgstr ""
+msgstr "Сховати"
#: gui/downloaddialog.cpp:117
msgid ""
"It looks like your connection is limited. Do you really want to download "
"files with it?"
msgstr ""
+"Виглядає, що ваше поточне з'єднання лімітовано. Ви насправді хочете зараз "
+"завантажувати файи на цьому з'єднанні?"
#: gui/downloaddialog.cpp:118 gui/downloaddialog.cpp:152
#: gui/filebrowser-dialog.cpp:132 gui/fluidsynth-dialog.cpp:217
@@ -146,6 +147,8 @@ msgid ""
"Cannot create a directory to download - the specified directory has a file "
"with the same name."
msgstr ""
+"Неможливо створити папку для скачування: вказана папка має файл з такою ж "
+"назвою."
#: gui/downloaddialog.cpp:146 gui/editgamedialog.cpp:293
#: gui/fluidsynth-dialog.cpp:153 gui/KeysDialog.cpp:42 gui/launcher.cpp:501
@@ -173,16 +176,18 @@ msgid ""
"The \"%s\" already exists in the specified directory.\n"
"Do you really want to download files into that directory?"
msgstr ""
+"\"%s\" вже існує у вказаній папці.\n"
+"Чи ви дійсно хочете завантажити файли в цю папку?"
#: gui/downloaddialog.cpp:251
#, c-format
msgid "Downloaded %s %s / %s %s"
-msgstr ""
+msgstr "Завантажено %s %s з %s %s"
#: gui/downloaddialog.cpp:258
-#, fuzzy, c-format
+#, c-format
msgid "Download speed: %s %s"
-msgstr "Пошук закінчено!"
+msgstr "Швидкість завантаження: %s %s"
#: gui/editgamedialog.cpp:132
msgid "Game"
@@ -198,7 +203,7 @@ msgid ""
"Short game identifier used for referring to saved games and running the game "
"from the command line"
msgstr ""
-"Короткий ідентифікатор, який використовується для назв збережених ігор і для "
+"Короткий ідентифікатор, який використовується для назв збережений станів ігор і для "
"запуску з командної стрічки"
#: gui/editgamedialog.cpp:138
@@ -266,12 +271,12 @@ msgstr "Грф"
#: gui/editgamedialog.cpp:187
msgid "Override global graphic settings"
-msgstr "Перекрити глобальні установки графіки"
+msgstr "Перекрити глобальні налаштування графіки"
#: gui/editgamedialog.cpp:189
msgctxt "lowres"
msgid "Override global graphic settings"
-msgstr "Перекрити глобальні установки графіки"
+msgstr "Перекрити глобальні налаштування графіки"
#: gui/editgamedialog.cpp:196 gui/options.cpp:1121
msgid "Audio"
@@ -279,12 +284,12 @@ msgstr "Аудіо"
#: gui/editgamedialog.cpp:199
msgid "Override global audio settings"
-msgstr "Перекрити глобальні установки аудіо"
+msgstr "Перекрити глобальні налаштування аудіо"
#: gui/editgamedialog.cpp:201
msgctxt "lowres"
msgid "Override global audio settings"
-msgstr "Перекрити глобальні установки аудіо"
+msgstr "Перекрити глобальні налаштування аудіо"
#: gui/editgamedialog.cpp:210 gui/options.cpp:1126
msgid "Volume"
@@ -297,12 +302,12 @@ msgstr "Гучн."
#: gui/editgamedialog.cpp:215
msgid "Override global volume settings"
-msgstr "Перекрити глобальні установки гучності"
+msgstr "Перекрити глобальні налаштування гучності"
#: gui/editgamedialog.cpp:217
msgctxt "lowres"
msgid "Override global volume settings"
-msgstr "Перекрити глобальні установки гучності"
+msgstr "Перекрити глобальні налаштування гучності"
#: gui/editgamedialog.cpp:226 gui/options.cpp:1136
msgid "MIDI"
@@ -310,12 +315,12 @@ msgstr "MIDI"
#: gui/editgamedialog.cpp:229
msgid "Override global MIDI settings"
-msgstr "Перекрити глобальні установки MIDI"
+msgstr "Перекрити глобальні налаштування MIDI"
#: gui/editgamedialog.cpp:231
msgctxt "lowres"
msgid "Override global MIDI settings"
-msgstr "Перекрити глобальні установки MIDI"
+msgstr "Перекрити глобальні нааштування MIDI"
#: gui/editgamedialog.cpp:241 gui/options.cpp:1146
msgid "MT-32"
@@ -323,12 +328,12 @@ msgstr "MT-32"
#: gui/editgamedialog.cpp:244
msgid "Override global MT-32 settings"
-msgstr "Перекрити глобальні установки MT-32"
+msgstr "Перекрити глобальні налаштування MT-32"
#: gui/editgamedialog.cpp:246
msgctxt "lowres"
msgid "Override global MT-32 settings"
-msgstr "Перекрити глобальні установки MT-32"
+msgstr "Перекрити глобальні налаштування MT-32"
#: gui/editgamedialog.cpp:255 gui/options.cpp:1153
msgid "Paths"
@@ -370,7 +375,7 @@ msgstr "Шлях збер.:"
#: gui/editgamedialog.cpp:283 gui/options.cpp:1163 gui/options.cpp:1165
#: gui/options.cpp:1166
msgid "Specifies where your saved games are put"
-msgstr "Вказує шлях до збережень гри"
+msgstr "Вказує шлях до збережених станів ігор"
#: gui/editgamedialog.cpp:282 gui/options.cpp:1165
msgctxt "lowres"
@@ -404,7 +409,7 @@ msgstr "Виберіть додаткову папку гри"
#: gui/editgamedialog.cpp:504 gui/options.cpp:1555
msgid "Select directory for saved games"
-msgstr "Виберіть папку для збережень"
+msgstr "Виберіть папку для збережених станів ігор"
#: gui/editgamedialog.cpp:510
msgid ""
@@ -622,7 +627,7 @@ msgstr "~З~авантажити..."
#: gui/launcher.cpp:124
msgid "Load saved game for selected game"
-msgstr "Завантажити збереження для вибраної гри"
+msgstr "Завантажити збережений стан для вибраної гри"
#: gui/launcher.cpp:129
msgid "~A~dd Game..."
@@ -701,15 +706,15 @@ msgstr ""
#: gui/launcher.cpp:394
msgid "Do you really want to remove this game configuration?"
-msgstr "Ви дійсно хочете видалити установки для цієї гри?"
+msgstr "Ви дійсно хочете видалити налаштування для цієї гри?"
#: gui/launcher.cpp:452
msgid "Do you want to load saved game?"
-msgstr "Ви хочете завантажити збережену гру?"
+msgstr "Ви хочете завантажити збережений стан гри?"
#: gui/launcher.cpp:501
msgid "This game does not support loading games from the launcher."
-msgstr "Ця гра не підтримує завантаження збережень через головне меню."
+msgstr "Ця гра не підтримує завантаження збережених станів ігор через головне меню."
#: gui/launcher.cpp:505
msgid "ScummVM could not find any engine capable of running the selected game!"
@@ -1146,24 +1151,24 @@ msgstr "Перевірити зараз"
#: gui/options.cpp:1284
msgid "Cloud"
-msgstr ""
+msgstr "Хмара"
#: gui/options.cpp:1286
msgctxt "lowres"
msgid "Cloud"
-msgstr ""
+msgstr "Хмара"
#: gui/options.cpp:1297
msgid "Storage:"
-msgstr ""
+msgstr "Середовище:"
#: gui/options.cpp:1297
msgid "Active cloud storage"
-msgstr ""
+msgstr "Активне хмарне середовище"
#: gui/options.cpp:1304 gui/options.cpp:1855
msgid "<none>"
-msgstr ""
+msgstr "<немає>"
#: gui/options.cpp:1308 backends/platform/wii/options.cpp:114
msgid "Username:"
@@ -1171,71 +1176,67 @@ msgstr "Користувач:"
#: gui/options.cpp:1308
msgid "Username used by this storage"
-msgstr ""
+msgstr "Користувач для цього сердовища"
#: gui/options.cpp:1311
msgid "Used space:"
-msgstr ""
+msgstr "Використаний об'єм"
#: gui/options.cpp:1311
msgid "Space used by ScummVM's saves on this storage"
-msgstr ""
+msgstr "Об'єм, використаний для збережених станів ігор ScummVM на цьому середовищі"
#: gui/options.cpp:1314
msgid "Last sync time:"
-msgstr ""
+msgstr "Остання синхронизація:"
#: gui/options.cpp:1314
msgid "When the last saves sync for this storage occured"
-msgstr ""
+msgstr "Час, коли було зроблено останню синхронизацію з цим середовищем"
#: gui/options.cpp:1317 gui/storagewizarddialog.cpp:72
msgid "Connect"
-msgstr ""
+msgstr "Залучитись"
#: gui/options.cpp:1317
msgid "Open wizard dialog to connect your cloud storage account"
-msgstr ""
+msgstr "Розпочати кроки для залучення до вашого облікового засобу на хмарному середовищі"
#: gui/options.cpp:1318
msgid "Refresh"
-msgstr ""
+msgstr "Поновити"
#: gui/options.cpp:1318
msgid "Refresh current cloud storage information (username and usage)"
-msgstr ""
+msgstr "Поновити поточні дані хмарного середовища (ім'я користувача та об'єм)"
#: gui/options.cpp:1319
-#, fuzzy
msgid "Download"
-msgstr "Донизу"
+msgstr "Завантажити"
#: gui/options.cpp:1319
msgid "Open downloads manager dialog"
-msgstr ""
+msgstr "Відкрити керування завантаженнями"
#: gui/options.cpp:1321
msgid "Run server"
-msgstr ""
+msgstr "Запустити сервер"
#: gui/options.cpp:1321
msgid "Run local webserver"
-msgstr ""
+msgstr "Запускає локвальний веб-сервер"
#: gui/options.cpp:1322 gui/options.cpp:1965
-#, fuzzy
msgid "Not running"
-msgstr "Помилка запуску гри:"
+msgstr "Вимкнено"
#: gui/options.cpp:1326
-#, fuzzy
msgid "/root/ Path:"
-msgstr "Додатк. шлях:"
+msgstr "Шлях /root/:"
#: gui/options.cpp:1326 gui/options.cpp:1328 gui/options.cpp:1329
-#, fuzzy
msgid "Specifies which directory the Files Manager can access"
-msgstr "Вказує шлях до збережень гри"
+msgstr "Вказує шлях до якого можна мати доступ через Керування файлами"
#: gui/options.cpp:1328
#, fuzzy
@@ -1259,9 +1260,8 @@ msgid "You have to restart ScummVM before your changes will take effect."
msgstr "Ви повинні перезапустити ScummVM щоб застосувати зміни."
#: gui/options.cpp:1521
-#, fuzzy
msgid "Failed to change cloud storage!"
-msgstr "Не вдалося записати гру"
+msgstr "Не вдалося змінити змарне середовище!"
#: gui/options.cpp:1524
msgid "Another cloud storage is already active."
@@ -1284,9 +1284,8 @@ msgid "Select directory for plugins"
msgstr "Виберіть папку зі втулками"
#: gui/options.cpp:1604
-#, fuzzy
msgid "Select directory for Files Manager /root/"
-msgstr "Виберіть папку з додатковими файлами"
+msgstr "Виберіть папку /root/ для Керування файлами"
#: gui/options.cpp:1666
msgid ""
@@ -1299,31 +1298,31 @@ msgstr ""
#: gui/options.cpp:1862
#, c-format
msgid "%llu bytes"
-msgstr ""
+msgstr "%llu байт"
#: gui/options.cpp:1870
msgid "<right now>"
-msgstr ""
+msgstr "<зараз>"
#: gui/options.cpp:1872
-#, fuzzy
msgid "<never>"
-msgstr "Ніколи"
+msgstr "<ніколи>"
#: gui/options.cpp:1956
-#, fuzzy
msgid "Stop server"
-msgstr "Сервер:"
+msgstr "Вимкнути сервер"
#: gui/options.cpp:1957
msgid "Stop local webserver"
-msgstr ""
+msgstr "Вимкнути локальний веб-сервер"
#: gui/options.cpp:2046
msgid ""
"Request failed.\n"
"Check your Internet connection."
msgstr ""
+"Помилка запиту.\n"
+"Перевірте ваше інтернет-з'єднання."
#. I18N: You must leave "#" as is, only word 'next' is translatable
#: gui/predictivedialog.cpp:86
@@ -1397,9 +1396,8 @@ msgid "Unknown Author"
msgstr "Невідомий автор"
#: gui/remotebrowser.cpp:128
-#, fuzzy
msgid "ScummVM could not access the directory!"
-msgstr "ScummVM не може відкрити вказану папку!"
+msgstr "ScummVM не має доступу до вказаної папки!"
#: gui/saveload-dialog.cpp:334
msgid "List view"
@@ -1423,7 +1421,7 @@ msgstr "Час гри не записано"
#: gui/saveload-dialog.cpp:442
msgid "Do you really want to delete this saved game?"
-msgstr "Ви дійсно хочете видалити це збереження?"
+msgstr "Ви дійсно хочете видалити цей збережений стан гри?"
#: gui/saveload-dialog.cpp:554 gui/saveload-dialog.cpp:1060
msgid "Date: "
@@ -1451,7 +1449,7 @@ msgstr "Попередній"
#: gui/saveload-dialog.cpp:924
msgid "New Save"
-msgstr "Нове збереження"
+msgstr "Новий стан"
#: gui/saveload-dialog.cpp:924
msgid "Create a new save game"
@@ -1484,13 +1482,12 @@ msgid "in the following field and press 'Connect':"
msgstr ""
#: gui/storagewizarddialog.cpp:70
-#, fuzzy
msgid "Open URL"
-msgstr "OpenGL"
+msgstr "Відкрити URL"
#: gui/storagewizarddialog.cpp:71
msgid "Paste"
-msgstr ""
+msgstr "Вставити"
#: gui/storagewizarddialog.cpp:71
msgid "Pastes clipboard contents into fields"
@@ -1679,7 +1676,7 @@ msgstr "Не можу знайти необхідного втулка для движка"
#: common/error.cpp:68
msgid "Engine plugin does not support save states"
-msgstr "Втулок движка не підтримує збереження ігор"
+msgstr "Втулок движка не підтримує збережені стани ігор"
#: common/error.cpp:71
msgid "User canceled"
@@ -1901,7 +1898,7 @@ msgid ""
"not work in future versions of ScummVM."
msgstr ""
"ПОПЕРЕДЖЕННЯ: Гра, яку ви хочете запустити, ще не підтримується повністю "
-"ScummVM. Скорше за все вона не буде працювати стабільно, і збереження ігор, "
+"ScummVM. Скорше за все вона не буде працювати стабільно, і збережені стани ігор, "
"які ви зробите, можуть не працювати у подальших версіях ScummVM."
#: engines/engine.cpp:549
@@ -1945,7 +1942,7 @@ msgid ""
"information."
msgstr ""
"Вибраний звуковий пристрій '%s' не може бути використаний. Дивіться файл "
-"логу для додаткової інформації."
+"протоколу для додаткової інформації."
#: audio/mididrv.cpp:257
#, c-format
@@ -1963,7 +1960,7 @@ msgid ""
"information."
msgstr ""
"Уподобаний звуковий пристрій '%s' не може бути використаний. Дивіться файл "
-"логу для додаткової інформації."
+"протоколу для додаткової інформації."
#: audio/mods/paula.cpp:196
msgid "Amiga Audio Emulator"
@@ -2010,19 +2007,20 @@ msgid "C64 Audio Emulator"
msgstr "C64 Аудіо Емулятор"
#: backends/cloud/storage.cpp:210
-#, fuzzy
msgid "Saves sync complete."
-msgstr "Пошук закінчено!"
+msgstr "Синхронизацію збережених станів закінчено!"
#: backends/cloud/storage.cpp:221
msgid "Saves sync was cancelled."
-msgstr ""
+msgstr "Синхронизацію збережених станів припинено."
#: backends/cloud/storage.cpp:223
msgid ""
"Saves sync failed.\n"
"Check your Internet connection."
msgstr ""
+"Помилка синхронизації збережених станів.\n"
+"Перевірте ваше з'єднання з інтернет."
#: backends/cloud/storage.cpp:327
#, c-format
@@ -2030,16 +2028,16 @@ msgid ""
"Download complete.\n"
"Failed to download %u files."
msgstr ""
+"Завантаження закінчено.\n"
+"Не вдалося завантажити %u файлів."
#: backends/cloud/storage.cpp:329
-#, fuzzy
msgid "Download complete."
-msgstr "Пошук закінчено!"
+msgstr "Завантаження закінчено."
#: backends/cloud/storage.cpp:339
-#, fuzzy
msgid "Download failed."
-msgstr "Завантажити файл"
+msgstr "Помилка завантаження."
#: backends/events/default/default-events.cpp:196
msgid "Do you really want to return to the Launcher?"
@@ -2699,22 +2697,20 @@ msgid "Check for Updates..."
msgstr "Перевірити оновлення..."
#: engines/adl/detection.cpp:45 engines/adl/detection.cpp:55
-#, fuzzy
msgid "Color mode"
-msgstr "Режим без кольору"
+msgstr "Кольоровий режим"
#: engines/adl/detection.cpp:46 engines/adl/detection.cpp:56
msgid "Use color graphics"
-msgstr ""
+msgstr "Використовувати кольорову графіку"
#: engines/adl/detection.cpp:65
msgid "Scanlines"
-msgstr ""
+msgstr "Скан-лінії"
#: engines/adl/detection.cpp:66
-#, fuzzy
msgid "Show scanlines"
-msgstr "Показувати лінії об'єктів"
+msgstr "Показувати скан-лінії"
#: engines/agi/detection.cpp:147 engines/cine/detection.cpp:70
#: engines/drascula/detection.cpp:302 engines/dreamweb/detection.cpp:48
@@ -2729,7 +2725,7 @@ msgstr "Використовувати ориг. збереження/завантаження екрани"
#: engines/toltecs/detection.cpp:201
msgid "Use the original save/load screens, instead of the ScummVM ones"
msgstr ""
-"Використовувати оригінальні збереження/завантаження екрани, замість ScummVM"
+"Використовувати оригінальні екрани збереження/завантаження замість ScummVM"
#: engines/agi/detection.cpp:157
msgid "Use an alternative palette"
@@ -2803,7 +2799,7 @@ msgid ""
"\n"
"%s"
msgstr ""
-"Не вдалося завантажити стан гри з файлу:\n"
+"Не вдалося завантажити збережений стан гри з файлу:\n"
"\n"
"%s"
@@ -2852,7 +2848,7 @@ msgid ""
"Press OK to convert them now, otherwise you will be asked again the next "
"time you start the game.\n"
msgstr ""
-"ScummVM знайшов, що Ви маєте старі збереження ігор для Drascula.\n"
+"ScummVM знайшов, що Ви маєте старі збережені стани ігор для Drascula.\n"
"Збереження у старому форматі не підтримуються, і Ви не зможете їх "
"завантажити, якщо не переведете у новий формат.\n"
"\n"
@@ -2870,7 +2866,7 @@ msgstr "Відображення графіки з використанням яскравої палітри ігр"
#: engines/gob/inter_playtoons.cpp:255 engines/gob/inter_v2.cpp:1467
#: engines/gob/inter_geisha.cpp:232 engines/tinsel/saveload.cpp:532
msgid "Failed to load game state from file."
-msgstr "Не вдалося завантажити стан гри з файлу."
+msgstr "Не вдалося завантажити зюережений стан гри з файлу."
#: engines/gob/inter_v2.cpp:1537 engines/gob/inter_geisha.cpp:263
#: engines/tinsel/saveload.cpp:545
@@ -3031,11 +3027,11 @@ msgid ""
"Do you wish to use this save game file with ScummVM?\n"
"\n"
msgstr ""
-"Наступний оригінальний файл стану гри було знайдено у вашій папці з грою:\n"
+"Наступний оригінальний файл збереженого стану гри було знайдено у вашій папці з грою:\n"
"\n"
"%s %s\n"
"\n"
-"Чи ви бажаєте використовувати цей стан гри зі ScummVM?\n"
+"Чи ви бажаєте використовувати цей збережений стан гри зі ScummVM?\n"
"\n"
#: engines/kyra/saveload_eob.cpp:590
@@ -3044,7 +3040,7 @@ msgid ""
"A save game file was found in the specified slot %d. Overwrite?\n"
"\n"
msgstr ""
-"Файл стану гри було знайдено у вказаній позиції %d. Перетерти?\n"
+"Файл збереженого стану гри було знайдено у вказаній позиції %d. Перетерти?\n"
"\n"
#: engines/kyra/saveload_eob.cpp:623
@@ -3057,7 +3053,7 @@ msgid ""
"'import_savefile'.\n"
"\n"
msgstr ""
-"%d оригінальних файлів зі станом гри було успішно імпортовано у\n"
+"%d оригінальних файлів зі збереженеми станами гри було успішно імпортовано у\n"
"ScummVM. Якщо ви захочете пізніше імпортувати оригінальні файли зі станом "
"гри, вам потрібно\n"
"відкрити консоль відладчика і ввести команду 'import_savefile'.\n"
@@ -3119,7 +3115,7 @@ msgid ""
"Can't save game in slot %i\n"
"\n"
msgstr ""
-"Не можу зберегти гру у слот %i\n"
+"Не можу зберегти стан гри у слот %i\n"
"\n"
#: engines/parallaction/saveload.cpp:194
@@ -3147,7 +3143,7 @@ msgid ""
"\n"
"Press OK to convert them now, otherwise you will be asked next time.\n"
msgstr ""
-"ScummVM знайшов, що Ви маєте старі збереження ігор для Nippon Safes.\n"
+"ScummVM знайшов, що Ви маєте старі збережені стани ігор для Nippon Safes.\n"
"Збереження у старому форматі не підтримуються, і Ви не зможете їх "
"завантажити, якщо не переведете у новий формат.\n"
"\n"
@@ -3156,7 +3152,7 @@ msgstr ""
#: engines/parallaction/saveload.cpp:316
msgid "ScummVM successfully converted all your savefiles."
-msgstr "ScummVM успішно перевів усі Ваші збереження."
+msgstr "ScummVM успішно перевів усі Ваші збережені стани."
#: engines/parallaction/saveload.cpp:318
msgid ""
@@ -3172,7 +3168,7 @@ msgstr ""
#: engines/pegasus/pegasus.cpp:714
msgid "Invalid save file name"
-msgstr "Неправильна назва файлу збереження"
+msgstr "Неправильна назва файлу збереження стану"
#: engines/pegasus/pegasus.cpp:2507
msgid "Up/Zoom In/Move Forward/Open Doors"
@@ -3234,11 +3230,11 @@ msgstr "Увімкнути графіку та контент у високому розгалуженні"
#: engines/sci/detection.cpp:410
msgid "Enable black-lined video"
-msgstr ""
+msgstr "Увімкнути відео з чорними лініями"
#: engines/sci/detection.cpp:411
msgid "Draw black lines over videos to increase their apparent sharpness"
-msgstr ""
+msgstr "Малювати чорні лінії поверху відео щоб посилити їхню чіткість"
#: engines/sci/detection.cpp:420
msgid "Prefer digital sound effects"
@@ -3333,7 +3329,7 @@ msgstr "Грати"
#: engines/scumm/dialogs.cpp:190
msgid "Insert save/load game disk"
-msgstr "Вставте диск зі збереженням ігор"
+msgstr "Вставте диск зі збереженими станами ігор"
#: engines/scumm/dialogs.cpp:191
msgid "You must enter a name"
@@ -3359,7 +3355,7 @@ msgstr "Завантажую '%s'"
#: engines/scumm/dialogs.cpp:196
msgid "Name your SAVE game"
-msgstr "Назовіть своє збереження ігри"
+msgstr "Назовіть свій збережений стан ігри"
#: engines/scumm/dialogs.cpp:197
msgid "Select a game to LOAD"
@@ -4106,7 +4102,7 @@ msgid ""
"Press OK to convert them now, otherwise you will be asked again the next "
"time you start the game.\n"
msgstr ""
-"ScummVM знайшов, що Ви маєте старі збереження ігор для Broken Sword 1.\n"
+"ScummVM знайшов, що Ви маєте старі збережені стани ігор для Broken Sword 1.\n"
"Збереження у старому форматі не підтримуються, і Ви не зможете їх "
"завантажити, якщо не переведете у новий формат.\n"
"\n"
@@ -4120,7 +4116,7 @@ msgid ""
"Would you like to keep the old save game (%s) or the new one (%s)?\n"
msgstr ""
"Збереження гри з такою назвою вже існує!\n"
-"Чи ви хочете лишити старе збереження (%s) або нове (%s)?\n"
+"Чи ви хочете лишити старий збережений стан (%s) або нове (%s)?\n"
#: engines/sword1/control.cpp:1235
msgid "Keep the old one"
@@ -4219,7 +4215,3 @@ msgid "Use MPEG video from the DVD version, instead of lower resolution AVI"
msgstr ""
"Використовувати відео MPEG з DVD-версії, замість файлів AVI з ніжчою "
"роздільною здатністю"
-
-#, fuzzy
-#~ msgid "Specifies where Files Manager can access to"
-#~ msgstr "Вказує шлях до збережень гри"