aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/hugo/display.cpp58
-rw-r--r--engines/hugo/display.h26
-rw-r--r--engines/hugo/file.cpp22
-rw-r--r--engines/hugo/file.h48
-rw-r--r--engines/hugo/file_v1d.cpp8
-rw-r--r--engines/hugo/file_v1w.cpp2
-rw-r--r--engines/hugo/file_v2d.cpp6
-rw-r--r--engines/hugo/file_v2w.cpp2
-rw-r--r--engines/hugo/file_v3d.cpp4
-rw-r--r--engines/hugo/hugo.cpp24
-rw-r--r--engines/hugo/hugo.h32
-rw-r--r--engines/hugo/inventory.cpp4
-rw-r--r--engines/hugo/inventory.h4
-rw-r--r--engines/hugo/mouse.cpp8
-rw-r--r--engines/hugo/mouse.h8
-rw-r--r--engines/hugo/object.h6
-rw-r--r--engines/hugo/object_v1d.cpp2
-rw-r--r--engines/hugo/object_v2d.cpp2
-rw-r--r--engines/hugo/parser.cpp8
-rw-r--r--engines/hugo/parser.h28
-rw-r--r--engines/hugo/parser_v1d.cpp10
-rw-r--r--engines/hugo/parser_v1w.cpp2
-rw-r--r--engines/hugo/parser_v3d.cpp6
-rw-r--r--engines/hugo/route.cpp8
-rw-r--r--engines/hugo/route.h8
-rw-r--r--engines/hugo/schedule.cpp26
-rw-r--r--engines/hugo/schedule.h28
-rw-r--r--engines/hugo/sound.cpp10
-rw-r--r--engines/hugo/sound.h4
29 files changed, 198 insertions, 206 deletions
diff --git a/engines/hugo/display.cpp b/engines/hugo/display.cpp
index 0ce2534a17..1d960c6945 100644
--- a/engines/hugo/display.cpp
+++ b/engines/hugo/display.cpp
@@ -76,7 +76,7 @@ void Screen::initDisplay() {
/**
* Move an image from source to destination
*/
-void Screen::moveImage(image_pt srcImage, int16 x1, int16 y1, int16 dx, int16 dy, int16 width1, image_pt dstImage, int16 x2, int16 y2, int16 width2) {
+void Screen::moveImage(image_pt srcImage, const int16 x1, const int16 y1, const int16 dx, int16 dy, const int16 width1, image_pt dstImage, const int16 x2, const int16 y2, const int16 width2) {
debugC(3, kDebugDisplay, "moveImage(srcImage, %d, %d, %d, %d, %d, dstImage, %d, %d, %d)", x1, y1, dx, dy, width1, x2, y2, width2);
int16 wrap_src = width1 - dx; // Wrap to next src row
@@ -102,7 +102,7 @@ void Screen::displayBackground() {
/**
* Blit the supplied rectangle from _frontBuffer to the screen
*/
-void Screen::displayRect(int16 x, int16 y, int16 dx, int16 dy) {
+void Screen::displayRect(const int16 x, const int16 y, const int16 dx, const int16 dy) {
debugC(3, kDebugDisplay, "displayRect(%d, %d, %d, %d)", x, y, dx, dy);
int16 xClip, yClip;
@@ -115,7 +115,7 @@ void Screen::displayRect(int16 x, int16 y, int16 dx, int16 dy) {
* Change a color by remapping supplied palette index with new index in main palette.
* Alse save the new color in the current palette.
*/
-void Screen::remapPal(uint16 oldIndex, uint16 newIndex) {
+void Screen::remapPal(const uint16 oldIndex, const uint16 newIndex) {
debugC(1, kDebugDisplay, "Remap_pal(%d, %d)", oldIndex, newIndex);
byte pal[4];
@@ -131,7 +131,7 @@ void Screen::remapPal(uint16 oldIndex, uint16 newIndex) {
/**
* Saves the current palette in a savegame
*/
-void Screen::savePal(Common::WriteStream *f) {
+void Screen::savePal(Common::WriteStream *f) const {
debugC(1, kDebugDisplay, "savePal()");
for (int i = 0; i < _paletteSize; i++)
@@ -164,8 +164,8 @@ void Screen::restorePal(Common::SeekableReadStream *f) {
* This implementation gives the same result than the DOS version.
* It wasn't implemented in the Win version
*/
-void Screen::setBackgroundColor(long color) {
- debugC(1, kDebugDisplay, "setBackgroundColor(%ld)", color);
+void Screen::setBackgroundColor(const uint16 color) {
+ debugC(1, kDebugDisplay, "setBackgroundColor(%d)", color);
remapPal(0, color);
}
@@ -192,7 +192,7 @@ overlayState_t Screen::findOvl(seq_t *seq_p, image_pt dst_p, uint16 y) {
* Merge an object frame into _frontBuffer at sx, sy and update rectangle list.
* If fore TRUE, force object above any overlay
*/
-void Screen::displayFrame(int sx, int sy, seq_t *seq, bool foreFl) {
+void Screen::displayFrame(const int sx, const int sy, seq_t *seq, const bool foreFl) {
debugC(3, kDebugDisplay, "displayFrame(%d, %d, seq, %d)", sx, sy, (foreFl) ? 1 : 0);
image_pt image = seq->imagePtr; // Ptr to object image data
@@ -229,7 +229,7 @@ void Screen::displayFrame(int sx, int sy, seq_t *seq, bool foreFl) {
/**
* Merge rectangles A,B leaving result in B
*/
-void Screen::merge(rect_t *rectA, rect_t *rectB) {
+void Screen::merge(const rect_t *rectA, rect_t *rectB) {
debugC(6, kDebugDisplay, "merge()");
int16 xa = rectA->x + rectA->dx; // Find x2,y2 for each rectangle
@@ -249,7 +249,7 @@ void Screen::merge(rect_t *rectA, rect_t *rectB) {
* of blist. bmax is the max size of the blist. Note that blist can
* have holes, in which case dx = 0. Returns used length of blist.
*/
-int16 Screen::mergeLists(rect_t *list, rect_t *blist, int16 len, int16 blen, int16 bmax) {
+int16 Screen::mergeLists(rect_t *list, rect_t *blist, const int16 len, int16 blen) {
debugC(4, kDebugDisplay, "mergeLists()");
int16 coalesce[kBlitListSize]; // List of overlapping rects
@@ -327,8 +327,8 @@ void Screen::displayList(dupdate_t update, ...) {
}
// Coalesce restore-list, add-list into combined blit-list
- blitLength = mergeLists(restoreList, blistList, restoreIndex, blitLength, kBlitListSize);
- blitLength = mergeLists(addList, blistList, addIndex, blitLength, kBlitListSize);
+ blitLength = mergeLists(restoreList, blistList, restoreIndex, blitLength);
+ blitLength = mergeLists(addList, blistList, addIndex, blitLength);
// Blit the combined blit-list
for (restoreIndex = 0, p = blistList; restoreIndex < blitLength; restoreIndex++, p++) {
@@ -354,7 +354,7 @@ void Screen::displayList(dupdate_t update, ...) {
* *(fontdata+1) = Font Width (pixels)
* *(fontdata+x) = Font Bitmap (monochrome)
*/
-void Screen::writeChr(int sx, int sy, byte color, char *local_fontdata) {
+void Screen::writeChr(const int sx, const int sy, const byte color, const char *local_fontdata){
debugC(2, kDebugDisplay, "writeChr(%d, %d, %d, %d)", sx, sy, color, local_fontdata[0]);
byte height = local_fontdata[0];
@@ -386,10 +386,10 @@ int16 Screen::fontHeight() {
/**
* Returns length of supplied string in pixels
*/
-int16 Screen::stringLength(const char *s) {
+int16 Screen::stringLength(const char *s) const {
debugC(2, kDebugDisplay, "stringLength(%s)", s);
- byte **fontArr = _font[_fnt];
+ byte *const*fontArr = _font[_fnt];
int16 sum = 0;
for (; *s; s++)
sum += *(fontArr[(uint)*s] + 1) + 1;
@@ -400,7 +400,7 @@ int16 Screen::stringLength(const char *s) {
/**
* Return x which would center supplied string
*/
-int16 Screen::center(const char *s) {
+int16 Screen::center(const char *s) const {
debugC(1, kDebugDisplay, "center(%s)", s);
return (int16)((kXPix - stringLength(s)) >> 1);
@@ -410,13 +410,13 @@ int16 Screen::center(const char *s) {
* Write string at sx,sy in supplied color in current font
* If sx == CENTER, center it
*/
-void Screen::writeStr(int16 sx, int16 sy, const char *s, byte color) {
+void Screen::writeStr(int16 sx, const int16 sy, const char *s, const byte color) {
debugC(2, kDebugDisplay, "writeStr(%d, %d, %s, %d)", sx, sy, s, color);
if (sx == kCenter)
sx = center(s);
- byte **font = _font[_fnt];
+ byte *const*font = _font[_fnt];
for (; *s; s++) {
writeChr(sx, sy, color, (char *)font[(uint)*s]);
sx += *(font[(uint)*s] + 1) + 1;
@@ -426,7 +426,7 @@ void Screen::writeStr(int16 sx, int16 sy, const char *s, byte color) {
/**
* Shadowed version of writestr
*/
-void Screen::shadowStr(int16 sx, int16 sy, const char *s, byte color) {
+void Screen::shadowStr(int16 sx, const int16 sy, const char *s, const byte color) {
debugC(1, kDebugDisplay, "shadowStr(%d, %d, %s, %d)", sx, sy, s, color);
if (sx == kCenter)
@@ -440,7 +440,7 @@ void Screen::shadowStr(int16 sx, int16 sy, const char *s, byte color) {
* Introduce user to the game. In the original games, it was only
* present in the DOS versions
*/
-void Screen::userHelp() {
+void Screen::userHelp() const {
Utils::Box(kBoxAny , "%s",
"F1 - Press F1 again\n"
" for instructions\n"
@@ -473,7 +473,7 @@ void Screen::drawStatusText() {
displayList(kDisplayAdd, posX, posY, sdx, sdy);
}
-void Screen::drawShape(int x, int y, int color1, int color2) {
+void Screen::drawShape(const int x, const int y, const int color1, const int color2) {
for (int i = 0; i < kShapeSize; i++) {
for (int j = 0; j < i; j++) {
_backBuffer[320 * (y + i) + (x + kShapeSize + j - i)] = color1;
@@ -490,7 +490,7 @@ void Screen::drawShape(int x, int y, int color1, int color2) {
/**
* Display rectangle (filles or empty)
*/
-void Screen::drawRectangle(bool filledFl, int16 x1, int16 y1, int16 x2, int16 y2, int color) {
+void Screen::drawRectangle(const bool filledFl, const int16 x1, const int16 y1, const int16 x2, const int16 y2, const int color) {
assert(x1 <= x2);
assert(y1 <= y2);
int16 x2Clip = CLIP<int16>(x2, 0, 320);
@@ -555,15 +555,15 @@ void Screen::freeFonts() {
}
}
-void Screen::selectInventoryObjId(int16 objId) {
+void Screen::selectInventoryObjId(const int16 objId) {
status_t &gameStatus = _vm->getGameStatus();
gameStatus.inventoryObjId = objId; // Select new object
// Find index of icon
- int16 iconId; // Find index of dragged icon
- for (iconId = 0; iconId < _vm->_maxInvent; iconId++) {
+ int16 iconId = 0; // Find index of dragged icon
+ for (; iconId < _vm->_maxInvent; iconId++) {
if (gameStatus.inventoryObjId == _vm->_invent[iconId])
break;
}
@@ -597,18 +597,18 @@ void Screen::hideCursor() {
CursorMan.showMouse(false);
}
-bool Screen::isInX(int16 x, rect_t *rect) {
+bool Screen::isInX(const int16 x, const rect_t *rect) const {
return (x >= rect->x) && (x <= rect->x + rect->dx);
}
-bool Screen::isInY(int16 y, rect_t *rect) {
+bool Screen::isInY(const int16 y, const rect_t *rect) const {
return (y >= rect->y) && (y <= rect->y + rect->dy);
}
/**
* Check if two rectangles are over lapping
*/
-bool Screen::isOverlaping(rect_t *rectA, rect_t *rectB) {
+bool Screen::isOverlaping(const rect_t *rectA, const rect_t *rectB) const {
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));
}
@@ -653,7 +653,7 @@ Screen_v1d::~Screen_v1d() {
* TODO: This uses hardcoded fonts in hugo.dat, it should be replaced
* by a proper implementation of .FON files
*/
-void Screen_v1d::loadFont(int16 fontId) {
+void Screen_v1d::loadFont(const int16 fontId) {
debugC(2, kDebugDisplay, "loadFont(%d)", fontId);
assert(fontId < kNumFonts);
@@ -708,7 +708,7 @@ Screen_v1w::~Screen_v1w() {
/**
* Load font file, construct font ptrs and reverse data bytes
*/
-void Screen_v1w::loadFont(int16 fontId) {
+void Screen_v1w::loadFont(const int16 fontId) {
debugC(2, kDebugDisplay, "loadFont(%d)", fontId);
_fnt = fontId - kFirstFont; // Set current font number
diff --git a/engines/hugo/display.h b/engines/hugo/display.h
index 454005b47a..f3fe08f02b 100644
--- a/engines/hugo/display.h
+++ b/engines/hugo/display.h
@@ -91,7 +91,7 @@ public:
virtual void loadFontArr(Common::File &in) = 0;
int16 fontHeight();
- int16 stringLength(const char *s);
+ int16 stringLength(const char *s) const;
void displayBackground();
void displayFrame(int sx, int sy, seq_t *seq, bool foreFl);
@@ -111,14 +111,14 @@ public:
void remapPal(uint16 oldIndex, uint16 newIndex);
void resetInventoryObjId();
void restorePal(Common::SeekableReadStream *f);
- void savePal(Common::WriteStream *f);
- void setBackgroundColor(long color);
+ void savePal(Common::WriteStream *f) const;
+ void setBackgroundColor(const uint16 color);
void setCursorPal();
void selectInventoryObjId(int16 objId);
- void shadowStr(int16 sx, int16 sy, const char *s, byte color);
+ void shadowStr(int16 sx, const int16 sy, const char *s, const byte color);
void showCursor();
- void userHelp();
- void writeStr(int16 sx, int16 sy, const char *s, byte color);
+ void userHelp() const;
+ void writeStr(int16 sx, const int16 sy, const char *s, const byte color);
icondib_t &getIconBuffer() {
return _iconBuffer;
@@ -146,9 +146,9 @@ 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);
+ inline bool isInX(const int16 x, const rect_t *rect) const;
+ inline bool isInY(const int16 y, const rect_t *rect) const;
+ inline bool isOverlaping(const rect_t *rectA, const rect_t *rectB) const;
bool fontLoadedFl[kNumFonts];
@@ -167,8 +167,8 @@ private:
icondib_t _iconBuffer; // Inventory icon DIB
- int16 mergeLists(rect_t *list, rect_t *blist, int16 len, int16 blen, int16 bmax);
- int16 center(const char *s);
+ int16 mergeLists(rect_t *list, rect_t *blist, const int16 len, int16 blen);
+ int16 center(const char *s) const;
overlayState_t findOvl(seq_t *seq_p, image_pt dst_p, uint16 y);
@@ -178,8 +178,8 @@ private:
viewdib_t _backBufferBackup; // Backup _backBuffer during inventory
void createPal();
- void merge(rect_t *rectA, rect_t *rectB);
- void writeChr(int sx, int sy, byte color, char *local_fontdata);
+ void merge(const rect_t *rectA, rect_t *rectB);
+ void writeChr(const int sx, const int sy, const byte color, const char *local_fontdata);
};
class Screen_v1d : public Screen {
diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp
index b6b34da592..a6a3690464 100644
--- a/engines/hugo/file.cpp
+++ b/engines/hugo/file.cpp
@@ -55,7 +55,7 @@ FileManager::~FileManager() {
* Convert 4 planes (RGBI) data to 8-bit DIB format
* Return original plane data ptr
*/
-byte *FileManager::convertPCC(byte *p, uint16 y, uint16 bpl, image_pt dataPtr) {
+byte *FileManager::convertPCC(byte *p, const uint16 y, const uint16 bpl, image_pt dataPtr) const{
debugC(2, kDebugFile, "convertPCC(byte *p, %d, %d, image_pt data_p)", y, bpl);
dataPtr += y * bpl * 8; // Point to correct DIB line
@@ -75,7 +75,7 @@ byte *FileManager::convertPCC(byte *p, uint16 y, uint16 bpl, image_pt dataPtr) {
* allocate space if NULL. Name used for errors. Returns address of seq_p
* Set first TRUE to initialize b_index (i.e. not reading a sequential image in file).
*/
-seq_t *FileManager::readPCX(Common::File &f, seq_t *seqPtr, byte *imagePtr, bool firstFl, const char *name) {
+seq_t *FileManager::readPCX(Common::File &f, seq_t *seqPtr, byte *imagePtr, const bool firstFl, const char *name) {
debugC(1, kDebugFile, "readPCX(..., %s)", name);
// Read in the PCC header and check consistency
@@ -115,9 +115,9 @@ seq_t *FileManager::readPCX(Common::File &f, seq_t *seqPtr, byte *imagePtr, bool
uint16 size = seqPtr->lines * seqPtr->bytesPerLine8;
// Allocate memory for image data if NULL
- if (imagePtr == 0) {
+ if (imagePtr == 0)
imagePtr = (byte *)malloc((size_t) size);
- }
+
assert(imagePtr);
seqPtr->imagePtr = imagePtr;
@@ -147,7 +147,7 @@ seq_t *FileManager::readPCX(Common::File &f, seq_t *seqPtr, byte *imagePtr, bool
/**
* Read object file of PCC images into object supplied
*/
-void FileManager::readImage(int objNum, object_t *objPtr) {
+void FileManager::readImage(const int objNum, object_t *objPtr) {
debugC(1, kDebugFile, "readImage(%d, object_t *objPtr)", objNum);
/**
@@ -247,7 +247,7 @@ void FileManager::readImage(int objNum, object_t *objPtr) {
* Read sound (or music) file data. Call with SILENCE to free-up
* any allocated memory. Also returns size of data
*/
-sound_pt FileManager::getSound(int16 sound, uint16 *size) {
+sound_pt FileManager::getSound(const int16 sound, uint16 *size) {
debugC(1, kDebugFile, "getSound(%d)", sound);
// No more to do if SILENCE (called for cleanup purposes)
@@ -300,7 +300,7 @@ bool FileManager::fileExists(const Common::String filename) const {
/**
* Save game to supplied slot
*/
-bool FileManager::saveGame(int16 slot, const Common::String descrip) {
+bool FileManager::saveGame(const int16 slot, const Common::String descrip) {
debugC(1, kDebugFile, "saveGame(%d, %s)", slot, descrip.c_str());
const EnginePlugin *plugin = NULL;
@@ -415,7 +415,7 @@ bool FileManager::saveGame(int16 slot, const Common::String descrip) {
/**
* Restore game from supplied slot number
*/
-bool FileManager::restoreGame(int16 slot) {
+bool FileManager::restoreGame(const int16 slot) {
debugC(1, kDebugFile, "restoreGame(%d)", slot);
const EnginePlugin *plugin = NULL;
@@ -602,7 +602,7 @@ void FileManager::readBootFile() {
* 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) {
+uif_hdr_t *FileManager::getUIFHeader(const uif_t id) {
debugC(1, kDebugFile, "getUIFHeader(%d)", id);
static bool firstFl = true;
@@ -632,7 +632,7 @@ uif_hdr_t *FileManager::getUIFHeader(uif_t id) {
/**
* Read uif item into supplied buffer.
*/
-void FileManager::readUIFItem(int16 id, byte *buf) {
+void FileManager::readUIFItem(const int16 id, byte *buf) {
debugC(1, kDebugFile, "readUIFItem(%d, ...)", id);
// Open uif file to read data
@@ -669,7 +669,7 @@ void FileManager::readUIFImages() {
readUIFItem(UIF_IMAGES, _vm->_screen->getGUIBuffer()); // Read all uif images
}
-const char *FileManager::getBootCypher() {
+const char *FileManager::getBootCypher() const {
return "Copyright 1992, David P Gray, Gray Design Associates";
}
} // End of namespace Hugo
diff --git a/engines/hugo/file.h b/engines/hugo/file.h
index 5788298edc..a5c2254f3e 100644
--- a/engines/hugo/file.h
+++ b/engines/hugo/file.h
@@ -45,14 +45,14 @@ public:
virtual ~FileManager();
bool fileExists(const Common::String filename) const;
- sound_pt getSound(int16 sound, uint16 *size);
+ sound_pt getSound(const int16 sound, uint16 *size);
void readBootFile();
- void readImage(int objNum, object_t *objPtr);
+ void readImage(const int objNum, object_t *objPtr);
void readUIFImages();
- void readUIFItem(int16 id, byte *buf);
- bool restoreGame(int16 slot);
- bool saveGame(int16 slot, const Common::String descrip);
+ void readUIFItem(const int16 id, byte *buf);
+ bool restoreGame(const int16 slot);
+ bool saveGame(const int16 slot, const Common::String descrip);
// Name scenery and objects picture databases
const char *getBootFilename() { return "HUGO.BSF"; }
@@ -64,12 +64,12 @@ public:
virtual void openDatabaseFiles() = 0;
virtual void closeDatabaseFiles() = 0;
- virtual void instructions() = 0;
+ virtual void instructions() const = 0;
- virtual void readBackground(int screenIndex) = 0;
- virtual void readOverlay(int screenNum, image_pt image, ovl_t overlayType) = 0;
+ virtual void readBackground(const int screenIndex) = 0;
+ virtual void readOverlay(const int screenNum, image_pt image, ovl_t overlayType) = 0;
- virtual char *fetchString(int index) = 0;
+ virtual char *fetchString(const int index) = 0;
protected:
HugoEngine *_vm;
@@ -96,12 +96,12 @@ protected:
Common::File _sceneryArchive1; // Handle for scenery file
Common::File _objectsArchive; // Handle for objects file
- seq_t *readPCX(Common::File &f, seq_t *seqPtr, byte *imagePtr, bool firstFl, const char *name);
- const char *getBootCypher();
+ seq_t *readPCX(Common::File &f, seq_t *seqPtr, byte *imagePtr, const bool firstFl, const char *name);
+ const char *getBootCypher() const;
private:
- byte *convertPCC(byte *p, uint16 y, uint16 bpl, image_pt data_p);
- uif_hdr_t *getUIFHeader(uif_t id);
+ byte *convertPCC(byte *p, const uint16 y, const uint16 bpl, image_pt dataPtr) const;
+ uif_hdr_t *getUIFHeader(const uif_t id);
//Strangerke : Not used?
void printBootText();
@@ -113,11 +113,11 @@ public:
~FileManager_v1d();
virtual void closeDatabaseFiles();
- virtual void instructions();
+ virtual void instructions() const;
virtual void openDatabaseFiles();
- virtual void readBackground(int screenIndex);
- virtual void readOverlay(int screenNum, image_pt image, ovl_t overlayType);
- virtual char *fetchString(int index);
+ virtual void readBackground(const int screenIndex);
+ virtual void readOverlay(const int screenNum, image_pt image, ovl_t overlayType);
+ virtual char *fetchString(const int index);
};
class FileManager_v2d : public FileManager_v1d {
@@ -127,9 +127,9 @@ public:
virtual void closeDatabaseFiles();
virtual void openDatabaseFiles();
- virtual void readBackground(int screenIndex);
- virtual void readOverlay(int screenNum, image_pt image, ovl_t overlayType);
- char *fetchString(int index);
+ virtual void readBackground(const int screenIndex);
+ virtual void readOverlay(const int screenNum, image_pt image, ovl_t overlayType);
+ char *fetchString(const int index);
};
class FileManager_v3d : public FileManager_v2d {
@@ -139,8 +139,8 @@ public:
void closeDatabaseFiles();
void openDatabaseFiles();
- void readBackground(int screenIndex);
- void readOverlay(int screenNum, image_pt image, ovl_t overlayType);
+ void readBackground(const int screenIndex);
+ void readOverlay(const int screenNum, image_pt image, ovl_t overlayType);
private:
Common::File _sceneryArchive2; // Handle for scenery file
};
@@ -150,7 +150,7 @@ public:
FileManager_v2w(HugoEngine *vm);
~FileManager_v2w();
- void instructions();
+ void instructions() const;
};
class FileManager_v1w : public FileManager_v2w {
@@ -158,7 +158,7 @@ public:
FileManager_v1w(HugoEngine *vm);
~FileManager_v1w();
- void readOverlay(int screenNum, image_pt image, ovl_t overlayType);
+ void readOverlay(const int screenNum, image_pt image, ovl_t overlayType);
};
} // End of namespace Hugo
diff --git a/engines/hugo/file_v1d.cpp b/engines/hugo/file_v1d.cpp
index 964887fc34..417b637ab2 100644
--- a/engines/hugo/file_v1d.cpp
+++ b/engines/hugo/file_v1d.cpp
@@ -56,7 +56,7 @@ void FileManager_v1d::closeDatabaseFiles() {
/**
* Open and read in an overlay file, close file
*/
-void FileManager_v1d::readOverlay(int screenNum, image_pt image, ovl_t overlayType) {
+void FileManager_v1d::readOverlay(const int screenNum, image_pt image, const ovl_t overlayType) {
debugC(1, kDebugFile, "readOverlay(%d, ...)", screenNum);
const char *ovl_ext[] = {".b", ".o", ".ob"};
@@ -81,7 +81,7 @@ void FileManager_v1d::readOverlay(int screenNum, image_pt image, ovl_t overlayTy
/**
* Read a PCX image into dib_a
*/
-void FileManager_v1d::readBackground(int screenIndex) {
+void FileManager_v1d::readBackground(const int screenIndex) {
debugC(1, kDebugFile, "readBackground(%d)", screenIndex);
Common::String buf;
@@ -95,7 +95,7 @@ void FileManager_v1d::readBackground(int screenIndex) {
_sceneryArchive1.close();
}
-char *FileManager_v1d::fetchString(int index) {
+char *FileManager_v1d::fetchString(const int index) {
debugC(1, kDebugFile, "fetchString(%d)", index);
return _vm->_text->getStringtData(index);
@@ -105,7 +105,7 @@ char *FileManager_v1d::fetchString(int index) {
* Simple instructions given when F1 pressed twice in a row
* Only in DOS versions
*/
-void FileManager_v1d::instructions() {
+void FileManager_v1d::instructions() const {
Common::File f;
if (!f.open("help.dat")) {
warning("help.dat not found");
diff --git a/engines/hugo/file_v1w.cpp b/engines/hugo/file_v1w.cpp
index 38235189e0..04a317e93a 100644
--- a/engines/hugo/file_v1w.cpp
+++ b/engines/hugo/file_v1w.cpp
@@ -46,7 +46,7 @@ FileManager_v1w::~FileManager_v1w() {
/**
* Open and read in an overlay file, close file
*/
-void FileManager_v1w::readOverlay(int screenNum, image_pt image, ovl_t overlayType) {
+void FileManager_v1w::readOverlay(const int screenNum, image_pt image, ovl_t overlayType) {
debugC(1, kDebugFile, "readOverlay(%d, ...)", screenNum);
image_pt tmpImage = image; // temp ptr to overlay file
diff --git a/engines/hugo/file_v2d.cpp b/engines/hugo/file_v2d.cpp
index ceff07286b..06e4c71c28 100644
--- a/engines/hugo/file_v2d.cpp
+++ b/engines/hugo/file_v2d.cpp
@@ -74,7 +74,7 @@ void FileManager_v2d::closeDatabaseFiles() {
/**
* Read a PCX image into dib_a
*/
-void FileManager_v2d::readBackground(int screenIndex) {
+void FileManager_v2d::readBackground(const int screenIndex) {
debugC(1, kDebugFile, "readBackground(%d)", screenIndex);
_sceneryArchive1.seek((uint32) screenIndex * sizeof(sceneBlock_t), SEEK_SET);
@@ -100,7 +100,7 @@ void FileManager_v2d::readBackground(int screenIndex) {
/**
* Open and read in an overlay file, close file
*/
-void FileManager_v2d::readOverlay(int screenNum, image_pt image, ovl_t overlayType) {
+void FileManager_v2d::readOverlay(const int screenNum, image_pt image, ovl_t overlayType) {
debugC(1, kDebugFile, "readOverlay(%d, ...)", screenNum);
image_pt tmpImage = image; // temp ptr to overlay file
@@ -161,7 +161,7 @@ void FileManager_v2d::readOverlay(int screenNum, image_pt image, ovl_t overlayTy
/**
* Fetch string from file, decode and return ptr to string in memory
*/
-char *FileManager_v2d::fetchString(int index) {
+char *FileManager_v2d::fetchString(const int index) {
debugC(1, kDebugFile, "fetchString(%d)", index);
static char buffer[kMaxBoxChar];
diff --git a/engines/hugo/file_v2w.cpp b/engines/hugo/file_v2w.cpp
index 3b632247d2..5691345757 100644
--- a/engines/hugo/file_v2w.cpp
+++ b/engines/hugo/file_v2w.cpp
@@ -47,7 +47,7 @@ FileManager_v2w::~FileManager_v2w() {
* Display a Windows help file
* Same comment than in SCI: maybe in the future we can implement this, but for now this message should suffice
*/
-void FileManager_v2w::instructions() {
+void FileManager_v2w::instructions() const {
Utils::Box(kBoxAny, "Please use an external viewer to open the game's help file: HUGOWIN%d.HLP", _vm->_gameVariant + 1);
}
diff --git a/engines/hugo/file_v3d.cpp b/engines/hugo/file_v3d.cpp
index 26d7b4e4ad..78d9471c57 100644
--- a/engines/hugo/file_v3d.cpp
+++ b/engines/hugo/file_v3d.cpp
@@ -48,7 +48,7 @@ FileManager_v3d::~FileManager_v3d() {
/**
* Read a PCX image into dib_a
*/
-void FileManager_v3d::readBackground(int screenIndex) {
+void FileManager_v3d::readBackground(const int screenIndex) {
debugC(1, kDebugFile, "readBackground(%d)", screenIndex);
_sceneryArchive1.seek((uint32) screenIndex * sizeof(sceneBlock_t), SEEK_SET);
@@ -107,7 +107,7 @@ void FileManager_v3d::closeDatabaseFiles() {
/**
* Open and read in an overlay file, close file
*/
-void FileManager_v3d::readOverlay(int screenNum, image_pt image, ovl_t overlayType) {
+void FileManager_v3d::readOverlay(const int screenNum, image_pt image, ovl_t overlayType) {
debugC(1, kDebugFile, "readOverlay(%d, ...)", screenNum);
image_pt tmpImage = image; // temp ptr to overlay file
diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp
index 4ec6d4b42d..78d7b9a581 100644
--- a/engines/hugo/hugo.cpp
+++ b/engines/hugo/hugo.cpp
@@ -867,7 +867,7 @@ void HugoEngine::shutdown() {
/**
* Read scenery, overlay files for given screen number
*/
-void HugoEngine::readScreenFiles(int screenNum) {
+void HugoEngine::readScreenFiles(const int screenNum) {
debugC(1, kDebugEngine, "readScreenFiles(%d)", screenNum);
_file->readBackground(screenNum); // Scenery file
@@ -886,7 +886,7 @@ void HugoEngine::readScreenFiles(int screenNum) {
* Return maximum allowed movement (from zero to vx) such that object does
* not cross a boundary (either background or another object)
*/
-int HugoEngine::deltaX(int x1, int x2, int vx, int y) {
+int HugoEngine::deltaX(const int x1, const int x2, const int vx, int y) const {
// Explanation of algorithm: The boundaries are drawn as contiguous
// lines 1 pixel wide. Since DX,DY are not necessarily 1, we must
// detect boundary crossing. If vx positive, examine each pixel from
@@ -939,7 +939,7 @@ int HugoEngine::deltaX(int x1, int x2, int vx, int y) {
* bytes at end of line segment; must only count boundary bits falling on
* line segment.
*/
-int HugoEngine::deltaY(int x1, int x2, int vy, int y) {
+int HugoEngine::deltaY(const int x1, const int x2, const int vy, const int y) const {
debugC(3, kDebugEngine, "deltaY(%d, %d, %d, %d)", x1, x2, vy, y);
if (vy == 0)
@@ -966,7 +966,7 @@ int HugoEngine::deltaY(int x1, int x2, int vy, int y) {
/**
* Store a horizontal line segment in the object boundary file
*/
-void HugoEngine::storeBoundary(int x1, int x2, int y) {
+void HugoEngine::storeBoundary(const int x1, const int x2, const int y) {
debugC(5, kDebugEngine, "storeBoundary(%d, %d, %d)", x1, x2, y);
for (int i = x1 >> 3; i <= x2 >> 3; i++) { // For each byte in line
@@ -983,7 +983,7 @@ void HugoEngine::storeBoundary(int x1, int x2, int y) {
/**
* Clear a horizontal line segment in the object boundary file
*/
-void HugoEngine::clearBoundary(int x1, int x2, int y) {
+void HugoEngine::clearBoundary(const int x1, const int x2, const int y) {
debugC(5, kDebugEngine, "clearBoundary(%d, %d, %d)", x1, x2, y);
for (int i = x1 >> 3; i <= x2 >> 3; i++) { // For each byte in line
@@ -1001,7 +1001,7 @@ void HugoEngine::clearBoundary(int x1, int x2, int y) {
* Clear a horizontal line segment in the screen boundary file
* Used to fix some data issues
*/
-void HugoEngine::clearScreenBoundary(int x1, int x2, int y) {
+void HugoEngine::clearScreenBoundary(const int x1, const int x2, const int y) {
debugC(5, kDebugEngine, "clearScreenBoundary(%d, %d, %d)", x1, x2, y);
for (int i = x1 >> 3; i <= x2 >> 3; i++) { // For each byte in line
@@ -1019,7 +1019,7 @@ void HugoEngine::clearScreenBoundary(int x1, int x2, int y) {
* Search background command list for this screen for supplied object.
* Return first associated verb (not "look") or 0 if none found.
*/
-char *HugoEngine::useBG(char *name) {
+char *HugoEngine::useBG(const char *name) {
debugC(1, kDebugEngine, "useBG(%s)", name);
objectList_t p = _backgroundObjects[*_screen_p];
@@ -1036,7 +1036,7 @@ char *HugoEngine::useBG(char *name) {
/**
* Add action lists for this screen to event queue
*/
-void HugoEngine::screenActions(int screenNum) {
+void HugoEngine::screenActions(const int screenNum) {
debugC(1, kDebugEngine, "screenActions(%d)", screenNum);
uint16 *screenAct = _screenActs[screenNum];
@@ -1049,7 +1049,7 @@ void HugoEngine::screenActions(int screenNum) {
/**
* Set the new screen number into the hero object and any carried objects
*/
-void HugoEngine::setNewScreen(int screenNum) {
+void HugoEngine::setNewScreen(const int screenNum) {
debugC(1, kDebugEngine, "setNewScreen(%d)", screenNum);
*_screen_p = screenNum; // HERO object
@@ -1116,15 +1116,15 @@ void HugoEngine::endGame() {
_status.viewState = kViewExit;
}
-bool HugoEngine::canLoadGameStateCurrently() {
+bool HugoEngine::canLoadGameStateCurrently() const {
return true;
}
-bool HugoEngine::canSaveGameStateCurrently() {
+bool HugoEngine::canSaveGameStateCurrently() const {
return (_status.viewState == kViewPlay);
}
-int8 HugoEngine::getTPS() {
+int8 HugoEngine::getTPS() const {
return ((_config.turboFl) ? kTurboTps : _normalTPS);
}
diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h
index 56d8089682..55be443199 100644
--- a/engines/hugo/hugo.h
+++ b/engines/hugo/hugo.h
@@ -318,29 +318,29 @@ public:
return *s_Engine;
}
- bool canLoadGameStateCurrently();
- bool canSaveGameStateCurrently();
+ bool canLoadGameStateCurrently() const;
+ bool canSaveGameStateCurrently() const;
bool loadHugoDat();
- char *useBG(char *name);
+ char *useBG(const char *name);
- int deltaX(int x1, int x2, int vx, int y);
- int deltaY(int x1, int x2, int vy, int y);
+ int deltaX(const int x1, const int x2, const int vx, int y) const;
+ int deltaY(const int x1, const int x2, const int vy, const int y) const;
- int8 getTPS();
+ int8 getTPS() const;
void initGame(const HugoGameDescription *gd);
void initGamePart(const HugoGameDescription *gd);
void boundaryCollision(object_t *obj);
- void clearBoundary(int x1, int x2, int y);
- void clearScreenBoundary(int x1, int x2, int y);
+ void clearBoundary(const int x1, const int x2, const int y);
+ void clearScreenBoundary(const int x1, const int x2, const int y);
void endGame();
void initStatus();
- void readScreenFiles(int screen);
- void screenActions(int screen);
- void setNewScreen(int screen);
+ void readScreenFiles(const int screen);
+ void screenActions(const int screen);
+ void setNewScreen(const int screen);
void shutdown();
- void storeBoundary(int x1, int x2, int y);
+ void storeBoundary(const int x1, const int x2, const int y);
void syncSoundSettings();
int getMouseX() const {
@@ -368,16 +368,16 @@ public:
int getScore() const {
return _score;
}
- void setScore(int newScore) {
+ void setScore(const int newScore) {
_score = newScore;
}
- void adjustScore(int adjustment) {
+ void adjustScore(const int adjustment) {
_score += adjustment;
}
int getMaxScore() const {
return _maxscore;
}
- void setMaxScore(int newScore) {
+ void setMaxScore(const int newScore) {
_maxscore = newScore;
}
byte getIntroSize() {
@@ -395,7 +395,7 @@ public:
return (f == kSupportsRTL) || (f == kSupportsLoadingDuringRuntime) || (f == kSupportsSavingDuringRuntime);
}
- const char *getCopyrightString() { return "Copyright 1989-1997 David P Gray, All Rights Reserved."; }
+ const char *getCopyrightString() const { return "Copyright 1989-1997 David P Gray, All Rights Reserved."; }
FileManager *_file;
diff --git a/engines/hugo/inventory.cpp b/engines/hugo/inventory.cpp
index 5d45a3bd35..4d9da085ac 100644
--- a/engines/hugo/inventory.cpp
+++ b/engines/hugo/inventory.cpp
@@ -56,7 +56,7 @@ InventoryHandler::InventoryHandler(HugoEngine *vm) : _vm(vm) {
* scrollFl is TRUE if scroll arrows required
* firstObjId is index of first (scrolled) inventory object to display
*/
-void InventoryHandler::constructInventory(int16 imageTotNumb, int displayNumb, bool scrollFl, int16 firstObjId) {
+void InventoryHandler::constructInventory(const int16 imageTotNumb, int displayNumb, const bool scrollFl, int16 firstObjId) {
debugC(1, kDebugInventory, "constructInventory(%d, %d, %d, %d)", imageTotNumb, displayNumb, (scrollFl) ? 0 : 1, firstObjId);
// Clear out icon buffer
@@ -97,7 +97,7 @@ void InventoryHandler::constructInventory(int16 imageTotNumb, int displayNumb, b
* Process required action for inventory
* Returns objId under cursor (or -1) for INV_GET
*/
-int16 InventoryHandler::processInventory(invact_t action, ...) {
+int16 InventoryHandler::processInventory(const invact_t action, ...) {
debugC(1, kDebugInventory, "processInventory(invact_t action, ...)");
static int16 firstIconId = 0; // Index of first icon to display
diff --git a/engines/hugo/inventory.h b/engines/hugo/inventory.h
index f786897ba1..04dbe4b1ea 100644
--- a/engines/hugo/inventory.h
+++ b/engines/hugo/inventory.h
@@ -43,7 +43,7 @@ class InventoryHandler {
public:
InventoryHandler(HugoEngine *vm);
- int16 processInventory(invact_t action, ...);
+ int16 processInventory(const invact_t action, ...);
void runInventory();
private:
@@ -51,7 +51,7 @@ private:
static const int kStepDy = 8; // Pixels per step movement
- void constructInventory(int16 imageTotNumb, int displayNumb, bool scrollFl, int16 firstObjId);
+ void constructInventory(const int16 imageTotNumb, int displayNumb, const bool scrollFl, int16 firstObjId);
};
} // End of namespace Hugo
diff --git a/engines/hugo/mouse.cpp b/engines/hugo/mouse.cpp
index 63e56ea210..e72e98c997 100644
--- a/engines/hugo/mouse.cpp
+++ b/engines/hugo/mouse.cpp
@@ -53,7 +53,7 @@ MouseHandler::MouseHandler(HugoEngine *vm) : _vm(vm) {
/**
* Shadow-blit supplied string into dib_a at cx,cy and add to display list
*/
-void MouseHandler::cursorText(char *buffer, int16 cx, int16 cy, uif_t fontId, int16 color) {
+void MouseHandler::cursorText(const char *buffer, const int16 cx, const int16 cy, const uif_t fontId, const int16 color) {
debugC(1, kDebugMouse, "cursorText(%s, %d, %d, %d, %d)", buffer, cx, cy, fontId, color);
_vm->_screen->loadFont(fontId);
@@ -79,7 +79,7 @@ void MouseHandler::cursorText(char *buffer, int16 cx, int16 cy, uif_t fontId, in
* Find the exit hotspot containing cx, cy.
* Return hotspot index or -1 if not found.
*/
-int16 MouseHandler::findExit(int16 cx, int16 cy) {
+int16 MouseHandler::findExit(const int16 cx, const int16 cy) {
debugC(2, kDebugMouse, "findExit(%d, %d)", cx, cy);
int i = 0;
@@ -95,7 +95,7 @@ int16 MouseHandler::findExit(int16 cx, int16 cy) {
/**
* Process a mouse right click at coord cx, cy over object objid
*/
-void MouseHandler::processRightClick(int16 objId, int16 cx, int16 cy) {
+void MouseHandler::processRightClick(const int16 objId, const int16 cx, const int16 cy) {
debugC(1, kDebugMouse, "ProcessRightClick(%d, %d, %d)", objId, cx, cy);
status_t &gameStatus = _vm->getGameStatus();
@@ -144,7 +144,7 @@ void MouseHandler::processRightClick(int16 objId, int16 cx, int16 cy) {
* 4. Nothing - attempt to walk there
* 5. Exit - walk to exit hotspot
*/
-void MouseHandler::processLeftClick(int16 objId, int16 cx, int16 cy) {
+void MouseHandler::processLeftClick(const int16 objId, const int16 cx, const int16 cy) {
debugC(1, kDebugMouse, "ProcessLeftClick(%d, %d, %d)", objId, cx, cy);
int16 i, x, y;
diff --git a/engines/hugo/mouse.h b/engines/hugo/mouse.h
index bdb70f7d4c..0b796efb22 100644
--- a/engines/hugo/mouse.h
+++ b/engines/hugo/mouse.h
@@ -55,10 +55,10 @@ private:
kMsExit = 1
};
- void cursorText(char *buffer, int16 cx, int16 cy, uif_t fontId, int16 color);
- int16 findExit(int16 cx, int16 cy);
- void processRightClick(int16 objId, int16 cx, int16 cy);
- void processLeftClick(int16 objId, int16 cx, int16 cy);
+ void cursorText(const char *buffer, const int16 cx, const int16 cy, const uif_t fontId, const int16 color);
+ int16 findExit(const int16 cx, const int16 cy);
+ void processRightClick(const int16 objId, const int16 cx, const int16 cy);
+ void processLeftClick(const int16 objId, const int16 cx, const int16 cy);
};
} // End of namespace Hugo
diff --git a/engines/hugo/object.h b/engines/hugo/object.h
index 3a7dd47042..736be20ef1 100644
--- a/engines/hugo/object.h
+++ b/engines/hugo/object.h
@@ -45,7 +45,7 @@ public:
object_t *_objects;
uint16 _numObj;
- virtual void homeIn(int objIndex1, int objIndex2, int8 objDx, int8 objDy) = 0;
+ virtual void homeIn(const int objIndex1, const int objIndex2, const int8 objDx, const int8 objDy) = 0;
virtual void moveObjects() = 0;
virtual void updateImages() = 0;
virtual void swapImages(int objIndex1, int objIndex2) = 0;
@@ -110,7 +110,7 @@ public:
ObjectHandler_v1d(HugoEngine *vm);
virtual ~ObjectHandler_v1d();
- virtual void homeIn(int objIndex1, int objIndex2, int8 objDx, int8 objDy);
+ virtual void homeIn(const int objIndex1, const int objIndex2, const int8 objDx, const int8 objDy);
virtual void moveObjects();
virtual void updateImages();
virtual void swapImages(int objIndex1, int objIndex2);
@@ -124,7 +124,7 @@ public:
virtual void moveObjects();
virtual void updateImages();
- void homeIn(int objIndex1, int objIndex2, int8 objDx, int8 objDy);
+ void homeIn(const int objIndex1, const int objIndex2, const int8 objDx, const int8 objDy);
};
class ObjectHandler_v3d : public ObjectHandler_v2d {
diff --git a/engines/hugo/object_v1d.cpp b/engines/hugo/object_v1d.cpp
index 80220314e0..17468565a4 100644
--- a/engines/hugo/object_v1d.cpp
+++ b/engines/hugo/object_v1d.cpp
@@ -366,7 +366,7 @@ void ObjectHandler_v1d::swapImages(int objIndex1, int objIndex2) {
_vm->_heroImage = (_vm->_heroImage == kHeroIndex) ? objIndex2 : kHeroIndex;
}
-void ObjectHandler_v1d::homeIn(int objIndex1, int objIndex2, int8 objDx, int8 objDy) {
+void ObjectHandler_v1d::homeIn(int objIndex1, const int objIndex2, const int8 objDx, const int8 objDy) {
// object obj1 will home in on object obj2
object_t *obj1 = &_objects[objIndex1];
object_t *obj2 = &_objects[objIndex2];
diff --git a/engines/hugo/object_v2d.cpp b/engines/hugo/object_v2d.cpp
index 628594138d..29a5956f3f 100644
--- a/engines/hugo/object_v2d.cpp
+++ b/engines/hugo/object_v2d.cpp
@@ -360,7 +360,7 @@ void ObjectHandler_v2d::moveObjects() {
}
}
-void ObjectHandler_v2d::homeIn(int objIndex1, int objIndex2, int8 objDx, int8 objDy) {
+void ObjectHandler_v2d::homeIn(const int objIndex1, const int objIndex2, const int8 objDx, const int8 objDy) {
// object obj1 will home in on object obj2
object_t *obj1 = &_objects[objIndex1];
object_t *obj2 = &_objects[objIndex2];
diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp
index d3d8815c04..6988434285 100644
--- a/engines/hugo/parser.cpp
+++ b/engines/hugo/parser.cpp
@@ -267,7 +267,7 @@ void Parser::command(const char *format, ...) {
/**
* Locate any member of object name list appearing in command line
*/
-bool Parser::isWordPresent(char **wordArr) {
+bool Parser::isWordPresent(char **wordArr) const {
debugC(1, kDebugParser, "isWordPresent(%s)", wordArr[0]);
if (wordArr != 0) {
@@ -282,7 +282,7 @@ bool Parser::isWordPresent(char **wordArr) {
/**
* Locate word in list of nouns and return ptr to first string in noun list
*/
-char *Parser::findNoun() {
+char *Parser::findNoun() const {
debugC(1, kDebugParser, "findNoun()");
for (int i = 0; _vm->_text->getNounArray(i); i++) {
@@ -297,7 +297,7 @@ char *Parser::findNoun() {
/**
* Locate word in list of verbs and return ptr to first string in verb list
*/
-char *Parser::findVerb() {
+char *Parser::findVerb() const {
debugC(1, kDebugParser, "findVerb()");
for (int i = 0; _vm->_text->getVerbArray(i); i++) {
@@ -312,7 +312,7 @@ char *Parser::findVerb() {
/**
* Show user all objects being carried in a variable width 2 column format
*/
-void Parser::showDosInventory() {
+void Parser::showDosInventory() const {
debugC(1, kDebugParser, "showDosInventory()");
static const char *blanks = " ";
uint16 index = 0, len1 = 0, len2 = 0;
diff --git a/engines/hugo/parser.h b/engines/hugo/parser.h
index 31572344a6..3e4eedbdf3 100644
--- a/engines/hugo/parser.h
+++ b/engines/hugo/parser.h
@@ -47,7 +47,7 @@ public:
Parser(HugoEngine *vm);
virtual ~Parser();
- bool isWordPresent(char **wordArr);
+ bool isWordPresent(char **wordArr) const;
void charHandler();
void command(const char *format, ...);
@@ -55,14 +55,14 @@ public:
void switchTurbo();
virtual void lineHandler() = 0;
- virtual void showInventory() = 0;
+ virtual void showInventory() const = 0;
protected:
HugoEngine *_vm;
- char *findNoun();
- char *findVerb();
- void showDosInventory();
+ char *findNoun() const;
+ char *findVerb() const;
+ void showDosInventory() const;
bool _checkDoubleF1Fl; // Flag used to display user help or instructions
uint16 _getIndex; // Index into ring buffer
@@ -79,18 +79,18 @@ public:
~Parser_v1d();
virtual void lineHandler();
- virtual void showInventory();
+ virtual void showInventory() const;
protected:
virtual void dropObject(object_t *obj);
- virtual bool isBackgroundWord(char *noun, char *verb, objectList_t obj);
- virtual bool isCatchallVerb(bool testNounFl, char *noun, char *verb, objectList_t obj);
+ virtual bool isBackgroundWord(char *noun, char *verb, objectList_t obj) const;
+ virtual bool isCatchallVerb(bool testNounFl, char *noun, char *verb, objectList_t obj) const;
virtual bool isGenericVerb(char *word, object_t *obj);
- virtual bool isNear(char *verb, char *noun, object_t *obj, char *comment);
+ virtual bool isNear(char *verb, char *noun, object_t *obj, char *comment) const;
virtual bool isObjectVerb(char *word, object_t *obj);
virtual void takeObject(object_t *obj);
- char *findNextNoun(char *noun);
+ char *findNextNoun(char *noun) const;
};
class Parser_v2d : public Parser_v1d {
@@ -109,10 +109,10 @@ public:
virtual void lineHandler();
protected:
void dropObject(object_t *obj);
- bool isBackgroundWord(objectList_t obj);
- bool isCatchallVerb(objectList_t obj);
+ bool isBackgroundWord(objectList_t obj) const;
+ bool isCatchallVerb(objectList_t obj) const;
bool isGenericVerb(object_t *obj, char *comment);
- bool isNear(object_t *obj, char *verb, char *comment);
+ bool isNear(object_t *obj, char *verb, char *comment) const;
bool isObjectVerb(object_t *obj, char *comment);
void takeObject(object_t *obj);
};
@@ -122,7 +122,7 @@ public:
Parser_v1w(HugoEngine *vm);
~Parser_v1w();
- virtual void showInventory();
+ virtual void showInventory() const;
void lineHandler();
};
diff --git a/engines/hugo/parser_v1d.cpp b/engines/hugo/parser_v1d.cpp
index 4fff3fa4d4..f82623d9f6 100644
--- a/engines/hugo/parser_v1d.cpp
+++ b/engines/hugo/parser_v1d.cpp
@@ -55,7 +55,7 @@ Parser_v1d::~Parser_v1d() {
* Locate word in list of nouns and return ptr to string in noun list
* If n is NULL, start at beginning of list, else with n
*/
-char *Parser_v1d::findNextNoun(char *noun) {
+char *Parser_v1d::findNextNoun(char *noun) const {
debugC(1, kDebugParser, "findNextNoun(%s)", noun);
int currNounIndex = -1;
@@ -80,7 +80,7 @@ char *Parser_v1d::findNextNoun(char *noun) {
* If object not near, return suitable string; may be similar object closer
* If radius is -1, treat radius as infinity
*/
-bool Parser_v1d::isNear(char *verb, char *noun, object_t *obj, char *comment) {
+bool Parser_v1d::isNear(char *verb, char *noun, object_t *obj, char *comment) const {
debugC(1, kDebugParser, "isNear(%s, %s, obj, %s)", verb, noun, comment);
if (!noun && !obj->verbOnlyFl) { // No noun specified & object not context senesitive
@@ -233,7 +233,7 @@ bool Parser_v1d::isObjectVerb(char *word, object_t *obj) {
* Print text for possible background object. Return TRUE if match found
* Only match if both verb and noun found. Test_ca will match verb-only
*/
-bool Parser_v1d::isBackgroundWord(char *noun, char *verb, objectList_t obj) {
+bool Parser_v1d::isBackgroundWord(char *noun, char *verb, objectList_t obj) const {
debugC(1, kDebugParser, "isBackgroundWord(%s, %s, object_list_t obj)", noun, verb);
if (!noun)
@@ -283,7 +283,7 @@ void Parser_v1d::dropObject(object_t *obj) {
* Print text for possible background object. Return TRUE if match found
* If test_noun TRUE, must have a noun given
*/
-bool Parser_v1d::isCatchallVerb(bool testNounFl, char *noun, char *verb, objectList_t obj) {
+bool Parser_v1d::isCatchallVerb(bool testNounFl, char *noun, char *verb, objectList_t obj) const {
debugC(1, kDebugParser, "isCatchallVerb(%d, %s, %s, object_list_t obj)", (testNounFl) ? 1 : 0, noun, verb);
if (_maze.enabledFl)
@@ -426,7 +426,7 @@ void Parser_v1d::lineHandler() {
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBEh_1d));
}
-void Parser_v1d::showInventory() {
+void Parser_v1d::showInventory() const {
status_t &gameStatus = _vm->getGameStatus();
if (gameStatus.viewState == kViewPlay) {
if (gameStatus.gameOverFl)
diff --git a/engines/hugo/parser_v1w.cpp b/engines/hugo/parser_v1w.cpp
index 709c08039a..e483780867 100644
--- a/engines/hugo/parser_v1w.cpp
+++ b/engines/hugo/parser_v1w.cpp
@@ -204,7 +204,7 @@ void Parser_v1w::lineHandler() {
}
}
-void Parser_v1w::showInventory() {
+void Parser_v1w::showInventory() const {
status_t &gameStatus = _vm->getGameStatus();
if (gameStatus.gameOverFl) {
Utils::gameOverMsg();
diff --git a/engines/hugo/parser_v3d.cpp b/engines/hugo/parser_v3d.cpp
index f44bc01a15..abd03038f7 100644
--- a/engines/hugo/parser_v3d.cpp
+++ b/engines/hugo/parser_v3d.cpp
@@ -319,7 +319,7 @@ bool Parser_v3d::isGenericVerb(object_t *obj, char *comment) {
* If radius is -1, treat radius as infinity
* Verb is included to determine correct comment if not near
*/
-bool Parser_v3d::isNear(object_t *obj, char *verb, char *comment) {
+bool Parser_v3d::isNear(object_t *obj, char *verb, char *comment) const {
debugC(1, kDebugParser, "isNear(object_t *obj, %s, %s)", verb, comment);
if (obj->carriedFl) // Object is being carried
@@ -413,7 +413,7 @@ void Parser_v3d::dropObject(object_t *obj) {
* Note that if the background command list has match set TRUE then do not
* print text if there are any recognizable nouns in the command line
*/
-bool Parser_v3d::isCatchallVerb(objectList_t obj) {
+bool Parser_v3d::isCatchallVerb(objectList_t obj) const {
debugC(1, kDebugParser, "isCatchallVerb(object_list_t obj)");
if (_maze.enabledFl)
@@ -441,7 +441,7 @@ bool Parser_v3d::isCatchallVerb(objectList_t obj) {
* Search for matching verb/noun pairs in background command list
* Print text for possible background object. Return TRUE if match found
*/
-bool Parser_v3d::isBackgroundWord(objectList_t obj) {
+bool Parser_v3d::isBackgroundWord(objectList_t obj) const {
debugC(1, kDebugParser, "isBackgroundWord(object_list_t obj)");
if (_maze.enabledFl)
diff --git a/engines/hugo/route.cpp b/engines/hugo/route.cpp
index 206bd9c47b..2d4da033d2 100644
--- a/engines/hugo/route.cpp
+++ b/engines/hugo/route.cpp
@@ -46,7 +46,7 @@ Route::Route(HugoEngine *vm) : _vm(vm) {
/**
* Face hero in new direction, based on cursor key input by user.
*/
-void Route::setDirection(uint16 keyCode) {
+void Route::setDirection(const uint16 keyCode) {
debugC(1, kDebugRoute, "setDirection(%d)", keyCode);
object_t *obj = _vm->_hero; // Pointer to hero object
@@ -92,7 +92,7 @@ void Route::setDirection(uint16 keyCode) {
* Set hero walking, based on cursor key input by user.
* Hitting same key twice will stop hero.
*/
-void Route::setWalk(uint16 direction) {
+void Route::setWalk(const uint16 direction) {
debugC(1, kDebugRoute, "setWalk(%d)", direction);
static uint16 oldDirection = 0; // Last direction char
@@ -304,7 +304,7 @@ Point *Route::newNode() {
* 2. Construct list of segments segment[] from hero to destination
* 3. Compress to shortest route in route[]
*/
-bool Route::findRoute(int16 cx, int16 cy) {
+bool Route::findRoute(const int16 cx, const int16 cy) {
debugC(1, kDebugRoute, "findRoute(%d, %d)", cx, cy);
// Initialize for search
@@ -486,7 +486,7 @@ void Route::processRoute() {
* go_for is the purpose, id indexes the exit or object to walk to
* Returns FALSE if route not found
*/
-bool Route::startRoute(go_t go_for, int16 id, int16 cx, int16 cy) {
+bool Route::startRoute(const go_t go_for, const int16 id, int16 cx, int16 cy) {
debugC(1, kDebugRoute, "startRoute(%d, %d, %d, %d)", go_for, id, cx, cy);
// Don't attempt to walk if user does not have control
diff --git a/engines/hugo/route.h b/engines/hugo/route.h
index d09d19d3dd..e5ee72bc5d 100644
--- a/engines/hugo/route.h
+++ b/engines/hugo/route.h
@@ -50,9 +50,9 @@ public:
Route(HugoEngine *vm);
void processRoute();
- bool startRoute(go_t go_for, int16 id, int16 cx, int16 cy);
- void setDirection(uint16 keyCode);
- void setWalk(uint16 direction);
+ bool startRoute(const go_t go_for, const int16 id, int16 cx, int16 cy);
+ void setDirection(const uint16 keyCode);
+ void setWalk(const uint16 direction);
private:
HugoEngine *_vm;
@@ -75,7 +75,7 @@ private:
bool _fullSegmentFl; // Segments exhausted
void segment(int16 x, int16 y);
- bool findRoute(int16 cx, int16 cy);
+ bool findRoute(const int16 cx, const int16 cy);
Point *newNode();
};
diff --git a/engines/hugo/schedule.cpp b/engines/hugo/schedule.cpp
index 832297e7e5..d255bf93b5 100644
--- a/engines/hugo/schedule.cpp
+++ b/engines/hugo/schedule.cpp
@@ -90,7 +90,7 @@ event_t *Scheduler::getQueue() {
/**
* Call Insert_action for each action in the list supplied
*/
-void Scheduler::insertActionList(uint16 actIndex) {
+void Scheduler::insertActionList(const uint16 actIndex) {
debugC(1, kDebugSchedule, "insertActionList(%d)", actIndex);
if (_actListArr[actIndex]) {
@@ -102,7 +102,7 @@ void Scheduler::insertActionList(uint16 actIndex) {
/**
* Return system time in ticks. A tick is 1/TICKS_PER_SEC mS
*/
-uint32 Scheduler::getWinTicks() {
+uint32 Scheduler::getWinTicks() const {
debugC(5, kDebugSchedule, "getWinTicks()");
return _vm->getGameStatus().tick;
@@ -114,7 +114,7 @@ uint32 Scheduler::getWinTicks() {
* Note that this is real time unless a processing cycle takes longer than
* a real tick, in which case the system tick is simply incremented
*/
-uint32 Scheduler::getDosTicks(bool updateFl) {
+uint32 Scheduler::getDosTicks(const bool updateFl) {
debugC(5, kDebugSchedule, "getDosTicks(%s)", (updateFl) ? "TRUE" : "FALSE");
static uint32 tick = 0; // Current system time in ticks
@@ -140,7 +140,7 @@ uint32 Scheduler::getDosTicks(bool updateFl) {
/**
* Add indecated bonus to score if not added already
*/
-void Scheduler::processBonus(int bonusIndex) {
+void Scheduler::processBonus(const int bonusIndex) {
debugC(1, kDebugSchedule, "processBonus(%d)", bonusIndex);
if (!_vm->_points[bonusIndex].scoredFl) {
@@ -157,7 +157,7 @@ void Scheduler::processBonus(int bonusIndex) {
* 4. Schedule action list for new screen
* 5. Initialise prompt line and status line
*/
-void Scheduler::newScreen(int screenIndex) {
+void Scheduler::newScreen(const int screenIndex) {
debugC(1, kDebugSchedule, "newScreen(%d)", screenIndex);
// Make sure the background file exists!
@@ -199,7 +199,7 @@ void Scheduler::newScreen(int screenIndex) {
* 2. Read in the screen files for the new screen
* 3. Initialise prompt line and status line
*/
-void Scheduler::restoreScreen(int screenIndex) {
+void Scheduler::restoreScreen(const int screenIndex) {
debugC(1, kDebugSchedule, "restoreScreen(%d)", screenIndex);
// 1. Set the new screen in the hero object and any being carried
@@ -218,7 +218,7 @@ void Scheduler::restoreScreen(int screenIndex) {
* at their own speed, not waiting here, but free running.
* Note: DOS Versions only
*/
-void Scheduler::waitForRefresh(void) {
+void Scheduler::waitForRefresh() {
debugC(5, kDebugSchedule, "waitForRefresh()");
static uint32 timeout = 0;
@@ -837,7 +837,7 @@ void Scheduler::freeActListArr() {
* Maze mode is enabled. Check to see whether hero has crossed the maze
* bounding box, if so, go to the next room
*/
-void Scheduler::processMaze(int x1, int x2, int y1, int y2) {
+void Scheduler::processMaze(const int x1, const int x2, const int y1, const int y2) {
debugC(1, kDebugSchedule, "processMaze");
status_t &gameStatus = _vm->getGameStatus();
@@ -943,7 +943,7 @@ void Scheduler::restoreActions(Common::SeekableReadStream *f) {
* Save the action data in the file with handle f
*/
-void Scheduler::saveActions(Common::WriteStream* f) {
+void Scheduler::saveActions(Common::WriteStream* f) const {
for (int i = 0; i < _actListArrSize; i++) {
// write all the sub elems data
@@ -1362,7 +1362,7 @@ void Scheduler::delQueue(event_t *curEvent) {
_freeEvent = curEvent;
}
-void Scheduler::delEventType(action_t actTypeDel) {
+void Scheduler::delEventType(const action_t actTypeDel) {
// Note: actions are not deleted here, simply turned into NOPs!
event_t *wrkEvent = _headEvent; // The earliest event
event_t *saveEvent;
@@ -1381,7 +1381,7 @@ Scheduler_v1d::Scheduler_v1d(HugoEngine *vm) : Scheduler(vm) {
Scheduler_v1d::~Scheduler_v1d() {
}
-const char *Scheduler_v1d::getCypher() {
+const char *Scheduler_v1d::getCypher() const {
return "Copyright (c) 1990, Gray Design Associates";
}
@@ -1450,7 +1450,7 @@ Scheduler_v2d::Scheduler_v2d(HugoEngine *vm) : Scheduler_v1d(vm) {
Scheduler_v2d::~Scheduler_v2d() {
}
-const char *Scheduler_v2d::getCypher() {
+const char *Scheduler_v2d::getCypher() const {
return "Copyright 1991, Gray Design Associates";
}
@@ -1500,7 +1500,7 @@ Scheduler_v3d::Scheduler_v3d(HugoEngine *vm) : Scheduler_v2d(vm) {
Scheduler_v3d::~Scheduler_v3d() {
}
-const char *Scheduler_v3d::getCypher() {
+const char *Scheduler_v3d::getCypher() const {
return "Copyright 1992, Gray Design Associates";
}
diff --git a/engines/hugo/schedule.h b/engines/hugo/schedule.h
index 5e36a7db01..7b3c515117 100644
--- a/engines/hugo/schedule.h
+++ b/engines/hugo/schedule.h
@@ -460,19 +460,19 @@ public:
void freeActListArr();
void initEventQueue();
- void insertActionList(uint16 actIndex);
+ void insertActionList(const uint16 actIndex);
void loadActListArr(Common::File &in);
void loadAlNewscrIndex(Common::File &in);
- void newScreen(int screenIndex);
- void processBonus(int bonusIndex);
- void processMaze(int x1, int x2, int y1, int y2);
- void restoreScreen(int screenIndex);
+ void newScreen(const int screenIndex);
+ void processBonus(const int bonusIndex);
+ void processMaze(const int x1, const int x2, const int y1, const int y2);
+ void restoreScreen(const int screenIndex);
void restoreEvents(Common::SeekableReadStream *f);
void saveEvents(Common::WriteStream *f);
- void waitForRefresh(void);
+ void waitForRefresh();
void findAction(act* action, int16* index, int16* subElem);
- void saveActions(Common::WriteStream* f);
+ void saveActions(Common::WriteStream* f) const;
void restoreActions(Common::SeekableReadStream *f);
protected:
@@ -491,7 +491,7 @@ protected:
act **_actListArr;
- virtual const char *getCypher() = 0;
+ virtual const char *getCypher() const = 0;
virtual uint32 getTicks() = 0;
@@ -500,10 +500,10 @@ protected:
event_t *doAction(event_t *curEvent);
event_t *getQueue();
- uint32 getDosTicks(bool updateFl);
- uint32 getWinTicks();
+ uint32 getDosTicks(const bool updateFl);
+ uint32 getWinTicks() const;
- void delEventType(action_t actTypeDel);
+ void delEventType(const action_t actTypeDel);
void delQueue(event_t *curEvent);
void insertAction(act *action);
};
@@ -517,7 +517,7 @@ public:
virtual void runScheduler();
protected:
- virtual const char *getCypher();
+ virtual const char *getCypher() const;
virtual uint32 getTicks();
@@ -532,7 +532,7 @@ public:
void decodeString(char *line);
protected:
- virtual const char *getCypher();
+ virtual const char *getCypher() const;
void promptAction(act *action);
};
@@ -543,7 +543,7 @@ public:
~Scheduler_v3d();
protected:
- const char *getCypher();
+ const char *getCypher() const;
};
class Scheduler_v1w : public Scheduler_v3d {
diff --git a/engines/hugo/sound.cpp b/engines/hugo/sound.cpp
index 99a10dd9fe..a1b47a1dbb 100644
--- a/engines/hugo/sound.cpp
+++ b/engines/hugo/sound.cpp
@@ -305,7 +305,7 @@ void SoundHandler::playMusic(int16 tune) {
* Produce various sound effects on supplied stereo channel(s)
* Override currently playing sound only if lower or same priority
*/
-void SoundHandler::playSound(int16 sound, byte priority) {
+void SoundHandler::playSound(int16 sound, const byte priority) {
// uint32 dwVolume; // Left, right volume of sound
sound_pt sound_p; // Sound data
uint16 size; // Size of data
@@ -316,14 +316,6 @@ void SoundHandler::playSound(int16 sound, byte priority) {
return;
syncVolume();
-
- //
- // See if last wave still playing - if so, check priority
- // if (waveOutUnprepareHeader(hwav, lphdr, sizeof(WAVEHDR)) == WAVERR_STILLPLAYING)
- // if (priority < curPriority) // Don't override unless priority >= current
- // return;
- // else
- // Stop_sound();
curPriority = priority;
// Get sound data
diff --git a/engines/hugo/sound.h b/engines/hugo/sound.h
index 52e93d65de..4d97fe4e99 100644
--- a/engines/hugo/sound.h
+++ b/engines/hugo/sound.h
@@ -47,7 +47,7 @@ public:
bool isPlaying() { return _isPlaying; }
- int getVolume() const { return _masterVolume; }
+ int getVolume() { return _masterVolume; }
void adjustVolume(int diff);
void pause(bool p);
@@ -105,7 +105,7 @@ public:
static void loopPlayer(void *refCon);
void pcspkr_player();
void playMusic(int16 tune);
- void playSound(int16 sound, byte priority);
+ void playSound(int16 sound, const byte priority);
void initSound();
void syncVolume();
void checkMusic();