aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorArnaud Boutonné2011-01-23 22:51:12 +0000
committerArnaud Boutonné2011-01-23 22:51:12 +0000
commitf7f42fba21583ed5733268dedcc04f28e26372c2 (patch)
treed8be5eed86ff00fe356c83da972bd360ab675138 /engines
parentc81be09bcd9b2654b3af3bf30ad7b4b387b62e44 (diff)
downloadscummvm-rg350-f7f42fba21583ed5733268dedcc04f28e26372c2.tar.gz
scummvm-rg350-f7f42fba21583ed5733268dedcc04f28e26372c2.tar.bz2
scummvm-rg350-f7f42fba21583ed5733268dedcc04f28e26372c2.zip
HUGO: Get rid of (almost) all the remaining defines
svn-id: r55485
Diffstat (limited to 'engines')
-rw-r--r--engines/hugo/display.cpp21
-rw-r--r--engines/hugo/display.h4
-rw-r--r--engines/hugo/file.cpp42
-rw-r--r--engines/hugo/file.h15
-rw-r--r--engines/hugo/file_v1d.cpp4
-rw-r--r--engines/hugo/file_v2d.cpp12
-rw-r--r--engines/hugo/file_v3d.cpp8
-rw-r--r--engines/hugo/game.h28
-rw-r--r--engines/hugo/hugo.cpp2
-rw-r--r--engines/hugo/hugo.h3
-rw-r--r--engines/hugo/intro.cpp10
-rw-r--r--engines/hugo/mouse.cpp2
-rw-r--r--engines/hugo/mouse.h2
-rw-r--r--engines/hugo/object.cpp15
-rw-r--r--engines/hugo/object.h6
-rw-r--r--engines/hugo/object_v1d.cpp8
-rw-r--r--engines/hugo/object_v2d.cpp8
-rw-r--r--engines/hugo/schedule.cpp2
-rw-r--r--engines/hugo/schedule.h2
19 files changed, 96 insertions, 98 deletions
diff --git a/engines/hugo/display.cpp b/engines/hugo/display.cpp
index d0f45cb2e1..f5db2886cd 100644
--- a/engines/hugo/display.cpp
+++ b/engines/hugo/display.cpp
@@ -41,11 +41,6 @@
#include "hugo/util.h"
namespace Hugo {
-
-#define INX(X, B) (X >= B->x && X <= B->x + B->dx)
-#define INY(Y, B) (Y >= B->y && Y <= B->y + B->dy)
-#define OVERLAP(A, B) ((INX(A->x, B) || INX(A->x + A->dx, B) || INX(B->x, A) || INX(B->x + B->dx, A)) && (INY(A->y, B) || INY(A->y + A->dy, B) || INY(B->y, A) || INY(B->y + B->dy, A)))
-
Screen::Screen(HugoEngine *vm) : _vm(vm), _mainPalette(0), _curPalette(0) {
for (int i = 0; i < kNumFonts; i++) {
_arrayFont[i] = 0;
@@ -264,7 +259,7 @@ int16 Screen::mergeLists(rect_t *list, rect_t *blist, int16 len, int16 blen, int
rect_t *bp = blist;
for (int16 b = 0; b < blen; b++, bp++) {
if (bp->dx) // blist entry used
- if (OVERLAP(list, bp))
+ if (isOverlaping(list, bp))
coalesce[c++] = b;
}
@@ -592,6 +587,19 @@ void Screen::hideCursor() {
CursorMan.showMouse(false);
}
+bool Screen::isInX(int16 x, rect_t *rect) {
+ return (x >= rect->x) && (x <= rect->x + rect->dx);
+}
+
+bool Screen::isInY(int16 y, rect_t *rect) {
+ return (y >= rect->y) && (y <= rect->y + rect->dy);
+}
+
+bool Screen::isOverlaping(rect_t *rectA, rect_t *rectB) {
+ return (isInX(rectA->x, rectB) || isInX(rectA->x + rectA->dx, rectB) || isInX(rectB->x, rectA) || isInX(rectB->x + rectB->dx, rectA)) &&
+ (isInY(rectA->y, rectB) || isInY(rectA->y + rectA->dy, rectB) || isInY(rectB->y, rectA) || isInY(rectB->y + rectB->dy, rectA));
+}
+
Screen_v1d::Screen_v1d(HugoEngine *vm) : Screen(vm) {
}
@@ -698,5 +706,6 @@ void Screen_v1w::loadFontArr(Common::File &in) {
in.readByte();
}
}
+
} // End of namespace Hugo
diff --git a/engines/hugo/display.h b/engines/hugo/display.h
index 4e2a01c763..2805061a42 100644
--- a/engines/hugo/display.h
+++ b/engines/hugo/display.h
@@ -145,6 +145,10 @@ protected:
static const int kRectListSize = 16; // Size of add/restore rect lists
static const int kBlitListSize = kRectListSize * 2; // Size of dirty rect blit list
+ inline bool isInX(int16 x, rect_t *rect);
+ inline bool isInY(int16 y, rect_t *rect);
+ inline bool isOverlaping(rect_t *rectA, rect_t *rectB);
+
bool fontLoadedFl[kNumFonts];
// Fonts used in dib (non-GDI)
diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp
index b481219bb9..086c13e70a 100644
--- a/engines/hugo/file.cpp
+++ b/engines/hugo/file.cpp
@@ -170,10 +170,10 @@ void FileManager::readImage(int objNum, object_t *objPtr) {
_objectsArchive.seek(objBlock.objOffset, SEEK_SET);
} else {
char *buf = (char *) malloc(2048 + 1); // Buffer for file access
- strcat(strcat(strcpy(buf, _vm->_picDir), _vm->_arrayNouns[objPtr->nounIndex][0]), OBJEXT);
+ strcat(strcat(strcpy(buf, _vm->_picDir), _vm->_arrayNouns[objPtr->nounIndex][0]), ".PIX");
if (!_objectsArchive.open(buf)) {
- warning("File %s not found, trying again with %s%s", buf, _vm->_arrayNouns[objPtr->nounIndex][0], OBJEXT);
- strcat(strcpy(buf, _vm->_arrayNouns[objPtr->nounIndex][0]), OBJEXT);
+ warning("File %s not found, trying again with %s%s", buf, _vm->_arrayNouns[objPtr->nounIndex][0], ".PIX");
+ strcat(strcpy(buf, _vm->_arrayNouns[objPtr->nounIndex][0]), ".PIX");
if (!_objectsArchive.open(buf))
error("File not found: %s", buf);
}
@@ -257,8 +257,8 @@ sound_pt FileManager::getSound(int16 sound, uint16 *size) {
// Open sounds file
Common::File fp; // Handle to SOUND_FILE
- if (!fp.open(SOUND_FILE)) {
- warning("Hugo Error: File not found %s", SOUND_FILE);
+ if (!fp.open(getSoundFilename())) {
+ warning("Hugo Error: File not found %s", getSoundFilename());
return 0;
}
@@ -268,13 +268,13 @@ sound_pt FileManager::getSound(int16 sound, uint16 *size) {
if (!has_read_header) {
if (fp.read(s_hdr, sizeof(s_hdr)) != sizeof(s_hdr))
- error("Wrong sound file format: %s", SOUND_FILE);
+ error("Wrong sound file format");
has_read_header = true;
}
*size = s_hdr[sound].size;
if (*size == 0)
- error("Wrong sound file format or missing sound %d: %s", sound, SOUND_FILE);
+ error("Wrong sound file format or missing sound %d", sound);
// Allocate memory for sound or music, if possible
sound_pt soundPtr = (byte *)malloc(s_hdr[sound].size); // Ptr to sound data
@@ -283,7 +283,7 @@ sound_pt FileManager::getSound(int16 sound, uint16 *size) {
// Seek to data and read it
fp.seek(s_hdr[sound].offset, SEEK_SET);
if (fp.read(soundPtr, s_hdr[sound].size) != s_hdr[sound].size)
- error("File not found: %s", SOUND_FILE);
+ error("Wrong sound file format");
fp.close();
@@ -516,11 +516,11 @@ bool FileManager::restoreGame(int16 slot) {
* Read the encrypted text from the boot file and print it
*/
void FileManager::printBootText() {
- debugC(1, kDebugFile, "printBootText");
+ debugC(1, kDebugFile, "printBootText()");
static const char *cypher = getBootCypher();
Common::File ofp;
- if (!ofp.open(BOOTFILE)) {
+ if (!ofp.open(getBootFilename())) {
if (_vm->_gameVariant == kGameVariantH1Dos) {
//TODO initialize properly _boot structure
warning("printBootText - Skipping as H1 Dos may be a freeware");
@@ -556,11 +556,11 @@ void FileManager::printBootText() {
* file checksum is bad. De-crypts structure while checking checksum
*/
void FileManager::readBootFile() {
- debugC(1, kDebugFile, "readBootFile");
+ debugC(1, kDebugFile, "readBootFile()");
static const char *cypher = getBootCypher();
Common::File ofp;
- if (!ofp.open(BOOTFILE)) {
+ if (!ofp.open(getBootFilename())) {
if (_vm->_gameVariant == kGameVariantH1Dos) {
//TODO initialize properly _boot structure
warning("readBootFile - Skipping as H1 Dos may be a freeware");
@@ -594,6 +594,8 @@ void FileManager::readBootFile() {
/**
* Returns address of uif_hdr[id], reading it in if first call
+* This file contains, between others, the bitmaps of the fonts used in the application
+* UIF means User interface database (Windows Only)
*/
uif_hdr_t *FileManager::getUIFHeader(uif_t id) {
debugC(1, kDebugFile, "getUIFHeader(%d)", id);
@@ -606,11 +608,11 @@ uif_hdr_t *FileManager::getUIFHeader(uif_t id) {
firstFl = false;
// Open unbuffered to do far read
Common::File ip; // Image data file
- if (!ip.open(UIF_FILE))
- error("File not found: %s", UIF_FILE);
+ if (!ip.open(getUifFilename()))
+ error("File not found: %s", getUifFilename());
if (ip.size() < (int32)sizeof(UIFHeader))
- error("Wrong file format: %s", UIF_FILE);
+ error("Wrong UIF file format");
for (int i = 0; i < kMaxUifs; ++i) {
UIFHeader[i].size = ip.readUint16LE();
@@ -630,8 +632,8 @@ void FileManager::readUIFItem(int16 id, byte *buf) {
// Open uif file to read data
Common::File ip; // UIF_FILE handle
- if (!ip.open(UIF_FILE))
- error("File not found: %s", UIF_FILE);
+ if (!ip.open(getUifFilename()))
+ error("File not found: %s", getUifFilename());
// Seek to data
uif_hdr_t *UIFHeaderPtr = getUIFHeader((uif_t)id);
@@ -641,12 +643,12 @@ void FileManager::readUIFItem(int16 id, byte *buf) {
seq_t *dummySeq; // Dummy seq_t for image data
switch (id) {
case UIF_IMAGES: // Read uif images file
- dummySeq = readPCX(ip, 0, buf, true, UIF_FILE);
+ dummySeq = readPCX(ip, 0, buf, true, getUifFilename());
free(dummySeq);
break;
default: // Read file data into supplied array
if (ip.read(buf, UIFHeaderPtr->size) != UIFHeaderPtr->size)
- error("Wrong file format: %s", UIF_FILE);
+ error("Wrong UIF file format");
break;
}
@@ -657,7 +659,7 @@ void FileManager::readUIFItem(int16 id, byte *buf) {
* Read the uif image file (inventory icons)
*/
void FileManager::readUIFImages() {
- debugC(1, kDebugFile, "readUIFImages");
+ debugC(1, kDebugFile, "readUIFImages()");
readUIFItem(UIF_IMAGES, _vm->_screen->getGUIBuffer()); // Read all uif images
}
diff --git a/engines/hugo/file.h b/engines/hugo/file.h
index b94c4a23f7..72029f0ddb 100644
--- a/engines/hugo/file.h
+++ b/engines/hugo/file.h
@@ -33,14 +33,7 @@
#ifndef HUGO_FILE_H
#define HUGO_FILE_H
-// TODO get rid of those defines
-#define HELPFILE "help.dat"
-#define BOOTFILE "HUGO.BSF" // Name of boot structure file
-#define EOP '#' // Marks end of a page in help file
-
namespace Hugo {
-
-
/**
* Enumerate overlay file types
*/
@@ -61,6 +54,14 @@ public:
bool restoreGame(int16 slot);
bool saveGame(int16 slot, Common::String descrip);
+ // Name scenery and objects picture databases
+ const char *getBootFilename() { return "HUGO.BSF"; }
+ const char *getObjectFilename() { return "objects.dat"; }
+ const char *getSceneryFilename() { return "scenery.dat"; }
+ const char *getSoundFilename() { return "sounds.dat"; }
+ const char *getStringFilename() { return "strings.dat"; }
+ const char *getUifFilename() { return "uif.dat"; }
+
virtual void openDatabaseFiles() = 0;
virtual void closeDatabaseFiles() = 0;
virtual void instructions() = 0;
diff --git a/engines/hugo/file_v1d.cpp b/engines/hugo/file_v1d.cpp
index 72f99615b8..49543eea49 100644
--- a/engines/hugo/file_v1d.cpp
+++ b/engines/hugo/file_v1d.cpp
@@ -110,7 +110,7 @@ char *FileManager_v1d::fetchString(int index) {
*/
void FileManager_v1d::instructions() {
Common::File f;
- if (!f.open(HELPFILE)) {
+ if (!f.open("help.dat")) {
warning("help.dat not found");
return;
}
@@ -123,7 +123,7 @@ void FileManager_v1d::instructions() {
wrkLine++;
do {
f.read(wrkLine, 1);
- } while (*wrkLine++ != EOP);
+ } while (*wrkLine++ != '#'); // '#' is EOP
wrkLine[-2] = '\0'; // Remove EOP and previous CR
Utils::Box(kBoxAny, "%s", line);
wrkLine = line;
diff --git a/engines/hugo/file_v2d.cpp b/engines/hugo/file_v2d.cpp
index b5ff9722fb..5dcac59742 100644
--- a/engines/hugo/file_v2d.cpp
+++ b/engines/hugo/file_v2d.cpp
@@ -51,12 +51,12 @@ FileManager_v2d::~FileManager_v2d() {
void FileManager_v2d::openDatabaseFiles() {
debugC(1, kDebugFile, "openDatabaseFiles");
- if (!_stringArchive.open(STRING_FILE))
- error("File not found: %s", STRING_FILE);
- if (!_sceneryArchive1.open("scenery.dat"))
- error("File not found: scenery.dat");
- if (!_objectsArchive.open(OBJECTS_FILE))
- error("File not found: %s", OBJECTS_FILE);
+ if (!_stringArchive.open(getStringFilename()))
+ error("File not found: %s", getStringFilename());
+ if (!_sceneryArchive1.open(getSceneryFilename()))
+ error("File not found: %s", getSceneryFilename());
+ if (!_objectsArchive.open(getObjectFilename()))
+ error("File not found: %s", getObjectFilename());
}
/**
diff --git a/engines/hugo/file_v3d.cpp b/engines/hugo/file_v3d.cpp
index 4e3570ad95..45ed225c85 100644
--- a/engines/hugo/file_v3d.cpp
+++ b/engines/hugo/file_v3d.cpp
@@ -81,14 +81,14 @@ void FileManager_v3d::readBackground(int screenIndex) {
void FileManager_v3d::openDatabaseFiles() {
debugC(1, kDebugFile, "openDatabaseFiles");
- if (!_stringArchive.open(STRING_FILE))
- error("File not found: %s", STRING_FILE);
+ if (!_stringArchive.open(getStringFilename()))
+ error("File not found: %s", getStringFilename());
if (!_sceneryArchive1.open("scenery1.dat"))
error("File not found: scenery1.dat");
if (!_sceneryArchive2.open("scenery2.dat"))
error("File not found: scenery2.dat");
- if (!_objectsArchive.open(OBJECTS_FILE))
- error("File not found: %s", OBJECTS_FILE);
+ if (!_objectsArchive.open(getObjectFilename()))
+ error("File not found: %s", getObjectFilename());
}
/**
diff --git a/engines/hugo/game.h b/engines/hugo/game.h
index b742d3653f..dd9eb5e918 100644
--- a/engines/hugo/game.h
+++ b/engines/hugo/game.h
@@ -42,34 +42,8 @@ class SeekableReadStream;
namespace Hugo {
-// WARNING!!
-// Type "PPG" in the game to enter cheat mode.
-
-#define COPYRIGHT "Copyright 1989-1997 David P Gray, All Rights Reserved."
-
-// Started code on 04/01/95
-// VER "1.0" // 10/01/95 Initial Release
-// VER "1.1" // 10/06/95 Restore system volume levels on exit
-// VER "v1.2" // 10/12/95 Added "background music" checkbox in volume dlg
-// VER "v1.3" // 10/23/95 Support game 1 as shareware
-// VER "v1.4" // 12/06/95 Faster graphics, logical palette
-// VER "v1.5" // 10/07/97 Added order form, new web site
-
// Game specific equates
-#define TAKE_TEXT "Picked up the %s ok."
-
-// Only for non-database
-#define BKGEXT ".PCX" // Extension of background files
-#define OBJEXT ".PIX" // Extension of object picture files
-
-// Name scenery and objects picture databases
-#define OBJECTS_FILE "objects.dat"
-#define STRING_FILE "strings.dat"
-#define SOUND_FILE "sounds.dat"
-
-// User interface database (Windows Only)
-// This file contains, between others, the bitmaps of the fonts used in the application
-#define UIF_FILE "uif.dat"
+#define TAKE_TEXT "Picked up the %s ok."
enum {LOOK_NAME = 1, TAKE_NAME}; // Index of name used in showing takeables and in confirming take
diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp
index 45bd520167..b01ec2ee28 100644
--- a/engines/hugo/hugo.cpp
+++ b/engines/hugo/hugo.cpp
@@ -1286,7 +1286,7 @@ void HugoEngine::endGame() {
if (!_boot.registered)
Utils::Box(kBoxAny, "%s", _textEngine[kEsAdvertise]);
- Utils::Box(kBoxAny, "%s\n%s", _episode, COPYRIGHT);
+ Utils::Box(kBoxAny, "%s\n%s", _episode, getCopyrightString());
_status.viewState = kViewExit;
}
diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h
index a3dd20fe27..ee4f331458 100644
--- a/engines/hugo/hugo.h
+++ b/engines/hugo/hugo.h
@@ -405,6 +405,9 @@ public:
return (f == kSupportsRTL) || (f == kSupportsLoadingDuringRuntime) || (f == kSupportsSavingDuringRuntime);
}
+ const char *getCopyrightString() { return "Copyright 1989-1997 David P Gray, All Rights Reserved."; }
+
+
FileManager *_file;
Scheduler *_scheduler;
Screen *_screen;
diff --git a/engines/hugo/intro.cpp b/engines/hugo/intro.cpp
index 1c930e1074..54dfa37e00 100644
--- a/engines/hugo/intro.cpp
+++ b/engines/hugo/intro.cpp
@@ -93,7 +93,7 @@ bool intro_v1d::introPlay() {
strcpy(buffer, "Shareware Version");
font.drawString(&surf, buffer, 0, 163, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter);
- font.drawString(&surf, COPYRIGHT, 0, 176, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter);
+ font.drawString(&surf, _vm->getCopyrightString(), 0, 176, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter);
if (scumm_stricmp(_boot.distrib, "David P. Gray")) {
sprintf(buffer, "Distributed by %s.", _boot.distrib);
@@ -219,9 +219,9 @@ void intro_v2d::introInit() {
error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 8");
if (_boot.registered)
- sprintf(buffer, "%s Registered Version", COPYRIGHT);
+ sprintf(buffer, "%s Registered Version", _vm->getCopyrightString());
else
- sprintf(buffer, "%s Shareware Version", COPYRIGHT);
+ sprintf(buffer, "%s Shareware Version", _vm->getCopyrightString());
font.drawString(&surf, buffer, 0, 186, 320, _TLIGHTRED, Graphics::kTextAlignCenter);
@@ -259,9 +259,9 @@ void intro_v3d::introInit() {
char buffer[128];
if (_boot.registered)
- sprintf(buffer, "%s Registered Version", COPYRIGHT);
+ sprintf(buffer, "%s Registered Version", _vm->getCopyrightString());
else
- sprintf(buffer,"%s Shareware Version", COPYRIGHT);
+ sprintf(buffer,"%s Shareware Version", _vm->getCopyrightString());
// TROMAN, size 10-5
if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 8)))
diff --git a/engines/hugo/mouse.cpp b/engines/hugo/mouse.cpp
index 0caa17ea6e..3d023b46e1 100644
--- a/engines/hugo/mouse.cpp
+++ b/engines/hugo/mouse.cpp
@@ -261,7 +261,7 @@ void MouseHandler::mouseHandler() {
// Display object name next to cursor (unless CURSOR_NOCHAR)
// Note test for swapped hero name
char *name = _vm->_arrayNouns[_vm->_object->_objects[(objId == kHeroIndex) ? _vm->_heroImage : objId].nounIndex][kCursorNameIndex];
- if (name[0] != CURSOR_NOCHAR)
+ if (name[0] != kCursorNochar)
cursorText(name, cx, cy, U_FONT8, _TBRIGHTWHITE);
// Process right click over object in view or iconbar
diff --git a/engines/hugo/mouse.h b/engines/hugo/mouse.h
index 76990e83da..bdb70f7d4c 100644
--- a/engines/hugo/mouse.h
+++ b/engines/hugo/mouse.h
@@ -43,7 +43,7 @@ public:
private:
HugoEngine *_vm;
- #define CURSOR_NOCHAR '~' // Don't show name of object under cursor
+ static const char kCursorNochar = '~'; // Don't show name of object under cursor
static const int kExitHotspot = -4; // Cursor over Exit hotspot
static const int kCursorNameIndex = 2; // Index of name used under cursor
diff --git a/engines/hugo/object.cpp b/engines/hugo/object.cpp
index d90067036d..18306c8808 100644
--- a/engines/hugo/object.cpp
+++ b/engines/hugo/object.cpp
@@ -314,14 +314,14 @@ bool ObjectHandler::findObjectSpace(object_t *obj, int16 *destx, int16 *desty) {
bool foundFl = true;
// Try left rear corner
for (int16 x = *destx = obj->x + curImage->x1; x < *destx + kHeroMaxWidth; x++) {
- if (BOUND(x, y))
+ if (checkBoundary(x, y))
foundFl = false;
}
if (!foundFl) { // Try right rear corner
foundFl = true;
for (int16 x = *destx = obj->x + curImage->x2 - kHeroMaxWidth + 1; x <= obj->x + (int16)curImage->x2; x++) {
- if (BOUND(x, y))
+ if (checkBoundary(x, y))
foundFl = false;
}
}
@@ -330,7 +330,7 @@ bool ObjectHandler::findObjectSpace(object_t *obj, int16 *destx, int16 *desty) {
foundFl = true;
y += 2;
for (int16 x = *destx = obj->x + curImage->x1; x < *destx + kHeroMaxWidth; x++) {
- if (BOUND(x, y))
+ if (checkBoundary(x, y))
foundFl = false;
}
}
@@ -338,7 +338,7 @@ bool ObjectHandler::findObjectSpace(object_t *obj, int16 *destx, int16 *desty) {
if (!foundFl) { // Try right rear corner
foundFl = true;
for (int16 x = *destx = obj->x + curImage->x2 - kHeroMaxWidth + 1; x <= obj->x + (int16)curImage->x2; x++) {
- if (BOUND(x, y))
+ if (checkBoundary(x, y))
foundFl = false;
}
}
@@ -573,7 +573,7 @@ int ObjectHandler::calcMaxScore() {
int score = 0;
for (int i = 0; i < _numObj; i++)
score += _objects[i].objValue;
- return(score);
+ return score;
}
/**
@@ -586,4 +586,9 @@ void ObjectHandler::readObjectImages() {
_vm->_file->readImage(i, &_objects[i]);
}
+bool ObjectHandler::checkBoundary(int16 x, int16 y) {
+ // Check if Boundary bit set
+ return (_vm->getBoundaryOverlay()[y * kCompLineSize + x / 8] & (0x80 >> x % 8)) != 0;
+}
+
} // End of namespace Hugo
diff --git a/engines/hugo/object.h b/engines/hugo/object.h
index 1de2fb1621..3a7dd47042 100644
--- a/engines/hugo/object.h
+++ b/engines/hugo/object.h
@@ -35,8 +35,6 @@
#include "common/file.h"
-#define BOUND(X, Y) ((_vm->getBoundaryOverlay()[Y * kCompLineSize + X / 8] & (0x80 >> X % 8)) != 0) // Boundary bit set
-
namespace Hugo {
class ObjectHandler {
@@ -101,6 +99,10 @@ protected:
uint16 _objCount;
void restoreSeq(object_t *obj);
+
+ inline bool checkBoundary(int16 x, int16 y);
+ template <typename T>
+ inline int sign(T a) { if ( a < 0) return -1; else return 1; }
};
class ObjectHandler_v1d : public ObjectHandler {
diff --git a/engines/hugo/object_v1d.cpp b/engines/hugo/object_v1d.cpp
index 1d50eb1a6e..80220314e0 100644
--- a/engines/hugo/object_v1d.cpp
+++ b/engines/hugo/object_v1d.cpp
@@ -380,11 +380,11 @@ void ObjectHandler_v1d::homeIn(int objIndex1, int objIndex2, int8 objDx, int8 ob
dy = 1;
if (abs(dx) > abs(dy)) {
- obj1->vx = objDx * -SIGN(dx);
- obj1->vy = abs((objDy * dy) / dx) * -SIGN(dy);
+ obj1->vx = objDx * -sign<int8>(dx);
+ obj1->vy = abs((objDy * dy) / dx) * -sign<int8>(dy);
} else {
- obj1->vy = objDy * SIGN(dy);
- obj1->vx = abs((objDx * dx) / dy) * SIGN(dx);
+ obj1->vy = objDy * sign<int8>(dy);
+ obj1->vx = abs((objDx * dx) / dy) * sign<int8>(dx);
}
}
} // End of namespace Hugo
diff --git a/engines/hugo/object_v2d.cpp b/engines/hugo/object_v2d.cpp
index b02d03c646..628594138d 100644
--- a/engines/hugo/object_v2d.cpp
+++ b/engines/hugo/object_v2d.cpp
@@ -374,11 +374,11 @@ void ObjectHandler_v2d::homeIn(int objIndex1, int objIndex2, int8 objDx, int8 ob
dy = 1;
if (abs(dx) > abs(dy)) {
- obj1->vx = objDx * -SIGN(dx);
- obj1->vy = abs((objDy * dy) / dx) * -SIGN(dy);
+ obj1->vx = objDx * -sign<int8>(dx);
+ obj1->vy = abs((objDy * dy) / dx) * -sign<int8>(dy);
} else {
- obj1->vy = objDy * -SIGN(dy);
- obj1->vx = abs((objDx * dx) / dy) * -SIGN(dx);
+ obj1->vy = objDy * -sign<int8>(dy);
+ obj1->vx = abs((objDx * dx) / dy) * -sign<int8>(dx);
}
}
} // End of namespace Hugo
diff --git a/engines/hugo/schedule.cpp b/engines/hugo/schedule.cpp
index b75a38c882..f8e5dc49dd 100644
--- a/engines/hugo/schedule.cpp
+++ b/engines/hugo/schedule.cpp
@@ -161,7 +161,7 @@ void Scheduler::newScreen(int screenIndex) {
// Make sure the background file exists!
if (!_vm->isPacked()) {
char line[32];
- if (!_vm->_file->fileExists(strcat(strncat(strcpy(line, _vm->_picDir), _vm->_screenNames[screenIndex], kFilenameLength), BKGEXT)) &&
+ if (!_vm->_file->fileExists(strcat(strncat(strcpy(line, _vm->_picDir), _vm->_screenNames[screenIndex], kFilenameLength), ".PCX")) &&
!_vm->_file->fileExists(strcat(strcpy(line, _vm->_screenNames[screenIndex]), ".ART"))) {
error("Unable to find background file for %s", _vm->_screenNames[screenIndex]);
return;
diff --git a/engines/hugo/schedule.h b/engines/hugo/schedule.h
index b0a1dac921..33d3eb2bd2 100644
--- a/engines/hugo/schedule.h
+++ b/engines/hugo/schedule.h
@@ -37,8 +37,6 @@
namespace Hugo {
-#define SIGN(X) ((X < 0) ? -1 : 1)
-
struct act0 { // Type 0 - Schedule
action_t actType; // The type of action
int timer; // Time to set off the action