[Scummvm-git-logs] scummvm master -> d56f934ba05e8f0ec72111330cfc236405bb43e5
mgerhardy
noreply at scummvm.org
Sun Jul 5 12:32:18 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
d56f934ba0 MACS2: extract constants
Commit: d56f934ba05e8f0ec72111330cfc236405bb43e5
https://github.com/scummvm/scummvm/commit/d56f934ba05e8f0ec72111330cfc236405bb43e5
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2026-07-05T14:32:11+02:00
Commit Message:
MACS2: extract constants
Changed paths:
A engines/macs2/macs2_constants.h
engines/macs2/debugtools.cpp
engines/macs2/events.cpp
engines/macs2/macs2.cpp
engines/macs2/macs2.h
engines/macs2/scriptexecutor.cpp
engines/macs2/view1.cpp
diff --git a/engines/macs2/debugtools.cpp b/engines/macs2/debugtools.cpp
index 761eec1e2bd..7f2544e12e0 100644
--- a/engines/macs2/debugtools.cpp
+++ b/engines/macs2/debugtools.cpp
@@ -1495,15 +1495,15 @@ static void showSceneMapsWindow() {
// Draw pathfinding point nodes and connections
for (int i = 0; i < 16; i++) {
PathfindingPoint &pt = g_engine->pathfindingPoints[i];
- if (pt._position.x >= 0 && pt._position.x < 320 && pt._position.y >= 0 && pt._position.y < 200) {
+ if (pt._position.x >= 0 && pt._position.x < kScreenWidth && pt._position.y >= 0 && pt._position.y < kGameHeight) {
// Draw cross at node
for (int d = -2; d <= 2; d++) {
int px = pt._position.x + d, py = pt._position.y;
- if (px >= 0 && px < 320)
+ if (px >= 0 && px < kScreenWidth)
overlayComposite.setPixel(px, py, 0xFF);
px = pt._position.x;
py = pt._position.y + d;
- if (py >= 0 && py < 200)
+ if (py >= 0 && py < kGameHeight)
overlayComposite.setPixel(px, py, 0xFF);
}
// Draw connections
@@ -1570,8 +1570,8 @@ static void showSceneMapsWindow() {
ImTextureID texId = (ImTextureID)(intptr_t)g_system->getImGuiTexture(*surface->surfacePtr(), g_engine->_pal, 256);
if (texId) {
ImVec2 avail = ImGui::GetContentRegionAvail();
- float scale = MIN(avail.x / 320.0f, avail.y / 200.0f);
- ImGui::Image(texId, ImVec2(320.0f * scale, 200.0f * scale));
+ float scale = MIN(avail.x / (float)kScreenWidth, avail.y / (float)kGameHeight);
+ ImGui::Image(texId, ImVec2((float)kScreenWidth * scale, (float)kGameHeight * scale));
// Draw node IDs on the pathfinding overlay
if (selectedTab == 2) {
@@ -1579,7 +1579,7 @@ static void showSceneMapsWindow() {
ImVec2 imgOrigin = ImGui::GetItemRectMin();
for (int i = 0; i < 16; i++) {
PathfindingPoint &pt = g_engine->pathfindingPoints[i];
- if (pt._position.x >= 0 && pt._position.x < 320 && pt._position.y >= 0 && pt._position.y < 200) {
+ if (pt._position.x >= 0 && pt._position.x < kScreenWidth && pt._position.y >= 0 && pt._position.y < kGameHeight) {
char buf[4];
snprintf(buf, sizeof(buf), "%d", i);
ImVec2 pos(imgOrigin.x + pt._position.x * scale + 4, imgOrigin.y + pt._position.y * scale - 4);
@@ -1665,7 +1665,7 @@ static void showSceneMapsWindow() {
ImVec2 mousePos = ImGui::GetMousePos();
int mx = (int)((mousePos.x - imgPos.x) / scale);
int my = (int)((mousePos.y - imgPos.y) / scale);
- if (mx >= 0 && mx < 320 && my >= 0 && my < 200 && ImGui::IsItemHovered()) {
+ if (mx >= 0 && mx < kScreenWidth && my >= 0 && my < kGameHeight && ImGui::IsItemHovered()) {
uint8 val = surface->getPixel(mx, my);
if (val >= 0xC8 && val <= 0xEF) {
uint16 overrideResult;
@@ -1774,10 +1774,10 @@ static void showImageResourcesWindow() {
ImGui::Separator();
static Graphics::ManagedSurface imgSurface;
if (!g_engine->_imageResources.empty()) {
- // Layout all image resources into a 320-wide surface
+ // Layout all image resources into a kScreenWidth-wide surface
uint16 x = 0, y = 0, maxH = 0, totalH = 0;
for (const AnimFrame &f : g_engine->_imageResources) {
- if (x + f._width > 320) {
+ if (x + f._width > kScreenWidth) {
y += maxH;
x = 0;
maxH = 0;
@@ -1789,15 +1789,15 @@ static void showImageResourcesWindow() {
if (totalH == 0)
totalH = 1;
- if (imgSurface.w != 320 || imgSurface.h != (int)totalH)
- imgSurface.create(320, totalH, Graphics::PixelFormat::createFormatCLUT8());
- imgSurface.fillRect(Common::Rect(320, totalH), 0);
+ if (imgSurface.w != kScreenWidth || imgSurface.h != (int)totalH)
+ imgSurface.create(kScreenWidth, totalH, Graphics::PixelFormat::createFormatCLUT8());
+ imgSurface.fillRect(Common::Rect(kScreenWidth, totalH), 0);
x = 0;
y = 0;
maxH = 0;
for (const AnimFrame &f : g_engine->_imageResources) {
- if (x + f._width > 320) {
+ if (x + f._width > kScreenWidth) {
y += maxH;
x = 0;
maxH = 0;
@@ -1817,10 +1817,10 @@ static void showImageResourcesWindow() {
ImTextureID texId = (ImTextureID)(intptr_t)g_system->getImGuiTexture(*imgSurface.surfacePtr(), g_engine->_pal, 256);
if (texId) {
ImVec2 avail = ImGui::GetContentRegionAvail();
- float scale = MIN(avail.x / 320.0f, avail.y / (float)totalH);
+ float scale = MIN(avail.x / (float)kScreenWidth, avail.y / (float)totalH);
if (scale < 1.0f)
scale = 1.0f;
- ImGui::Image(texId, ImVec2(320.0f * scale, (float)totalH * scale));
+ ImGui::Image(texId, ImVec2((float)kScreenWidth * scale, (float)totalH * scale));
}
}
}
diff --git a/engines/macs2/events.cpp b/engines/macs2/events.cpp
index eefa547ff55..2641bc3126e 100644
--- a/engines/macs2/events.cpp
+++ b/engines/macs2/events.cpp
@@ -24,6 +24,7 @@
#include "graphics/screen.h"
#include "macs2/detection.h"
#include "macs2/macs2.h"
+#include "macs2/macs2_constants.h"
#include "macs2/view1.h"
namespace Macs2 {
@@ -238,7 +239,7 @@ void Events::addKeypress(const Common::KeyCode kc) {
/*------------------------------------------------------------------------*/
-Bounds::Bounds(Common::Rect &innerBounds) : _bounds(0, 0, 320, 200),
+Bounds::Bounds(Common::Rect &innerBounds) : _bounds(0, 0, kScreenWidth, kGameHeight),
_innerBounds(innerBounds),
left(_bounds.left), top(_bounds.top),
right(_bounds.right), bottom(_bounds.bottom) {
diff --git a/engines/macs2/macs2.cpp b/engines/macs2/macs2.cpp
index d1766f988d1..c335eb739c4 100644
--- a/engines/macs2/macs2.cpp
+++ b/engines/macs2/macs2.cpp
@@ -66,20 +66,20 @@ Graphics::ManagedSurface Macs2Engine::readRLEImage(int64 offs, Common::MemoryRea
stream->seek(offs);
Graphics::ManagedSurface result;
- result.create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
+ result.create(kScreenWidth, kGameHeight, Graphics::PixelFormat::createFormatCLUT8());
- // Max RLE row size: 320 pixels uncompressed = 320 bytes, but with escape sequences
+ // Max RLE row size: kScreenWidth pixels uncompressed, but with escape sequences
// the encoded form could be slightly larger. 1024 is more than sufficient.
uint8 *data = new uint8[1024];
- for (int y = 0; y < 200; y++) {
+ for (int y = 0; y < kGameHeight; y++) {
uint16 length = stream->readUint16LE();
stream->read(data, length);
// Signed, matching the original decodeRLERows (1008:0666): a final RLE run that
// overshoots the row width drives this negative and terminates the row. Using an
// unsigned counter here underflows and runs away, over-reading the encoded data and
// corrupting this row and every row after it (spurious walkability values).
- int16 remainingPixels = 320;
+ int16 remainingPixels = kScreenWidth;
uint8 *dataPointer = data;
uint16 x = 0;
while (remainingPixels > 0) {
@@ -95,7 +95,7 @@ Graphics::ManagedSurface Macs2Engine::readRLEImage(int64 offs, Common::MemoryRea
dataPointer++;
const uint8 &encodedValue = dataPointer[0];
dataPointer++;
- for (int i = 0; i < runlength && x < 320; i++) {
+ for (int i = 0; i < runlength && x < kScreenWidth; i++) {
result.setPixel(x++, y, encodedValue);
}
remainingPixels -= runlength;
@@ -277,11 +277,11 @@ void Macs2Engine::readResourceFile() {
// is loaded before the game loop processes any input.
// The original allocates the 0x75E0-byte scene data buffer (which includes space for
// all RLE-decoded maps) before calling changeScene. Create the surfaces here.
- _sceneBackground.create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
- _depthMap.create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
- _pathfindingMap.create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
- _shadowMap.create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
- _hotspotMap.create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
+ _sceneBackground.create(kScreenWidth, kGameHeight, Graphics::PixelFormat::createFormatCLUT8());
+ _depthMap.create(kScreenWidth, kGameHeight, Graphics::PixelFormat::createFormatCLUT8());
+ _pathfindingMap.create(kScreenWidth, kGameHeight, Graphics::PixelFormat::createFormatCLUT8());
+ _shadowMap.create(kScreenWidth, kGameHeight, Graphics::PixelFormat::createFormatCLUT8());
+ _hotspotMap.create(kScreenWidth, kGameHeight, Graphics::PixelFormat::createFormatCLUT8());
changeScene(Scenes::instance()._currentSceneIndex);
}
@@ -477,7 +477,7 @@ void Macs2Engine::changeScene(uint32 newSceneIndex, bool executeScript) {
_fileStream->seek(sceneTableEntry2 + 0x3C0, SEEK_SET);
uint32 mapOffset = _fileStream->readUint32LE();
if (mapOffset != 0 && mapOffset < (uint32)_fileStream->size()) {
- // Validate it's actually RLE data for a 320-wide image (row len typically 50-320)
+ // Validate it's actually RLE data for a kScreenWidth-wide image
_fileStream->seek(mapOffset, SEEK_SET);
uint16 rowLen = _fileStream->readUint16LE();
if (rowLen >= 50 && rowLen <= 640) {
@@ -492,11 +492,11 @@ void Macs2Engine::changeScene(uint32 newSceneIndex, bool executeScript) {
uint8 data[0x320];
- for (int y = 0; y < 200; y++) {
+ for (int y = 0; y < kGameHeight; y++) {
// TODO: Use the proper read function, it seems to be available
uint16 length = _fileStream->readUint16LE();
_fileStream->read(data, length);
- int16 remainingPixels = 320; // signed: see readRLEImage (matches decodeRLERows 1008:0666)
+ int16 remainingPixels = kScreenWidth; // signed: see readRLEImage (matches decodeRLERows 1008:0666)
uint8 *dataPointer = data;
uint16 x = 0;
while (remainingPixels > 0) {
@@ -512,7 +512,7 @@ void Macs2Engine::changeScene(uint32 newSceneIndex, bool executeScript) {
dataPointer++;
const uint8 &encodedValue = dataPointer[0];
dataPointer++;
- for (int i = 0; i < runlength && x < 320; i++) {
+ for (int i = 0; i < runlength && x < kScreenWidth; i++) {
_sceneBackground.setPixel(x++, y, encodedValue);
}
remainingPixels -= runlength;
@@ -776,13 +776,13 @@ bool Macs2Engine::findGlyph(char c, GlyphData &out) const {
// getWalkabilityAt (1008:0e8c)
// Params: (param_1=y, param_2=x)
-// Bounds: x<0 || x>=320 || y<0 || y>=200 -> return 0
+// Bounds: x<0 || x>=kScreenWidth || y<0 || y>=kGameHeight -> return 0
// Lookup: scene[y*4 + 0x2017] -> row pointer, then byte at [rowPtr + x]
// Values 0xC8..0xEF: override range - checks scene[value*5 + 0x4EA5]:
// If override disabled (flag==0): returns 0xFF
// If override enabled (flag!=0): returns scene[value*5 + 0x4EA6]
uint16 Macs2Engine::getWalkabilityAt(int16 y, int16 x) {
- if (x < 0 || x >= 320 || y < 0 || y >= 200 || _pathfindingMap.w == 0) {
+ if (x < 0 || x >= kScreenWidth || y < 0 || y >= kGameHeight || _pathfindingMap.w == 0) {
return 0;
}
uint16 value = _pathfindingMap.getPixel(x, y);
@@ -810,7 +810,7 @@ void Macs2Engine::snapToWalkablePosition(int16 *pTargetY, int16 *pTargetX, int16
if (isWalkabilityWalkable(w) && (*pTargetY - (int16)w >= savedY)) {
break;
}
- if (*pTargetY >= 199) {
+ if (*pTargetY >= kGameHeightLast) {
break;
}
*pTargetY = *pTargetY + 1;
@@ -818,19 +818,19 @@ void Macs2Engine::snapToWalkablePosition(int16 *pTargetY, int16 *pTargetX, int16
// Phase 2: Continue scanning to bottom for best depth match
int16 scanY = *pTargetY;
- while (scanY <= 199) {
+ while (scanY <= kGameHeightLast) {
uint16 w = getWalkabilityAt(scanY, *pTargetX);
if (scanY - (int16)w == savedY) {
*pTargetY = scanY;
}
- if (scanY == 199) {
+ if (scanY == kGameHeightLast) {
break;
}
scanY++;
}
// Phase 3: If at screen bottom and still non-walkable, scan upward
- if (*pTargetY == 199) {
+ if (*pTargetY == kGameHeightLast) {
uint16 w = getWalkabilityAt(*pTargetY, *pTargetX);
if (isWalkabilityBlocking(w)) {
while (isWalkabilityBlocking(w) && *pTargetY > 0) {
@@ -859,7 +859,7 @@ void Macs2Engine::snapToWalkablePosition(int16 *pTargetY, int16 *pTargetX, int16
uint16 w2 = getWalkabilityAt(*pTargetY, *pTargetX);
if (isWalkabilityWalkable(w2))
break;
- if (*pTargetX >= 319)
+ if (*pTargetX >= kScreenWidthLast)
break;
*pTargetX = *pTargetX + 1;
}
@@ -1148,8 +1148,8 @@ void Macs2Engine::setCursorMode(Script::MouseMode newMode) {
mouse.x -= newHalfW;
mouse.y -= newHalfH;
- mouse.x = CLIP<int>(mouse.x, (int)newHalfW, 319 - (int)newHalfW);
- mouse.y = CLIP<int>(mouse.y, (int)newHalfH, 199 - (int)newHalfH);
+ mouse.x = CLIP<int>(mouse.x, (int)newHalfW, kScreenWidthLast - (int)newHalfW);
+ mouse.y = CLIP<int>(mouse.y, (int)newHalfH, kGameHeightLast - (int)newHalfH);
g_system->warpMouse(mouse.x, mouse.y);
_clipRectDirty = true;
@@ -1174,7 +1174,7 @@ void Macs2Engine::setCursorMode(Script::MouseMode newMode) {
uint16 Macs2Engine::getHotspotAtPoint(const Common::Point &p) {
uint16 result = 0;
// TODO: Abstract the screen sizes
- if (p.x < 0 || p.x >= 320 || p.y < 0 || p.y >= 200 || _hotspotMap.w == 0) {
+ if (p.x < 0 || p.x >= kScreenWidth || p.y < 0 || p.y >= kGameHeight || _hotspotMap.w == 0) {
return result;
}
@@ -1760,8 +1760,8 @@ Common::Error Macs2Engine::run() {
loadTranslation();
}
- // Initialize 320x200 paletted graphics mode
- initGraphics(320, 200);
+ // Initialize graphics mode
+ initGraphics(kScreenWidth, kGameHeight);
CursorMan.showMouse(false);
diff --git a/engines/macs2/macs2.h b/engines/macs2/macs2.h
index c3dd78bc047..0306562bcd6 100644
--- a/engines/macs2/macs2.h
+++ b/engines/macs2/macs2.h
@@ -39,6 +39,7 @@
#include "common/util.h"
#include "engines/engine.h"
#include "macs2/events.h"
+#include "macs2/macs2_constants.h"
#include "macs2/scriptexecutor.h"
namespace Macs2 {
@@ -227,8 +228,8 @@ struct PathfindingAreaOverride {
// Area override table at scene+0x4EA8 (indexed by pathfinding value 0xC8..0xEF)
// Set by opcode 0x4D, read by getAreaAtPoint (1008:101d)
-#define AREA_OVERRIDE_MIN 0xC8
-#define AREA_OVERRIDE_MAX 0xEF
+#define AREA_OVERRIDE_MIN 200
+#define AREA_OVERRIDE_MAX 239
#define AREA_OVERRIDE_COUNT (AREA_OVERRIDE_MAX - AREA_OVERRIDE_MIN + 1)
class Macs2Engine : public Engine, public Events {
diff --git a/engines/macs2/macs2_constants.h b/engines/macs2/macs2_constants.h
new file mode 100644
index 00000000000..e2869b63520
--- /dev/null
+++ b/engines/macs2/macs2_constants.h
@@ -0,0 +1,35 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef MACS2_CONSTANTS_H
+#define MACS2_CONSTANTS_H
+
+namespace Macs2 {
+
+// Original game viewport dimensions (all scene maps and buffers use these).
+static constexpr int kScreenWidth = 320;
+static constexpr int kScreenWidthLast = kScreenWidth - 1;
+static constexpr int kGameHeight = 200;
+static constexpr int kGameHeightLast = kGameHeight - 1;
+
+} // namespace Macs2
+
+#endif // MACS2_CONSTANTS_H
diff --git a/engines/macs2/scriptexecutor.cpp b/engines/macs2/scriptexecutor.cpp
index 2df81ddf388..f735ce4e4cb 100644
--- a/engines/macs2/scriptexecutor.cpp
+++ b/engines/macs2/scriptexecutor.cpp
@@ -281,13 +281,13 @@ void ScriptExecutor::scriptChangeAnimation() {
uint16 ScriptExecutor::getAreaAtPoint(uint16 x, uint16 y) {
// getAreaAtPoint (1008:101d). Reads the pathfinding map pixel and applies
// the area override table at sceneData + value*5 + 0x4EA8.
- if (x >= 320 || y >= 200 || _engine->_pathfindingMap.w == 0) {
+ if (x >= kScreenWidth || y >= kGameHeight || _engine->_pathfindingMap.w == 0) {
return 0;
}
uint16 result = _engine->_pathfindingMap.getPixel(x, y);
- if (result > 199 && result < 0xFA) {
+ if (result >= AREA_OVERRIDE_MIN && result < 250) {
uint16 overrideValue = _engine->getPathfindingOverride2(result);
- if (overrideValue > 199) {
+ if (overrideValue >= AREA_OVERRIDE_MIN) {
result = overrideValue;
}
}
diff --git a/engines/macs2/view1.cpp b/engines/macs2/view1.cpp
index d282ba676a5..280a8d6d5dc 100644
--- a/engines/macs2/view1.cpp
+++ b/engines/macs2/view1.cpp
@@ -405,7 +405,7 @@ void View1::drawDarkRectangle(uint16 x, uint16 y, uint16 width, uint16 height) {
const uint16 currentY = y + yOffset;
const uint8 currentValue = (uint8)s.getPixel(currentX, currentY);
const uint8 newValue = g_engine->_panelRemapTable[currentValue];
- if (currentX < 320 && currentY < 200)
+ if (currentX < kScreenWidth && currentY < kGameHeight)
s.setPixel(currentX, currentY, newValue);
}
}
@@ -636,9 +636,9 @@ void View1::drawPathfindingPoints(Graphics::ManagedSurface &s) {
return;
}
const Common::Array<uint8> &overlay = c->_pathfindingOverlay;
- for (int y = 0; y < 200; y++) {
- for (int x = 0; x < 320; x++) {
- const uint8 currentValue = overlay[y * 320 + x];
+ for (int y = 0; y < kGameHeight; y++) {
+ for (int x = 0; x < kScreenWidth; x++) {
+ const uint8 currentValue = overlay[y * kScreenWidth + x];
if (currentValue != 0) {
s.setPixel(x, y, currentValue);
}
@@ -707,11 +707,11 @@ void View1::openMainMenu(Common::Point clickedPosition) {
upperLeft.y = 0;
}
// Binary openActionBarAtPosition (1008:3fba): clamp to screen bounds.
- if ((int)(upperLeft.x + panelSize.x) >= 320) {
- upperLeft.x = 320 - panelSize.x - 1;
+ if ((int)(upperLeft.x + panelSize.x) >= kScreenWidth) {
+ upperLeft.x = kScreenWidth - panelSize.x - 1;
}
- if ((int)(upperLeft.y + panelSize.y) >= 200) {
- upperLeft.y = 200 - panelSize.y - 1;
+ if ((int)(upperLeft.y + panelSize.y) >= kGameHeight) {
+ upperLeft.y = kGameHeight - panelSize.y - 1;
}
_mainMenuRect = Common::Rect(upperLeft, upperLeft + panelSize);
@@ -1417,7 +1417,7 @@ bool View1::handleActionBarClick(const MouseDownMessage &msg) {
}
bool View1::handleHelpClick(const MouseDownMessage &msg) {
- Common::Rect screenRect(320, 200);
+ Common::Rect screenRect(kScreenWidth, kGameHeight);
if (screenRect.contains(msg._pos)) {
uint8 depth = g_engine->_depthMap.getPixel(msg._pos.x, msg._pos.y);
if (depth > 0 && depth < 0xFA) {
@@ -2390,8 +2390,8 @@ void View1::drawAllCharacters(Graphics::ManagedSurface *surface, bool fullUpdate
int shadingTableOffset = 0;
if (g_engine->_shadowMap.w > 0) {
- const int sx = CLIP<int>(charX, 0, 319);
- const int sy = CLIP<int>(charY, 0, 199);
+ const int sx = CLIP<int>(charX, 0, kScreenWidthLast);
+ const int sy = CLIP<int>(charY, 0, kGameHeightLast);
shadingTableOffset = MIN<int>(g_engine->_shadowMap.getPixel(sx, sy), 0x20);
}
@@ -2451,7 +2451,7 @@ void View1::drawAllCharacters(Graphics::ManagedSurface *surface, bool fullUpdate
if (current != nullptr && DebugMan.isDebugChannelEnabled(kDebugGraphics)) {
Common::String number = Common::String::format("%u", obj->_orientation);
renderString(current->getPosition(), number.c_str());
- Common::Rect screenRect(0, 0, 320, 200);
+ Common::Rect screenRect(0, 0, kScreenWidth, kGameHeight);
if (screenRect.contains(current->getPosition()))
surface->setPixel(current->getPosition().x, current->getPosition().y, 0xFF);
}
@@ -2667,7 +2667,7 @@ void View1::drawSpriteClipped(uint16 x, uint16 y, Common::Rect &clippingRect, ui
uint8 val = data[currentY * width + currentX];
if (val != 0) {
if (clippingRect.contains(x + currentX, y + currentY)) {
- if (x + currentX < 320 && y + currentY < 200)
+ if (x + currentX < kScreenWidth && y + currentY < kGameHeight)
s.setPixel(x + currentX, y + currentY, val);
}
}
@@ -2968,7 +2968,7 @@ void View1::drawImageResources(Graphics::ManagedSurface &s) {
uint16 y = 0;
uint16 currentMaxHeight = 0;
for (AnimFrame ¤t : g_engine->_imageResources) {
- if (x + current._width > 320) {
+ if (x + current._width > kScreenWidth) {
y += currentMaxHeight;
x = 0;
currentMaxHeight = 0;
@@ -3048,7 +3048,7 @@ uint16 View1::getHitObjectID(const Common::Point &pos) const {
continue;
const uint8 characterDepth = currentCharacter->getPosition().y;
- if (pos.x >= 0 && pos.x < 320 && pos.y >= 0 && pos.y < 200) {
+ if (pos.x >= 0 && pos.x < kScreenWidth && pos.y >= 0 && pos.y < kGameHeight) {
const uint8 bgDepth = g_engine->_depthMap.getPixel(pos.x, pos.y);
if (bgDepth >= characterDepth)
continue;
@@ -3139,7 +3139,7 @@ bool Character::isWalkable(const Common::Point &p) const {
}
Character::Character() {
- _pathfindingOverlay = Common::Array<uint8>(320 * 200, 0);
+ _pathfindingOverlay = Common::Array<uint8>(kScreenWidth * kGameHeight, 0);
}
bool Character::calculatePath(Common::Point target) {
More information about the Scummvm-git-logs
mailing list