aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/wage/design.cpp36
-rw-r--r--engines/wage/detection_tables.h2
2 files changed, 25 insertions, 13 deletions
diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp
index 4d3cbdbc89..15d5d13b31 100644
--- a/engines/wage/design.cpp
+++ b/engines/wage/design.cpp
@@ -72,6 +72,8 @@ Design::Design(Common::SeekableReadStream *data) {
_surface = NULL;
_bounds = NULL;
+
+ _boundsCalculationMode = false;
}
Design::~Design() {
@@ -87,9 +89,13 @@ void Design::paint(Graphics::Surface *surface, Patterns &patterns, int x, int y)
if (_surface == NULL) {
_boundsCalculationMode = true;
_bounds->debugPrint(4, "Internal bounds:");
- _bounds->left = _bounds->right = _bounds->top = _bounds->bottom = 0;
+ _bounds->left = _bounds->top = 10000;
+ _bounds->right =_bounds->bottom = -10000;
render(patterns);
_boundsCalculationMode = false;
+ if (_bounds->right == -10000) {
+ _bounds->left = _bounds->top = _bounds->right = _bounds->bottom = 0;
+ }
_bounds->debugPrint(4, "Calculated bounds:");
_surface = new Graphics::Surface;
@@ -100,6 +106,8 @@ void Design::paint(Graphics::Surface *surface, Patterns &patterns, int x, int y)
needRender = true;
}
+
+ _bounds->debugPrint(4, "Using bounds:");
#if 0
PlotData pd(_surface, &patterns, 8, 1, this);
int x1 = 50, y1 = 50, x2 = 200, y2 = 200, borderThickness = 30;
@@ -125,15 +133,17 @@ void Design::paint(Graphics::Surface *surface, Patterns &patterns, int x, int y)
if (needRender)
render(patterns);
- const int padding = 3;
- for (int i = padding; i < _bounds->height() - 2 * padding; i++) {
- const byte *src = (const byte *)_surface->getBasePtr(padding, i);
- byte *dst = (byte *)surface->getBasePtr(x + padding, y+i);
- for (int j = padding; j < _bounds->width() - 2 * padding; j++) {
- if (*src != kColorGreen)
- *dst = *src;
- src++;
- dst++;
+ if (_bounds->width() && _bounds->height()) {
+ const int padding = 3;
+ for (int i = padding; i < _bounds->height() - 2 * padding; i++) {
+ const byte *src = (const byte *)_surface->getBasePtr(padding, i);
+ byte *dst = (byte *)surface->getBasePtr(x + padding, y+i);
+ for (int j = padding; j < _bounds->width() - 2 * padding; j++) {
+ if (*src != kColorGreen)
+ *dst = *src;
+ src++;
+ dst++;
+ }
}
}
}
@@ -192,7 +202,7 @@ bool Design::isPointOpaque(int x, int y) {
void Design::adjustBounds(int16 x, int16 y) {
_bounds->left = MIN(x, _bounds->left);
- _bounds->right = MAX(x, _bounds->left);
+ _bounds->right = MAX(x, _bounds->right);
_bounds->top = MIN(y, _bounds->top);
_bounds->bottom = MAX(y, _bounds->bottom);
}
@@ -455,7 +465,9 @@ void Design::drawBitmap(Graphics::Surface *surface, Common::SeekableReadStream &
color = b;
for (int c = 0; c < 8; c++) {
- if (x1 + x >= 0 && x1 + x < surface->w && y1 + y >= 0 && y1 + y < surface->h)
+ if (_boundsCalculationMode) {
+ adjustBounds(x, y);
+ } else if (x1 + x >= 0 && x1 + x < surface->w && y1 + y >= 0 && y1 + y < surface->h)
*((byte *)tmp.getBasePtr(x, y)) = (color & (1 << (7 - c % 8))) ? kColorBlack : kColorWhite;
x++;
if (x == w) {
diff --git a/engines/wage/detection_tables.h b/engines/wage/detection_tables.h
index 35ac91f90d..cc3b2bece5 100644
--- a/engines/wage/detection_tables.h
+++ b/engines/wage/detection_tables.h
@@ -31,7 +31,7 @@ namespace Wage {
static const ADGameDescription gameDescriptions[] = {
FANGAME("3rd Floor", "a107d7a177970b2259e32681bd8b47c9", 285056),
- BIGGAME("afm", "v1.8", "Another Fine Mess 1.8", "8e5aa915f3253efb2aab52435647b25e", 1456000),
+ BIGGAME("afm", "v1.8", "Another Fine Mess 1.8", "65dc7baec9fb0812238139da15efc4e3", 1456000),
BIGGAME("amot", "v1.8", "A Mess O' Trouble 1.8", "b3ef53afed282671b704e45df829350c", 1895552),
FANGAME("Bug Hunt", "2ebd3515a87941063ad66c3cf93c5e78", 200064),
// Problems with letter rendering