From 15046a7529e3c755de1f00b4a2666786eb2bd4f8 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 10 Jun 2012 04:14:17 +0200 Subject: GUI: Get rid of SaveLoadChooser::setSaveMode. We already pass the title and process button name to the constructor of SaveLoadChooser and then do not offer any way of changing it, thus changing the edit mode of the chooser is kind of pointless and was never actually used. Instead we pass the mode on SaveLoadChooser construction now. --- engines/hugo/file.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'engines/hugo') diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp index 2217cef92a..3c94b2ee3d 100644 --- a/engines/hugo/file.cpp +++ b/engines/hugo/file.cpp @@ -336,8 +336,7 @@ bool FileManager::saveGame(const int16 slot, const Common::String &descrip) { EngineMan.findGame(_vm->getGameId(), &plugin); if (slot == -1) { - GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Save game:", "Save"); - dialog->setSaveMode(true); + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Save game:", "Save", true); savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); savegameDescription = dialog->getResultString(); delete dialog; @@ -441,8 +440,7 @@ bool FileManager::restoreGame(const int16 slot) { EngineMan.findGame(_vm->getGameId(), &plugin); if (slot == -1) { - GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Restore game:", "Restore"); - dialog->setSaveMode(false); + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Restore game:", "Restore", false); savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); delete dialog; } else { -- cgit v1.2.3 From 7c5cf1b400808865a5f601f70d624ad6704a0c8c Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 10 Jun 2012 04:49:42 +0200 Subject: GUI: Add helper to SaveLoadChooser, which uses the currently active target. This reduces the code duplication in all client code, which formerly duplicated the querying of the plugin, game id etc. and now simply calls the newly added method runModalWithCurrentTarget() on a SaveLoadChooser object. --- engines/hugo/file.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'engines/hugo') diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp index 3c94b2ee3d..f94f3b0443 100644 --- a/engines/hugo/file.cpp +++ b/engines/hugo/file.cpp @@ -330,14 +330,12 @@ sound_pt FileManager::getSound(const int16 sound, uint16 *size) { bool FileManager::saveGame(const int16 slot, const Common::String &descrip) { debugC(1, kDebugFile, "saveGame(%d, %s)", slot, descrip.c_str()); - const EnginePlugin *plugin = NULL; int16 savegameId; Common::String savegameDescription; - EngineMan.findGame(_vm->getGameId(), &plugin); if (slot == -1) { GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Save game:", "Save", true); - savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); + savegameId = dialog->runModalWithCurrentTarget(); savegameDescription = dialog->getResultString(); delete dialog; } else { @@ -435,13 +433,11 @@ bool FileManager::saveGame(const int16 slot, const Common::String &descrip) { bool FileManager::restoreGame(const int16 slot) { debugC(1, kDebugFile, "restoreGame(%d)", slot); - const EnginePlugin *plugin = NULL; int16 savegameId; - EngineMan.findGame(_vm->getGameId(), &plugin); if (slot == -1) { GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Restore game:", "Restore", false); - savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); + savegameId = dialog->runModalWithCurrentTarget(); delete dialog; } else { savegameId = slot; -- cgit v1.2.3 From 2e7b16a8bdb6ad1cf51046d57eb0f5406ee2cc13 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 13 Jun 2012 11:28:25 +0200 Subject: HUGO: Apply coding convention (in progress) --- engines/hugo/console.cpp | 10 +- engines/hugo/dialogs.cpp | 82 +++++----- engines/hugo/dialogs.h | 4 +- engines/hugo/display.cpp | 36 ++--- engines/hugo/file.cpp | 168 +++++++++---------- engines/hugo/game.h | 100 ++++++------ engines/hugo/hugo.cpp | 82 +++++----- engines/hugo/hugo.h | 26 +-- engines/hugo/intro.cpp | 32 ++-- engines/hugo/inventory.cpp | 2 +- engines/hugo/mouse.cpp | 28 ++-- engines/hugo/object.cpp | 386 ++++++++++++++++++++++---------------------- engines/hugo/object.h | 10 +- engines/hugo/object_v1d.cpp | 254 ++++++++++++++--------------- engines/hugo/object_v1w.cpp | 244 ++++++++++++++-------------- engines/hugo/object_v2d.cpp | 248 ++++++++++++++-------------- engines/hugo/object_v3d.cpp | 164 +++++++++---------- engines/hugo/parser.cpp | 74 ++++----- engines/hugo/parser.h | 28 ++-- engines/hugo/parser_v1d.cpp | 130 +++++++-------- engines/hugo/parser_v1w.cpp | 32 ++-- engines/hugo/parser_v2d.cpp | 18 +-- engines/hugo/parser_v3d.cpp | 166 +++++++++---------- engines/hugo/route.cpp | 106 ++++++------ engines/hugo/schedule.cpp | 124 +++++++------- engines/hugo/sound.cpp | 4 +- 26 files changed, 1279 insertions(+), 1279 deletions(-) (limited to 'engines/hugo') diff --git a/engines/hugo/console.cpp b/engines/hugo/console.cpp index 19fd91e3fa..414c86e1d4 100644 --- a/engines/hugo/console.cpp +++ b/engines/hugo/console.cpp @@ -96,8 +96,8 @@ bool HugoConsole::Cmd_listObjects(int argc, const char **argv) { DebugPrintf("Available objects for this game are:\n"); for (int i = 0; i < _vm->_object->_numObj; i++) { - if (_vm->_object->_objects[i].genericCmd & TAKE) - DebugPrintf("%2d - %s\n", i, _vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2)); + if (_vm->_object->_objects[i]._genericCmd & TAKE) + DebugPrintf("%2d - %s\n", i, _vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 2)); } return true; } @@ -111,7 +111,7 @@ bool HugoConsole::Cmd_getObject(int argc, const char **argv) { return true; } - if (_vm->_object->_objects[strToInt(argv[1])].genericCmd & TAKE) + if (_vm->_object->_objects[strToInt(argv[1])]._genericCmd & TAKE) _vm->_parser->takeObject(&_vm->_object->_objects[strToInt(argv[1])]); else DebugPrintf("Object not available\n"); @@ -129,7 +129,7 @@ bool HugoConsole::Cmd_getAllObjects(int argc, const char **argv) { } for (int i = 0; i < _vm->_object->_numObj; i++) { - if (_vm->_object->_objects[i].genericCmd & TAKE) + if (_vm->_object->_objects[i]._genericCmd & TAKE) _vm->_parser->takeObject(&_vm->_object->_objects[i]); } @@ -145,7 +145,7 @@ bool HugoConsole::Cmd_boundaries(int argc, const char **argv) { return true; } - _vm->getGameStatus().showBoundariesFl = !_vm->getGameStatus().showBoundariesFl; + _vm->getGameStatus()._showBoundariesFl = !_vm->getGameStatus()._showBoundariesFl; return false; } diff --git a/engines/hugo/dialogs.cpp b/engines/hugo/dialogs.cpp index e0b0198470..0efd47a3bd 100644 --- a/engines/hugo/dialogs.cpp +++ b/engines/hugo/dialogs.cpp @@ -34,19 +34,19 @@ namespace Hugo { -TopMenu::TopMenu(HugoEngine *vm) : Dialog(0, 0, kMenuWidth, kMenuHeight), arrayBmp(0), arraySize(0), +TopMenu::TopMenu(HugoEngine *vm) : Dialog(0, 0, kMenuWidth, kMenuHeight), _arrayBmp(0), _arraySize(0), _vm(vm) { init(); } TopMenu::~TopMenu() { - for (int i = 0; i < arraySize; i++) { - arrayBmp[i * 2]->free(); - delete arrayBmp[i * 2]; - arrayBmp[i * 2 + 1]->free(); - delete arrayBmp[i * 2 + 1]; + for (int i = 0; i < _arraySize; i++) { + _arrayBmp[i * 2]->free(); + delete _arrayBmp[i * 2]; + _arrayBmp[i * 2 + 1]->free(); + delete _arrayBmp[i * 2 + 1]; } - delete[] arrayBmp; + delete[] _arrayBmp; } void TopMenu::init() { @@ -108,23 +108,23 @@ void TopMenu::reflowLayout() { x += kButtonWidth + kButtonPad; // Set the graphics to the 'on' buttons, except for the variable ones - _whatButton->setGfx(arrayBmp[4 * kMenuWhat + scale - 1]); - _musicButton->setGfx(arrayBmp[4 * kMenuMusic + scale - 1 + ((_vm->_config.musicFl) ? 0 : 2)]); - _soundFXButton->setGfx(arrayBmp[4 * kMenuSoundFX + scale - 1 + ((_vm->_config.soundFl) ? 0 : 2)]); - _saveButton->setGfx(arrayBmp[4 * kMenuSave + scale - 1]); - _loadButton->setGfx(arrayBmp[4 * kMenuLoad + scale - 1]); - _recallButton->setGfx(arrayBmp[4 * kMenuRecall + scale - 1]); - _turboButton->setGfx(arrayBmp[4 * kMenuTurbo + scale - 1 + ((_vm->_config.turboFl) ? 0 : 2)]); - _lookButton->setGfx(arrayBmp[4 * kMenuLook + scale - 1]); - _inventButton->setGfx(arrayBmp[4 * kMenuInventory + scale - 1]); + _whatButton->setGfx(_arrayBmp[4 * kMenuWhat + scale - 1]); + _musicButton->setGfx(_arrayBmp[4 * kMenuMusic + scale - 1 + ((_vm->_config.musicFl) ? 0 : 2)]); + _soundFXButton->setGfx(_arrayBmp[4 * kMenuSoundFX + scale - 1 + ((_vm->_config.soundFl) ? 0 : 2)]); + _saveButton->setGfx(_arrayBmp[4 * kMenuSave + scale - 1]); + _loadButton->setGfx(_arrayBmp[4 * kMenuLoad + scale - 1]); + _recallButton->setGfx(_arrayBmp[4 * kMenuRecall + scale - 1]); + _turboButton->setGfx(_arrayBmp[4 * kMenuTurbo + scale - 1 + ((_vm->_config.turboFl) ? 0 : 2)]); + _lookButton->setGfx(_arrayBmp[4 * kMenuLook + scale - 1]); + _inventButton->setGfx(_arrayBmp[4 * kMenuInventory + scale - 1]); } void TopMenu::loadBmpArr(Common::SeekableReadStream &in) { - arraySize = in.readUint16BE(); + _arraySize = in.readUint16BE(); - delete arrayBmp; - arrayBmp = new Graphics::Surface *[arraySize * 2]; - for (int i = 0; i < arraySize; i++) { + delete _arrayBmp; + _arrayBmp = new Graphics::Surface *[_arraySize * 2]; + for (int i = 0; i < _arraySize; i++) { uint16 bmpSize = in.readUint16BE(); uint32 filPos = in.pos(); Common::SeekableSubReadStream stream(&in, filPos, filPos + bmpSize); @@ -137,28 +137,28 @@ void TopMenu::loadBmpArr(Common::SeekableReadStream &in) { if (bitmapSrc->format.bytesPerPixel == 1) error("TopMenu::loadBmpArr(): Unhandled paletted image"); - arrayBmp[i * 2] = bitmapSrc->convertTo(g_system->getOverlayFormat()); - arrayBmp[i * 2 + 1] = new Graphics::Surface(); - arrayBmp[i * 2 + 1]->create(arrayBmp[i * 2]->w * 2, arrayBmp[i * 2]->h * 2, g_system->getOverlayFormat()); - byte *src = (byte *)arrayBmp[i * 2]->pixels; - byte *dst = (byte *)arrayBmp[i * 2 + 1]->pixels; - - for (int j = 0; j < arrayBmp[i * 2]->h; j++) { - src = (byte *)arrayBmp[i * 2]->getBasePtr(0, j); - dst = (byte *)arrayBmp[i * 2 + 1]->getBasePtr(0, j * 2); - for (int k = arrayBmp[i * 2]->w; k > 0; k--) { - for (int m = arrayBmp[i * 2]->format.bytesPerPixel; m > 0; m--) { + _arrayBmp[i * 2] = bitmapSrc->convertTo(g_system->getOverlayFormat()); + _arrayBmp[i * 2 + 1] = new Graphics::Surface(); + _arrayBmp[i * 2 + 1]->create(_arrayBmp[i * 2]->w * 2, _arrayBmp[i * 2]->h * 2, g_system->getOverlayFormat()); + byte *src = (byte *)_arrayBmp[i * 2]->pixels; + byte *dst = (byte *)_arrayBmp[i * 2 + 1]->pixels; + + for (int j = 0; j < _arrayBmp[i * 2]->h; j++) { + src = (byte *)_arrayBmp[i * 2]->getBasePtr(0, j); + dst = (byte *)_arrayBmp[i * 2 + 1]->getBasePtr(0, j * 2); + for (int k = _arrayBmp[i * 2]->w; k > 0; k--) { + for (int m = _arrayBmp[i * 2]->format.bytesPerPixel; m > 0; m--) { *dst++ = *src++; } - src -= arrayBmp[i * 2]->format.bytesPerPixel; + src -= _arrayBmp[i * 2]->format.bytesPerPixel; - for (int m = arrayBmp[i * 2]->format.bytesPerPixel; m > 0; m--) { + for (int m = _arrayBmp[i * 2]->format.bytesPerPixel; m > 0; m--) { *dst++ = *src++; } } - src = (byte *)arrayBmp[i * 2 + 1]->getBasePtr(0, j * 2); - dst = (byte *)arrayBmp[i * 2 + 1]->getBasePtr(0, j * 2 + 1); - for (int k = arrayBmp[i * 2 + 1]->pitch; k > 0; k--) { + src = (byte *)_arrayBmp[i * 2 + 1]->getBasePtr(0, j * 2); + dst = (byte *)_arrayBmp[i * 2 + 1]->getBasePtr(0, j * 2 + 1); + for (int k = _arrayBmp[i * 2 + 1]->pitch; k > 0; k--) { *dst++ = *src++; } } @@ -171,12 +171,12 @@ void TopMenu::handleCommand(GUI::CommandSender *sender, uint32 command, uint32 d switch (command) { case kCmdWhat: close(); - _vm->getGameStatus().helpFl = true; + _vm->getGameStatus()._helpFl = true; break; case kCmdMusic: _vm->_sound->toggleMusic(); - _musicButton->setGfx(arrayBmp[4 * kMenuMusic + (g_system->getOverlayWidth() > 320 ? 2 : 1) - 1 + ((_vm->_config.musicFl) ? 0 : 2)]); + _musicButton->setGfx(_arrayBmp[4 * kMenuMusic + (g_system->getOverlayWidth() > 320 ? 2 : 1) - 1 + ((_vm->_config.musicFl) ? 0 : 2)]); _musicButton->draw(); g_gui.theme()->updateScreen(); g_system->updateScreen(); @@ -194,8 +194,8 @@ void TopMenu::handleCommand(GUI::CommandSender *sender, uint32 command, uint32 d break; case kCmdSave: close(); - if (_vm->getGameStatus().viewState == kViewPlay) { - if (_vm->getGameStatus().gameOverFl) + if (_vm->getGameStatus()._viewState == kViewPlay) { + if (_vm->getGameStatus()._gameOverFl) _vm->gameOverMsg(); else _vm->_file->saveGame(-1, Common::String()); @@ -207,7 +207,7 @@ void TopMenu::handleCommand(GUI::CommandSender *sender, uint32 command, uint32 d break; case kCmdRecall: close(); - _vm->getGameStatus().recallFl = true; + _vm->getGameStatus()._recallFl = true; break; case kCmdTurbo: _vm->_parser->switchTurbo(); diff --git a/engines/hugo/dialogs.h b/engines/hugo/dialogs.h index 4e710ff2f8..114bcf56a9 100644 --- a/engines/hugo/dialogs.h +++ b/engines/hugo/dialogs.h @@ -94,8 +94,8 @@ protected: GUI::PicButtonWidget *_lookButton; GUI::PicButtonWidget *_inventButton; - Graphics::Surface **arrayBmp; - uint16 arraySize; + Graphics::Surface **_arrayBmp; + uint16 _arraySize; }; class EntryDialog : public GUI::Dialog { diff --git a/engines/hugo/display.cpp b/engines/hugo/display.cpp index fa18d6b791..7028195dd4 100644 --- a/engines/hugo/display.cpp +++ b/engines/hugo/display.cpp @@ -239,13 +239,13 @@ void Screen::setBackgroundColor(const uint16 color) { 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 + image_pt image = seq->_imagePtr; // Ptr to object image data image_pt subFrontBuffer = &_frontBuffer[sy * kXPix + sx]; // Ptr to offset in _frontBuffer - int16 frontBufferwrap = kXPix - seq->x2 - 1; // Wraps dest_p after each line - int16 imageWrap = seq->bytesPerLine8 - seq->x2 - 1; + int16 frontBufferwrap = kXPix - seq->_x2 - 1; // Wraps dest_p after each line + int16 imageWrap = seq->_bytesPerLine8 - seq->_x2 - 1; overlayState_t overlayState = (foreFl) ? kOvlForeground : kOvlUndef; // Overlay state of object - for (uint16 y = 0; y < seq->lines; y++) { // Each line in object - for (uint16 x = 0; x <= seq->x2; x++) { + for (uint16 y = 0; y < seq->_lines; y++) { // Each line in object + for (uint16 x = 0; x <= seq->_x2; x++) { if (*image) { // Non-transparent byte ovlBound = _vm->_object->getFirstOverlay((uint16)(subFrontBuffer - _frontBuffer) >> 3); // Ptr into overlay bits if (ovlBound & (0x80 >> ((uint16)(subFrontBuffer - _frontBuffer) & 7))) { // Overlay bit is set @@ -265,7 +265,7 @@ void Screen::displayFrame(const int sx, const int sy, seq_t *seq, const bool for } // Add this rectangle to the display list - displayList(kDisplayAdd, sx, sy, seq->x2 + 1, seq->lines); + displayList(kDisplayAdd, sx, sy, seq->_x2 + 1, seq->_lines); } /** @@ -359,8 +359,8 @@ void Screen::displayList(dupdate_t update, ...) { // Don't blit if newscreen just loaded because _frontBuffer will // get blitted via InvalidateRect() at end of this cycle // and blitting here causes objects to appear too soon. - if (_vm->getGameStatus().newScreenFl) { - _vm->getGameStatus().newScreenFl = false; + if (_vm->getGameStatus()._newScreenFl) { + _vm->getGameStatus()._newScreenFl = false; break; } @@ -563,7 +563,7 @@ void Screen::initNewScreenDisplay() { displayBackground(); // Stop premature object display in Display_list(D_DISPLAY) - _vm->getGameStatus().newScreenFl = true; + _vm->getGameStatus()._newScreenFl = true; } /** @@ -650,19 +650,19 @@ bool Screen::isOverlapping(const rect_t *rectA, const rect_t *rectB) const { * White = Fix objects, parts of background */ void Screen::drawBoundaries() { - if (!_vm->getGameStatus().showBoundariesFl) + if (!_vm->getGameStatus()._showBoundariesFl) return; _vm->_mouse->drawHotspots(); for (int i = 0; i < _vm->_object->_numObj; i++) { object_t *obj = &_vm->_object->_objects[i]; // Get pointer to object - if (obj->screenIndex == *_vm->_screen_p) { - if ((obj->currImagePtr != 0) && (obj->cycling != kCycleInvisible)) - drawRectangle(false, obj->x + obj->currImagePtr->x1, obj->y + obj->currImagePtr->y1, - obj->x + obj->currImagePtr->x2, obj->y + obj->currImagePtr->y2, _TLIGHTGREEN); - else if ((obj->currImagePtr == 0) && (obj->vxPath != 0) && !obj->carriedFl) - drawRectangle(false, obj->oldx, obj->oldy, obj->oldx + obj->vxPath, obj->oldy + obj->vyPath, _TBRIGHTWHITE); + if (obj->_screenIndex == *_vm->_screen_p) { + if ((obj->_currImagePtr != 0) && (obj->_cycling != kCycleInvisible)) + drawRectangle(false, obj->_x + obj->_currImagePtr->_x1, obj->_y + obj->_currImagePtr->_y1, + obj->_x + obj->_currImagePtr->_x2, obj->_y + obj->_currImagePtr->_y2, _TLIGHTGREEN); + else if ((obj->_currImagePtr == 0) && (obj->_vxPath != 0) && !obj->_carriedFl) + drawRectangle(false, obj->_oldx, obj->_oldy, obj->_oldx + obj->_vxPath, obj->_oldy + obj->_vyPath, _TBRIGHTWHITE); } } g_system->copyRectToScreen(_frontBuffer, 320, 0, 0, 320, 200); @@ -735,7 +735,7 @@ overlayState_t Screen_v1d::findOvl(seq_t *seq_p, image_pt dst_p, uint16 y) { uint16 index = (uint16)(dst_p - _frontBuffer) >> 3; - for (int i = 0; i < seq_p->lines-y; i++) { // Each line in object + for (int i = 0; i < seq_p->_lines-y; i++) { // Each line in object if (_vm->_object->getBaseBoundary(index)) // If any overlay base byte is non-zero then the object is foreground, else back. return kOvlForeground; index += kCompLineSize; @@ -802,7 +802,7 @@ void Screen_v1w::loadFontArr(Common::ReadStream &in) { overlayState_t Screen_v1w::findOvl(seq_t *seq_p, image_pt dst_p, uint16 y) { debugC(4, kDebugDisplay, "findOvl()"); - for (; y < seq_p->lines; y++) { // Each line in object + for (; y < seq_p->_lines; y++) { // Each line in object byte ovb = _vm->_object->getBaseBoundary((uint16)(dst_p - _frontBuffer) >> 3); // Ptr into overlay bits if (ovb & (0x80 >> ((uint16)(dst_p - _frontBuffer) & 7))) // Overlay bit is set return kOvlForeground; // Found a bit - must be foreground diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp index f94f3b0443..8b03a9a430 100644 --- a/engines/hugo/file.cpp +++ b/engines/hugo/file.cpp @@ -143,11 +143,11 @@ seq_t *FileManager::readPCX(Common::ReadStream &f, seq_t *seqPtr, byte *imagePtr // Find size of image data in 8-bit DIB format // Note save of x2 - marks end of valid data before garbage uint16 bytesPerLine4 = PCC_header.bytesPerLine * 4; // 4-bit bpl - seqPtr->bytesPerLine8 = bytesPerLine4 * 2; // 8-bit bpl - seqPtr->lines = PCC_header.y2 - PCC_header.y1 + 1; - seqPtr->x2 = PCC_header.x2 - PCC_header.x1 + 1; + seqPtr->_bytesPerLine8 = bytesPerLine4 * 2; // 8-bit bpl + seqPtr->_lines = PCC_header.y2 - PCC_header.y1 + 1; + seqPtr->_x2 = PCC_header.x2 - PCC_header.x1 + 1; // Size of the image - uint16 size = seqPtr->lines * seqPtr->bytesPerLine8; + uint16 size = seqPtr->_lines * seqPtr->_bytesPerLine8; // Allocate memory for image data if NULL if (imagePtr == 0) @@ -155,13 +155,13 @@ seq_t *FileManager::readPCX(Common::ReadStream &f, seq_t *seqPtr, byte *imagePtr assert(imagePtr); - seqPtr->imagePtr = imagePtr; + seqPtr->_imagePtr = imagePtr; // Process the image data, converting to 8-bit DIB format uint16 y = 0; // Current line index byte pline[kXPix]; // Hold 4 planes of data byte *p = pline; // Ptr to above - while (y < seqPtr->lines) { + while (y < seqPtr->_lines) { byte c = f.readByte(); if ((c & kRepeatMask) == kRepeatMask) { byte d = f.readByte(); // Read data byte @@ -193,7 +193,7 @@ void FileManager::readImage(const int objNum, object_t *objPtr) { uint32 objLength; }; - if (!objPtr->seqNumb) // This object has no images + if (!objPtr->_seqNumb) // This object has no images return; if (_vm->isPacked()) { @@ -206,9 +206,9 @@ void FileManager::readImage(const int objNum, object_t *objPtr) { _objectsArchive.seek(objBlock.objOffset, SEEK_SET); } else { Common::String buf; - buf = _vm->_picDir + Common::String(_vm->_text->getNoun(objPtr->nounIndex, 0)) + ".PIX"; + buf = _vm->_picDir + Common::String(_vm->_text->getNoun(objPtr->_nounIndex, 0)) + ".PIX"; if (!_objectsArchive.open(buf)) { - buf = Common::String(_vm->_text->getNoun(objPtr->nounIndex, 0)) + ".PIX"; + buf = Common::String(_vm->_text->getNoun(objPtr->_nounIndex, 0)) + ".PIX"; if (!_objectsArchive.open(buf)) error("File not found: %s", buf.c_str()); } @@ -218,60 +218,60 @@ void FileManager::readImage(const int objNum, object_t *objPtr) { seq_t *seqPtr = 0; // Ptr to sequence structure // Now read the images into an images list - for (int j = 0; j < objPtr->seqNumb; j++) { // for each sequence - for (int k = 0; k < objPtr->seqList[j].imageNbr; k++) { // each image + for (int j = 0; j < objPtr->_seqNumb; j++) { // for each sequence + for (int k = 0; k < objPtr->_seqList[j]._imageNbr; k++) { // each image if (k == 0) { // First image // Read this image - allocate both seq and image memory - seqPtr = readPCX(_objectsArchive, 0, 0, firstImgFl, _vm->_text->getNoun(objPtr->nounIndex, 0)); - objPtr->seqList[j].seqPtr = seqPtr; + seqPtr = readPCX(_objectsArchive, 0, 0, firstImgFl, _vm->_text->getNoun(objPtr->_nounIndex, 0)); + objPtr->_seqList[j]._seqPtr = seqPtr; firstImgFl = false; } else { // Subsequent image // Read this image - allocate both seq and image memory - seqPtr->nextSeqPtr = readPCX(_objectsArchive, 0, 0, firstImgFl, _vm->_text->getNoun(objPtr->nounIndex, 0)); - seqPtr = seqPtr->nextSeqPtr; + seqPtr->_nextSeqPtr = readPCX(_objectsArchive, 0, 0, firstImgFl, _vm->_text->getNoun(objPtr->_nounIndex, 0)); + seqPtr = seqPtr->_nextSeqPtr; } // Compute the bounding box - x1, x2, y1, y2 // Note use of x2 - marks end of valid data in row - uint16 x2 = seqPtr->x2; - seqPtr->x1 = seqPtr->x2; - seqPtr->x2 = 0; - seqPtr->y1 = seqPtr->lines; - seqPtr->y2 = 0; - - image_pt dibPtr = seqPtr->imagePtr; - for (int y = 0; y < seqPtr->lines; y++, dibPtr += seqPtr->bytesPerLine8 - x2) { + uint16 x2 = seqPtr->_x2; + seqPtr->_x1 = seqPtr->_x2; + seqPtr->_x2 = 0; + seqPtr->_y1 = seqPtr->_lines; + seqPtr->_y2 = 0; + + image_pt dibPtr = seqPtr->_imagePtr; + for (int y = 0; y < seqPtr->_lines; y++, dibPtr += seqPtr->_bytesPerLine8 - x2) { for (int x = 0; x < x2; x++) { if (*dibPtr++) { // Some data found - if (x < seqPtr->x1) - seqPtr->x1 = x; - if (x > seqPtr->x2) - seqPtr->x2 = x; - if (y < seqPtr->y1) - seqPtr->y1 = y; - if (y > seqPtr->y2) - seqPtr->y2 = y; + if (x < seqPtr->_x1) + seqPtr->_x1 = x; + if (x > seqPtr->_x2) + seqPtr->_x2 = x; + if (y < seqPtr->_y1) + seqPtr->_y1 = y; + if (y > seqPtr->_y2) + seqPtr->_y2 = y; } } } } assert(seqPtr); - seqPtr->nextSeqPtr = objPtr->seqList[j].seqPtr; // loop linked list to head + seqPtr->_nextSeqPtr = objPtr->_seqList[j]._seqPtr; // loop linked list to head } // Set the current image sequence to first or last - switch (objPtr->cycling) { + switch (objPtr->_cycling) { case kCycleInvisible: // (May become visible later) case kCycleAlmostInvisible: case kCycleNotCycling: case kCycleForward: - objPtr->currImagePtr = objPtr->seqList[0].seqPtr; + objPtr->_currImagePtr = objPtr->_seqList[0]._seqPtr; break; case kCycleBackward: - objPtr->currImagePtr = seqPtr; + objPtr->_currImagePtr = seqPtr; break; default: - warning("Unexpected cycling: %d", objPtr->cycling); + warning("Unexpected cycling: %d", objPtr->_cycling); } if (!_vm->isPacked()) @@ -298,25 +298,25 @@ sound_pt FileManager::getSound(const int16 sound, uint16 *size) { if (!has_read_header) { for (int i = 0; i < kMaxSounds; i++) { - s_hdr[i].size = fp.readUint16LE(); - s_hdr[i].offset = fp.readUint32LE(); + s_hdr[i]._size = fp.readUint16LE(); + s_hdr[i]._offset = fp.readUint32LE(); } if (fp.err()) error("Wrong sound file format"); has_read_header = true; } - *size = s_hdr[sound].size; + *size = s_hdr[sound]._size; if (*size == 0) 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 + sound_pt soundPtr = (byte *)malloc(s_hdr[sound]._size); // Ptr to sound data assert(soundPtr); // 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) + fp.seek(s_hdr[sound]._offset, SEEK_SET); + if (fp.read(soundPtr, s_hdr[sound]._size) != s_hdr[sound]._size) error("Wrong sound file format"); fp.close(); @@ -391,13 +391,13 @@ bool FileManager::saveGame(const int16 slot, const Common::String &descrip) { out->writeSint16BE(_vm->getScore()); // Save story mode - out->writeByte((gameStatus.storyModeFl) ? 1 : 0); + out->writeByte((gameStatus._storyModeFl) ? 1 : 0); // Save jumpexit mode out->writeByte((_vm->_mouse->getJumpExitFl()) ? 1 : 0); // Save gameover status - out->writeByte((gameStatus.gameOverFl) ? 1 : 0); + out->writeByte((gameStatus._gameOverFl) ? 1 : 0); // Save screen states for (int i = 0; i < _vm->_numStates; i++) @@ -408,17 +408,17 @@ bool FileManager::saveGame(const int16 slot, const Common::String &descrip) { _vm->_screen->savePal(out); // Save maze status - out->writeByte((_vm->_maze.enabledFl) ? 1 : 0); - out->writeByte(_vm->_maze.size); - out->writeSint16BE(_vm->_maze.x1); - out->writeSint16BE(_vm->_maze.y1); - out->writeSint16BE(_vm->_maze.x2); - out->writeSint16BE(_vm->_maze.y2); - out->writeSint16BE(_vm->_maze.x3); - out->writeSint16BE(_vm->_maze.x4); - out->writeByte(_vm->_maze.firstScreenIndex); - - out->writeByte((byte)_vm->getGameStatus().viewState); + out->writeByte((_vm->_maze._enabledFl) ? 1 : 0); + out->writeByte(_vm->_maze._size); + out->writeSint16BE(_vm->_maze._x1); + out->writeSint16BE(_vm->_maze._y1); + out->writeSint16BE(_vm->_maze._x2); + out->writeSint16BE(_vm->_maze._y2); + out->writeSint16BE(_vm->_maze._x3); + out->writeSint16BE(_vm->_maze._x4); + out->writeByte(_vm->_maze._firstScreenIndex); + + out->writeByte((byte)_vm->getGameStatus()._viewState); out->finalize(); @@ -491,9 +491,9 @@ bool FileManager::restoreGame(const int16 slot) { int score = in->readSint16BE(); _vm->setScore(score); - gameStatus.storyModeFl = (in->readByte() == 1); + gameStatus._storyModeFl = (in->readByte() == 1); _vm->_mouse->setJumpExitFl(in->readByte() == 1); - gameStatus.gameOverFl = (in->readByte() == 1); + gameStatus._gameOverFl = (in->readByte() == 1); for (int i = 0; i < _vm->_numStates; i++) _vm->_screenStates[i] = in->readByte(); @@ -503,18 +503,18 @@ bool FileManager::restoreGame(const int16 slot) { _vm->_screen->restorePal(in); // Restore maze status - _vm->_maze.enabledFl = (in->readByte() == 1); - _vm->_maze.size = in->readByte(); - _vm->_maze.x1 = in->readSint16BE(); - _vm->_maze.y1 = in->readSint16BE(); - _vm->_maze.x2 = in->readSint16BE(); - _vm->_maze.y2 = in->readSint16BE(); - _vm->_maze.x3 = in->readSint16BE(); - _vm->_maze.x4 = in->readSint16BE(); - _vm->_maze.firstScreenIndex = in->readByte(); + _vm->_maze._enabledFl = (in->readByte() == 1); + _vm->_maze._size = in->readByte(); + _vm->_maze._x1 = in->readSint16BE(); + _vm->_maze._y1 = in->readSint16BE(); + _vm->_maze._x2 = in->readSint16BE(); + _vm->_maze._y2 = in->readSint16BE(); + _vm->_maze._x3 = in->readSint16BE(); + _vm->_maze._x4 = in->readSint16BE(); + _vm->_maze._firstScreenIndex = in->readByte(); _vm->_scheduler->restoreScreen(*_vm->_screen_p); - if ((_vm->getGameStatus().viewState = (vstate_t) in->readByte()) != kViewPlay) + if ((_vm->getGameStatus()._viewState = (vstate_t) in->readByte()) != kViewPlay) _vm->_screen->hideCursor(); @@ -536,25 +536,25 @@ void FileManager::printBootText() { return; } else { Utils::notifyBox(Common::String::format("Missing startup file '%s'", getBootFilename())); - _vm->getGameStatus().doQuitFl = true; + _vm->getGameStatus()._doQuitFl = true; return; } } // Allocate space for the text and print it - char *buf = (char *)malloc(_vm->_boot.exit_len + 1); + char *buf = (char *)malloc(_vm->_boot._exitLen + 1); if (buf) { // Skip over the boot structure (already read) and read exit text ofp.seek((long)sizeof(_vm->_boot), SEEK_SET); - if (ofp.read(buf, _vm->_boot.exit_len) != (size_t)_vm->_boot.exit_len) { + if (ofp.read(buf, _vm->_boot._exitLen) != (size_t)_vm->_boot._exitLen) { Utils::notifyBox(Common::String::format("Error while reading startup file '%s'", getBootFilename())); - _vm->getGameStatus().doQuitFl = true; + _vm->getGameStatus()._doQuitFl = true; return; } // Decrypt the exit text, using CRYPT substring int i; - for (i = 0; i < _vm->_boot.exit_len; i++) + for (i = 0; i < _vm->_boot._exitLen; i++) buf[i] ^= s_bootCypher[i % s_bootCypherLen]; buf[i] = '\0'; @@ -577,32 +577,32 @@ void FileManager::readBootFile() { if (_vm->_gameVariant == kGameVariantH1Dos) { //TODO initialize properly _boot structure warning("readBootFile - Skipping as H1 Dos may be a freeware"); - memset(_vm->_boot.distrib, '\0', sizeof(_vm->_boot.distrib)); - _vm->_boot.registered = kRegFreeware; + memset(_vm->_boot._distrib, '\0', sizeof(_vm->_boot._distrib)); + _vm->_boot._registered = kRegFreeware; return; } else if (_vm->getPlatform() == Common::kPlatformPC) { warning("readBootFile - Skipping as H2 and H3 Dos may be shareware"); - memset(_vm->_boot.distrib, '\0', sizeof(_vm->_boot.distrib)); - _vm->_boot.registered = kRegShareware; + memset(_vm->_boot._distrib, '\0', sizeof(_vm->_boot._distrib)); + _vm->_boot._registered = kRegShareware; return; } else { Utils::notifyBox(Common::String::format("Missing startup file '%s'", getBootFilename())); - _vm->getGameStatus().doQuitFl = true; + _vm->getGameStatus()._doQuitFl = true; return; } } if (ofp.size() < (int32)sizeof(_vm->_boot)) { Utils::notifyBox(Common::String::format("Corrupted startup file '%s'", getBootFilename())); - _vm->getGameStatus().doQuitFl = true; + _vm->getGameStatus()._doQuitFl = true; return; } - _vm->_boot.checksum = ofp.readByte(); - _vm->_boot.registered = ofp.readByte(); - ofp.read(_vm->_boot.pbswitch, sizeof(_vm->_boot.pbswitch)); - ofp.read(_vm->_boot.distrib, sizeof(_vm->_boot.distrib)); - _vm->_boot.exit_len = ofp.readUint16LE(); + _vm->_boot._checksum = ofp.readByte(); + _vm->_boot._registered = ofp.readByte(); + ofp.read(_vm->_boot._pbswitch, sizeof(_vm->_boot._pbswitch)); + ofp.read(_vm->_boot._distrib, sizeof(_vm->_boot._distrib)); + _vm->_boot._exitLen = ofp.readUint16LE(); byte *p = (byte *)&_vm->_boot; @@ -615,7 +615,7 @@ void FileManager::readBootFile() { if (checksum) { Utils::notifyBox(Common::String::format("Corrupted startup file '%s'", getBootFilename())); - _vm->getGameStatus().doQuitFl = true; + _vm->getGameStatus()._doQuitFl = true; } } diff --git a/engines/hugo/game.h b/engines/hugo/game.h index b1c5f407b3..ab5e2dff56 100644 --- a/engines/hugo/game.h +++ b/engines/hugo/game.h @@ -84,11 +84,11 @@ enum path_t { }; struct hugo_boot_t { // Common HUGO boot file - char checksum; // Checksum for boot structure (not exit text) - char registered; // TRUE if registered version, else FALSE - char pbswitch[8]; // Playback switch string - char distrib[32]; // Distributor branding string - uint16 exit_len; // Length of exit text (next in file) + char _checksum; // Checksum for boot structure (not exit text) + char _registered; // TRUE if registered version, else FALSE + char _pbswitch[8]; // Playback switch string + char _distrib[32]; // Distributor branding string + uint16 _exitLen; // Length of exit text (next in file) } PACKED_STRUCT; /** @@ -101,11 +101,11 @@ typedef byte *sound_pt; // ptr to sound (or music) d * Structure for initializing maze processing */ struct maze_t { - bool enabledFl; // TRUE when maze processing enabled - byte size; // Size of (square) maze matrix - int x1, y1, x2, y2; // maze hotspot bounding box - int x3, x4; // north, south x entry coordinates - byte firstScreenIndex; // index of first screen in maze + bool _enabledFl; // TRUE when maze processing enabled + byte _size; // Size of (square) maze matrix + int _x1, _y1, _x2, _y2; // maze hotspot bounding box + int _x3, _x4; // north, south x entry coordinates + byte _firstScreenIndex; // index of first screen in maze }; /** @@ -113,25 +113,25 @@ struct maze_t { * The image data is in 8-bit DIB format, i.e. 1 byte = 1 pixel */ struct seq_t { // Linked list of images - byte *imagePtr; // ptr to image - uint16 bytesPerLine8; // bytes per line (8bits) - uint16 lines; // lines - uint16 x1, x2, y1, y2; // Offsets from x,y: data bounding box - seq_t *nextSeqPtr; // ptr to next record + byte *_imagePtr; // ptr to image + uint16 _bytesPerLine8; // bytes per line (8bits) + uint16 _lines; // lines + uint16 _x1, _x2, _y1, _y2; // Offsets from x,y: data bounding box + seq_t *_nextSeqPtr; // ptr to next record }; /** * The following is an array of structures of above sequences */ struct seqList_t { - uint16 imageNbr; // Number of images in sequence - seq_t *seqPtr; // Ptr to sequence structure + uint16 _imageNbr; // Number of images in sequence + seq_t *_seqPtr; // Ptr to sequence structure }; #include "common/pack-start.h" // START STRUCT PACKING struct sound_hdr_t { // Sound file lookup entry - uint16 size; // Size of sound data in bytes - uint32 offset; // Offset of sound data in file + uint16 _size; // Size of sound data in bytes + uint32 _offset; // Offset of sound data in file } PACKED_STRUCT; #include "common/pack-end.h" // END STRUCT PACKING @@ -141,37 +141,37 @@ static const int kMaxSeqNumb = 4; // Number of sequences of im * Following is definition of object attributes */ struct object_t { - uint16 nounIndex; // String identifying object - uint16 dataIndex; // String describing the object - uint16 *stateDataIndex; // Added by Strangerke to handle the LOOK_S state-dependant descriptions - path_t pathType; // Describe path object follows - int vxPath, vyPath; // Delta velocities (e.g. for CHASE) - uint16 actIndex; // Action list to do on collision with hero - byte seqNumb; // Number of sequences in list - seq_t *currImagePtr; // Sequence image currently in use - seqList_t seqList[kMaxSeqNumb]; // Array of sequence structure ptrs and lengths - cycle_t cycling; // Whether cycling, forward or backward - byte cycleNumb; // No. of times to cycle - byte frameInterval; // Interval (in ticks) between frames - byte frameTimer; // Decrementing timer for above - int8 radius; // Defines sphere of influence by hero - byte screenIndex; // Screen in which object resides - int x, y; // Current coordinates of object - int oldx, oldy; // Previous coordinates of object - int8 vx, vy; // Velocity - byte objValue; // Value of object - int genericCmd; // Bit mask of 'generic' commands for object - uint16 cmdIndex; // ptr to list of cmd structures for verbs - bool carriedFl; // TRUE if object being carried - byte state; // state referenced in cmd list - bool verbOnlyFl; // TRUE if verb-only cmds allowed e.g. sit,look - byte priority; // Whether object fore, background or floating - int16 viewx, viewy; // Position to view object from (or 0 or -1) - int16 direction; // Direction to view object from - byte curSeqNum; // Save which seq number currently in use - byte curImageNum; // Save which image of sequence currently in use - int8 oldvx; // Previous vx (used in wandering) - int8 oldvy; // Previous vy + uint16 _nounIndex; // String identifying object + uint16 _dataIndex; // String describing the object + uint16 *_stateDataIndex; // Added by Strangerke to handle the LOOK_S state-dependant descriptions + path_t _pathType; // Describe path object follows + int _vxPath, _vyPath; // Delta velocities (e.g. for CHASE) + uint16 _actIndex; // Action list to do on collision with hero + byte _seqNumb; // Number of sequences in list + seq_t *_currImagePtr; // Sequence image currently in use + seqList_t _seqList[kMaxSeqNumb]; // Array of sequence structure ptrs and lengths + cycle_t _cycling; // Whether cycling, forward or backward + byte _cycleNumb; // No. of times to cycle + byte _frameInterval; // Interval (in ticks) between frames + byte _frameTimer; // Decrementing timer for above + int8 _radius; // Defines sphere of influence by hero + byte _screenIndex; // Screen in which object resides + int _x, _y; // Current coordinates of object + int _oldx, _oldy; // Previous coordinates of object + int8 _vx, _vy; // Velocity + byte _objValue; // Value of object + int _genericCmd; // Bit mask of 'generic' commands for object + uint16 _cmdIndex; // ptr to list of cmd structures for verbs + bool _carriedFl; // TRUE if object being carried + byte _state; // state referenced in cmd list + bool _verbOnlyFl; // TRUE if verb-only cmds allowed e.g. sit,look + byte _priority; // Whether object fore, background or floating + int16 _viewx, _viewy; // Position to view object from (or 0 or -1) + int16 _direction; // Direction to view object from + byte _curSeqNum; // Save which seq number currently in use + byte _curImageNum; // Save which image of sequence currently in use + int8 _oldvx; // Previous vx (used in wandering) + int8 _oldvy; // Previous vy }; } // End of namespace Hugo diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp index df8abf32eb..450f4ff837 100644 --- a/engines/hugo/hugo.cpp +++ b/engines/hugo/hugo.cpp @@ -249,24 +249,24 @@ Common::Error HugoEngine::run() { initStatus(); // Initialize game status initConfig(); // Initialize user's config - if (!_status.doQuitFl) { + if (!_status._doQuitFl) { initialize(); resetConfig(); // Reset user's config initMachine(); // Start the state machine - _status.viewState = kViewIntroInit; + _status._viewState = kViewIntroInit; int16 loadSlot = Common::ConfigManager::instance().getInt("save_slot"); if (loadSlot >= 0) { - _status.skipIntroFl = true; + _status._skipIntroFl = true; _file->restoreGame(loadSlot); } else { _file->saveGame(0, "New Game"); } } - while (!_status.doQuitFl) { + while (!_status._doQuitFl) { _screen->drawBoundaries(); g_system->updateScreen(); runMachine(); @@ -289,20 +289,20 @@ Common::Error HugoEngine::run() { _mouse->setRightButton(); break; case Common::EVENT_QUIT: - _status.doQuitFl = true; + _status._doQuitFl = true; break; default: break; } } - if (_status.helpFl) { - _status.helpFl = false; + if (_status._helpFl) { + _status._helpFl = false; _file->instructions(); } _mouse->mouseHandler(); // Mouse activity - adds to display list _screen->displayList(kDisplayDisplay); // Blit the display list to screen - _status.doQuitFl |= shouldQuit(); // update game quit flag + _status._doQuitFl |= shouldQuit(); // update game quit flag } return Common::kNoError; } @@ -326,7 +326,7 @@ void HugoEngine::runMachine() { status_t &gameStatus = getGameStatus(); // Don't process if gameover - if (gameStatus.gameOverFl) + if (gameStatus._gameOverFl) return; _curTime = g_system->getMillis(); @@ -338,19 +338,19 @@ void HugoEngine::runMachine() { _lastTime = _curTime; - switch (gameStatus.viewState) { + switch (gameStatus._viewState) { case kViewIdle: // Not processing state machine _screen->hideCursor(); _intro->preNewGame(); // Any processing before New Game selected break; case kViewIntroInit: // Initialization before intro begins _intro->introInit(); - gameStatus.viewState = kViewIntro; + gameStatus._viewState = kViewIntro; break; case kViewIntro: // Do any game-dependant preamble if (_intro->introPlay()) { // Process intro screen _scheduler->newScreen(0); // Initialize first screen - gameStatus.viewState = kViewPlay; + gameStatus._viewState = kViewPlay; } break; case kViewPlay: // Playing game @@ -368,8 +368,8 @@ void HugoEngine::runMachine() { _inventory->runInventory(); // Process Inventory state machine break; case kViewExit: // Game over or user exited - gameStatus.viewState = kViewIdle; - _status.doQuitFl = true; + gameStatus._viewState = kViewIdle; + _status._doQuitFl = true; break; } } @@ -427,7 +427,7 @@ bool HugoEngine::loadHugoDat() { _scheduler->loadActListArr(in); _scheduler->loadAlNewscrIndex(in); _hero = &_object->_objects[kHeroIndex]; // This always points to hero - _screen_p = &(_object->_objects[kHeroIndex].screenIndex); // Current screen is hero's + _screen_p = &(_object->_objects[kHeroIndex]._screenIndex); // Current screen is hero's _heroImage = kHeroIndex; // Current in use hero image for (int varnt = 0; varnt < _numVariant; varnt++) { @@ -527,33 +527,33 @@ void HugoEngine::initPlaylist(bool playlist[kMaxTunes]) { */ void HugoEngine::initStatus() { debugC(1, kDebugEngine, "initStatus"); - _status.storyModeFl = false; // Not in story mode - _status.gameOverFl = false; // Hero not knobbled yet - _status.lookFl = false; // Toolbar "look" button - _status.recallFl = false; // Toolbar "recall" button - _status.newScreenFl = false; // Screen not just loaded - _status.godModeFl = false; // No special cheats allowed - _status.showBoundariesFl = false; // Boundaries hidden by default - _status.doQuitFl = false; - _status.skipIntroFl = false; - _status.helpFl = false; + _status._storyModeFl = false; // Not in story mode + _status._gameOverFl = false; // Hero not knobbled yet + _status._lookFl = false; // Toolbar "look" button + _status._recallFl = false; // Toolbar "recall" button + _status._newScreenFl = false; // Screen not just loaded + _status._godModeFl = false; // No special cheats allowed + _status._showBoundariesFl = false; // Boundaries hidden by default + _status._doQuitFl = false; + _status._skipIntroFl = false; + _status._helpFl = false; // Initialize every start of new game - _status.tick = 0; // Tick count - _status.viewState = kViewIdle; // View state + _status._tick = 0; // Tick count + _status._viewState = kViewIdle; // View state // Strangerke - Suppress as related to playback -// _status.recordFl = false; // Not record mode -// _status.playbackFl = false; // Not playback mode +// _status._recordFl = false; // Not record mode +// _status._playbackFl = false; // Not playback mode // Strangerke - Not used ? -// _status.mmtime = false; // Multimedia timer support -// _status.helpFl = false; // Not calling WinHelp() -// _status.demoFl = false; // Not demo mode -// _status.path[0] = 0; // Path to write files -// _status.screenWidth = 0; // Desktop screen width -// _status.saveTick = 0; // Time of last save -// _status.saveSlot = 0; // Slot to save/restore game -// _status.textBoxFl = false; // Not processing a text box +// _status._mmtime = false; // Multimedia timer support +// _status._helpFl = false; // Not calling WinHelp() +// _status._demoFl = false; // Not demo mode +// _status._path[0] = 0; // Path to write files +// _status._screenWidth = 0; // Desktop screen width +// _status._saveTick = 0; // Time of last save +// _status._saveSlot = 0; // Slot to save/restore game +// _status._textBoxFl = false; // Not processing a text box } /** @@ -587,7 +587,7 @@ void HugoEngine::resetConfig() { void HugoEngine::initialize() { debugC(1, kDebugEngine, "initialize"); - _maze.enabledFl = false; + _maze._enabledFl = false; _line[0] = '\0'; _sound->initSound(); @@ -679,10 +679,10 @@ void HugoEngine::calcMaxScore() { void HugoEngine::endGame() { debugC(1, kDebugEngine, "endGame"); - if (_boot.registered != kRegRegistered) + if (_boot._registered != kRegRegistered) Utils::notifyBox(_text->getTextEngine(kEsAdvertise)); Utils::notifyBox(Common::String::format("%s\n%s", _episode, getCopyrightString())); - _status.viewState = kViewExit; + _status._viewState = kViewExit; } bool HugoEngine::canLoadGameStateCurrently() { @@ -690,7 +690,7 @@ bool HugoEngine::canLoadGameStateCurrently() { } bool HugoEngine::canSaveGameStateCurrently() { - return (_status.viewState == kViewPlay); + return (_status._viewState == kViewPlay); } int8 HugoEngine::getTPS() const { diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h index 125819a39b..3ad6fced24 100644 --- a/engines/hugo/hugo.h +++ b/engines/hugo/hugo.h @@ -171,20 +171,20 @@ enum seqTextEngine { struct HugoGameDescription; struct status_t { // Game status (not saved) - bool storyModeFl; // Game is telling story - no commands - bool gameOverFl; // Game is over - hero knobbled - bool lookFl; // Toolbar "look" button pressed - bool recallFl; // Toolbar "recall" button pressed - bool newScreenFl; // New screen just loaded in dib_a - bool godModeFl; // Allow DEBUG features in live version - bool showBoundariesFl; // Flag used to show and hide boundaries, + bool _storyModeFl; // Game is telling story - no commands + bool _gameOverFl; // Game is over - hero knobbled + bool _lookFl; // Toolbar "look" button pressed + bool _recallFl; // Toolbar "recall" button pressed + bool _newScreenFl; // New screen just loaded in dib_a + bool _godModeFl; // Allow DEBUG features in live version + bool _showBoundariesFl; // Flag used to show and hide boundaries, // used by the console - bool doQuitFl; - bool skipIntroFl; - bool helpFl; - uint32 tick; // Current time in ticks - vstate_t viewState; // View state machine - int16 song; // Current song + bool _doQuitFl; + bool _skipIntroFl; + bool _helpFl; + uint32 _tick; // Current time in ticks + vstate_t _viewState; // View state machine + int16 _song; // Current song // Strangerke - Suppress as related to playback // bool playbackFl; // Game is in playback mode diff --git a/engines/hugo/intro.cpp b/engines/hugo/intro.cpp index 72f718fe8e..599d8f21d3 100644 --- a/engines/hugo/intro.cpp +++ b/engines/hugo/intro.cpp @@ -98,7 +98,7 @@ void intro_v1d::introInit() { bool intro_v1d::introPlay() { byte introSize = getIntroSize(); - if (_vm->getGameStatus().skipIntroFl) + if (_vm->getGameStatus()._skipIntroFl) return true; if (introTicks < introSize) { @@ -117,20 +117,20 @@ bool intro_v1d::introPlay() { error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 8"); char buffer[80]; - if (_vm->_boot.registered == kRegRegistered) + if (_vm->_boot._registered == kRegRegistered) strcpy(buffer, "Registered Version"); - else if (_vm->_boot.registered == kRegShareware) + else if (_vm->_boot._registered == kRegShareware) strcpy(buffer, "Shareware Version"); - else if (_vm->_boot.registered == kRegFreeware) + else if (_vm->_boot._registered == kRegFreeware) strcpy(buffer, "Freeware Version"); else - error("Unknown registration flag in hugo.bsf: %d", _vm->_boot.registered); + error("Unknown registration flag in hugo.bsf: %d", _vm->_boot._registered); font.drawString(&surf, buffer, 0, 163, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); font.drawString(&surf, _vm->getCopyrightString(), 0, 176, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); - if ((*_vm->_boot.distrib != '\0') && (scumm_stricmp(_vm->_boot.distrib, "David P. Gray"))) { - sprintf(buffer, "Distributed by %s.", _vm->_boot.distrib); + if ((*_vm->_boot._distrib != '\0') && (scumm_stricmp(_vm->_boot._distrib, "David P. Gray"))) { + sprintf(buffer, "Distributed by %s.", _vm->_boot._distrib); font.drawString(&surf, buffer, 0, 75, 320, _TMAGENTA, Graphics::kTextAlignCenter); } @@ -253,16 +253,16 @@ void intro_v2d::introInit() { if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 8))) error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 8"); - if (_vm->_boot.registered) + if (_vm->_boot._registered) sprintf(buffer, "%s Registered Version", _vm->getCopyrightString()); else sprintf(buffer, "%s Shareware Version", _vm->getCopyrightString()); font.drawString(&surf, buffer, 0, 186, 320, _TLIGHTRED, Graphics::kTextAlignCenter); - if ((*_vm->_boot.distrib != '\0') && (scumm_stricmp(_vm->_boot.distrib, "David P. Gray"))) { + if ((*_vm->_boot._distrib != '\0') && (scumm_stricmp(_vm->_boot._distrib, "David P. Gray"))) { // TROMAN, size 10-5 - sprintf(buffer, "Distributed by %s.", _vm->_boot.distrib); + sprintf(buffer, "Distributed by %s.", _vm->_boot._distrib); font.drawString(&surf, buffer, 0, 1, 320, _TLIGHTRED, Graphics::kTextAlignCenter); } @@ -294,7 +294,7 @@ void intro_v3d::introInit() { surf.format = Graphics::PixelFormat::createFormatCLUT8(); char buffer[128]; - if (_vm->_boot.registered) + if (_vm->_boot._registered) sprintf(buffer, "%s Registered Version", _vm->getCopyrightString()); else sprintf(buffer,"%s Shareware Version", _vm->getCopyrightString()); @@ -305,8 +305,8 @@ void intro_v3d::introInit() { font.drawString(&surf, buffer, 0, 190, 320, _TBROWN, Graphics::kTextAlignCenter); - if ((*_vm->_boot.distrib != '\0') && (scumm_stricmp(_vm->_boot.distrib, "David P. Gray"))) { - sprintf(buffer, "Distributed by %s.", _vm->_boot.distrib); + if ((*_vm->_boot._distrib != '\0') && (scumm_stricmp(_vm->_boot._distrib, "David P. Gray"))) { + sprintf(buffer, "Distributed by %s.", _vm->_boot._distrib); font.drawString(&surf, buffer, 0, 0, 320, _TBROWN, Graphics::kTextAlignCenter); } @@ -325,7 +325,7 @@ void intro_v3d::introInit() { * Called every tick. Returns TRUE when complete */ bool intro_v3d::introPlay() { - if (_vm->getGameStatus().skipIntroFl) + if (_vm->getGameStatus()._skipIntroFl) return true; if (introTicks < getIntroSize()) { @@ -356,7 +356,7 @@ intro_v1w::~intro_v1w() { } void intro_v1w::preNewGame() { - _vm->getGameStatus().viewState = kViewIntroInit; + _vm->getGameStatus()._viewState = kViewIntroInit; } void intro_v1w::introInit() { @@ -416,7 +416,7 @@ void intro_v3w::introInit() { * Called every tick. Returns TRUE when complete */ bool intro_v3w::introPlay() { - if (_vm->getGameStatus().skipIntroFl) + if (_vm->getGameStatus()._skipIntroFl) return true; if (introTicks < getIntroSize()) { diff --git a/engines/hugo/inventory.cpp b/engines/hugo/inventory.cpp index 410c4e715c..151fe0ee13 100644 --- a/engines/hugo/inventory.cpp +++ b/engines/hugo/inventory.cpp @@ -231,7 +231,7 @@ void InventoryHandler::runInventory() { _vm->_screen->moveImage(_vm->_screen->getBackBuffer(), 0, 0, kXPix, kYPix, kXPix, _vm->_screen->getFrontBuffer(), 0, 0, kXPix); _vm->_object->updateImages(); // Add objects back into display list for restore _inventoryState = kInventoryOff; - gameStatus.viewState = kViewPlay; + gameStatus._viewState = kViewPlay; } break; case kInventoryDown: // Icon bar moving down diff --git a/engines/hugo/mouse.cpp b/engines/hugo/mouse.cpp index d2d5b59dae..323f362b10 100644 --- a/engines/hugo/mouse.cpp +++ b/engines/hugo/mouse.cpp @@ -154,7 +154,7 @@ void MouseHandler::processRightClick(const int16 objId, const int16 cx, const in status_t &gameStatus = _vm->getGameStatus(); - if (gameStatus.storyModeFl || _vm->_hero->pathType == kPathQuiet) // Make sure user has control + if (gameStatus._storyModeFl || _vm->_hero->_pathType == kPathQuiet) // Make sure user has control return; int16 inventObjId = _vm->_inventory->getInventoryObjId(); @@ -170,7 +170,7 @@ void MouseHandler::processRightClick(const int16 objId, const int16 cx, const in } else { // Clicked over viewport object object_t *obj = &_vm->_object->_objects[objId]; int16 x, y; - switch (obj->viewx) { // Where to walk to + switch (obj->_viewx) { // Where to walk to case -1: // Walk to object position if (_vm->_object->findObjectSpace(obj, &x, &y)) foundFl = _vm->_route->startRoute(kRouteGet, objId, x, y); @@ -181,8 +181,8 @@ void MouseHandler::processRightClick(const int16 objId, const int16 cx, const in _vm->_object->useObject(objId); // Pick up or use object break; default: // Walk to view point if possible - if (!_vm->_route->startRoute(kRouteGet, objId, obj->viewx, obj->viewy)) { - if (_vm->_hero->cycling == kCycleInvisible) // If invisible do + if (!_vm->_route->startRoute(kRouteGet, objId, obj->_viewx, obj->_viewy)) { + if (_vm->_hero->_cycling == kCycleInvisible) // If invisible do _vm->_object->useObject(objId); // immediate use else Utils::notifyBox(_vm->_text->getTextMouse(kMsNoWayText)); // Can't get there @@ -207,7 +207,7 @@ void MouseHandler::processLeftClick(const int16 objId, const int16 cx, const int status_t &gameStatus = _vm->getGameStatus(); - if (gameStatus.storyModeFl || _vm->_hero->pathType == kPathQuiet) // Make sure user has control + if (gameStatus._storyModeFl || _vm->_hero->_pathType == kPathQuiet) // Make sure user has control return; switch (objId) { @@ -254,7 +254,7 @@ void MouseHandler::processLeftClick(const int16 objId, const int16 cx, const int _vm->_object->lookObject(obj); } else { bool foundFl = false; // TRUE if route found to object - switch (obj->viewx) { // Clicked over viewport object + switch (obj->_viewx) { // Clicked over viewport object case -1: // Walk to object position if (_vm->_object->findObjectSpace(obj, &x, &y)) foundFl = _vm->_route->startRoute(kRouteLook, objId, x, y); @@ -265,8 +265,8 @@ void MouseHandler::processLeftClick(const int16 objId, const int16 cx, const int _vm->_object->lookObject(obj); break; default: // Walk to view point if possible - if (!_vm->_route->startRoute(kRouteLook, objId, obj->viewx, obj->viewy)) { - if (_vm->_hero->cycling == kCycleInvisible) // If invisible do + if (!_vm->_route->startRoute(kRouteLook, objId, obj->_viewx, obj->_viewy)) { + if (_vm->_hero->_cycling == kCycleInvisible) // If invisible do _vm->_object->lookObject(obj); // immediate decription else Utils::notifyBox(_vm->_text->getTextMouse(kMsNoWayText)); // Can't get there @@ -286,14 +286,14 @@ void MouseHandler::mouseHandler() { status_t &gameStatus = _vm->getGameStatus(); istate_t inventState = _vm->_inventory->getInventoryState(); - if ((gameStatus.viewState != kViewPlay) && (inventState != kInventoryActive)) + if ((gameStatus._viewState != kViewPlay) && (inventState != kInventoryActive)) return; int16 cx = getMouseX(); int16 cy = getMouseY(); -// gameStatus.cx = cx; // Save cursor coords -// gameStatus.cy = cy; +// gameStatus._cx = cx; // Save cursor coords +// gameStatus._cy = cy; // Don't process if outside client area if ((cx < 0) || (cx > kXPix) || (cy < kDibOffY) || (cy > kViewSizeY + kDibOffY)) @@ -309,14 +309,14 @@ void MouseHandler::mouseHandler() { } } - if (!gameStatus.gameOverFl) { + if (!gameStatus._gameOverFl) { if (objId == -1) // No match, check rest of view objId = _vm->_object->findObject(cx, cy); if (objId >= 0) { // Got a match // Display object name next to cursor (unless CURSOR_NOCHAR) // Note test for swapped hero name - const char *name = _vm->_text->getNoun(_vm->_object->_objects[(objId == kHeroIndex) ? _vm->_heroImage : objId].nounIndex, kCursorNameIndex); + const char *name = _vm->_text->getNoun(_vm->_object->_objects[(objId == kHeroIndex) ? _vm->_heroImage : objId]._nounIndex, kCursorNameIndex); if (name[0] != kCursorNochar) cursorText(name, cx, cy, U_FONT8, _TBRIGHTWHITE); @@ -378,7 +378,7 @@ void MouseHandler::loadHotspots(Common::ReadStream &in) { void MouseHandler::drawHotspots() const { for (int i = 0; _hotspots[i].screenIndex >= 0; i++) { hotspot_t *hotspot = &_hotspots[i]; - if (hotspot->screenIndex == _vm->_hero->screenIndex) + if (hotspot->screenIndex == _vm->_hero->_screenIndex) _vm->_screen->drawRectangle(false, hotspot->x1, hotspot->y1, hotspot->x2, hotspot->y2, _TLIGHTRED); } } diff --git a/engines/hugo/object.cpp b/engines/hugo/object.cpp index bc99abf410..92a04227d6 100644 --- a/engines/hugo/object.cpp +++ b/engines/hugo/object.cpp @@ -74,22 +74,22 @@ byte ObjectHandler::getFirstOverlay(uint16 index) const { } bool ObjectHandler::isCarried(int objIndex) const { - return _objects[objIndex].carriedFl; + return _objects[objIndex]._carriedFl; } void ObjectHandler::setCarry(int objIndex, bool val) { - _objects[objIndex].carriedFl = val; + _objects[objIndex]._carriedFl = val; } void ObjectHandler::setVelocity(int objIndex, int8 vx, int8 vy) { - _objects[objIndex].vx = vx; - _objects[objIndex].vy = vy; + _objects[objIndex]._vx = vx; + _objects[objIndex]._vy = vy; } void ObjectHandler::setPath(int objIndex, path_t pathType, int16 vxPath, int16 vyPath) { - _objects[objIndex].pathType = pathType; - _objects[objIndex].vxPath = vxPath; - _objects[objIndex].vyPath = vyPath; + _objects[objIndex]._pathType = pathType; + _objects[objIndex]._vxPath = vxPath; + _objects[objIndex]._vyPath = vyPath; } /** @@ -99,15 +99,15 @@ void ObjectHandler::saveSeq(object_t *obj) { debugC(1, kDebugObject, "saveSeq"); bool found = false; - for (int i = 0; !found && (i < obj->seqNumb); i++) { - seq_t *q = obj->seqList[i].seqPtr; - for (int j = 0; !found && (j < obj->seqList[i].imageNbr); j++) { - if (obj->currImagePtr == q) { + for (int i = 0; !found && (i < obj->_seqNumb); i++) { + seq_t *q = obj->_seqList[i]._seqPtr; + for (int j = 0; !found && (j < obj->_seqList[i]._imageNbr); j++) { + if (obj->_currImagePtr == q) { found = true; - obj->curSeqNum = i; - obj->curImageNum = j; + obj->_curSeqNum = i; + obj->_curImageNum = j; } else { - q = q->nextSeqPtr; + q = q->_nextSeqPtr; } } } @@ -119,10 +119,10 @@ void ObjectHandler::saveSeq(object_t *obj) { void ObjectHandler::restoreSeq(object_t *obj) { debugC(1, kDebugObject, "restoreSeq"); - seq_t *q = obj->seqList[obj->curSeqNum].seqPtr; - for (int j = 0; j < obj->curImageNum; j++) - q = q->nextSeqPtr; - obj->currImagePtr = q; + seq_t *q = obj->_seqList[obj->_curSeqNum]._seqPtr; + for (int j = 0; j < obj->_curImageNum; j++) + q = q->_nextSeqPtr; + obj->_currImagePtr = q; } /** @@ -137,33 +137,33 @@ void ObjectHandler::useObject(int16 objId) { object_t *obj = &_objects[objId]; // Ptr to object if (inventObjId == -1) { // Get or use objid directly - if ((obj->genericCmd & TAKE) || obj->objValue) // Get collectible item - sprintf(_vm->_line, "%s %s", _vm->_text->getVerb(_vm->_take, 0), _vm->_text->getNoun(obj->nounIndex, 0)); - else if (obj->cmdIndex != 0) // Use non-collectible item if able - sprintf(_vm->_line, "%s %s", _vm->_text->getVerb(_vm->_parser->getCmdDefaultVerbIdx(obj->cmdIndex), 0), _vm->_text->getNoun(obj->nounIndex, 0)); - else if ((verb = _vm->_parser->useBG(_vm->_text->getNoun(obj->nounIndex, 0))) != 0) - sprintf(_vm->_line, "%s %s", verb, _vm->_text->getNoun(obj->nounIndex, 0)); + if ((obj->_genericCmd & TAKE) || obj->_objValue) // Get collectible item + sprintf(_vm->_line, "%s %s", _vm->_text->getVerb(_vm->_take, 0), _vm->_text->getNoun(obj->_nounIndex, 0)); + else if (obj->_cmdIndex != 0) // Use non-collectible item if able + sprintf(_vm->_line, "%s %s", _vm->_text->getVerb(_vm->_parser->getCmdDefaultVerbIdx(obj->_cmdIndex), 0), _vm->_text->getNoun(obj->_nounIndex, 0)); + else if ((verb = _vm->_parser->useBG(_vm->_text->getNoun(obj->_nounIndex, 0))) != 0) + sprintf(_vm->_line, "%s %s", verb, _vm->_text->getNoun(obj->_nounIndex, 0)); else return; // Can't use object directly } else { // Use status.objid on objid // Default to first cmd verb - sprintf(_vm->_line, "%s %s %s", _vm->_text->getVerb(_vm->_parser->getCmdDefaultVerbIdx(_objects[inventObjId].cmdIndex), 0), - _vm->_text->getNoun(_objects[inventObjId].nounIndex, 0), - _vm->_text->getNoun(obj->nounIndex, 0)); + sprintf(_vm->_line, "%s %s %s", _vm->_text->getVerb(_vm->_parser->getCmdDefaultVerbIdx(_objects[inventObjId]._cmdIndex), 0), + _vm->_text->getNoun(_objects[inventObjId]._nounIndex, 0), + _vm->_text->getNoun(obj->_nounIndex, 0)); // Check valid use of objects and override verb if necessary - for (uses_t *use = _uses; use->objId != _numObj; use++) { - if (inventObjId == use->objId) { + for (uses_t *use = _uses; use->_objId != _numObj; use++) { + if (inventObjId == use->_objId) { // Look for secondary object, if found use matching verb bool foundFl = false; - for (target_t *target = use->targets; target->nounIndex != 0; target++) - if (target->nounIndex == obj->nounIndex) { + for (target_t *target = use->_targets; target->_nounIndex != 0; target++) + if (target->_nounIndex == obj->_nounIndex) { foundFl = true; - sprintf(_vm->_line, "%s %s %s", _vm->_text->getVerb(target->verbIndex, 0), - _vm->_text->getNoun(_objects[inventObjId].nounIndex, 0), - _vm->_text->getNoun(obj->nounIndex, 0)); + sprintf(_vm->_line, "%s %s %s", _vm->_text->getVerb(target->_verbIndex, 0), + _vm->_text->getNoun(_objects[inventObjId]._nounIndex, 0), + _vm->_text->getNoun(obj->_nounIndex, 0)); } // No valid use of objects found, print failure string @@ -171,7 +171,7 @@ void ObjectHandler::useObject(int16 objId) { // Deselect dragged icon if inventory not active if (_vm->_inventory->getInventoryState() != kInventoryActive) _vm->_screen->resetInventoryObjId(); - Utils::notifyBox(_vm->_text->getTextData(use->dataIndex)); + Utils::notifyBox(_vm->_text->getTextData(use->_dataIndex)); return; } } @@ -199,26 +199,26 @@ int16 ObjectHandler::findObject(uint16 x, uint16 y) { // Check objects on screen for (int i = 0; i < _numObj; i++, obj++) { // Object must be in current screen and "useful" - if (obj->screenIndex == *_vm->_screen_p && (obj->genericCmd || obj->objValue || obj->cmdIndex)) { - seq_t *curImage = obj->currImagePtr; + if (obj->_screenIndex == *_vm->_screen_p && (obj->_genericCmd || obj->_objValue || obj->_cmdIndex)) { + seq_t *curImage = obj->_currImagePtr; // Object must have a visible image... - if (curImage != 0 && obj->cycling != kCycleInvisible) { + if (curImage != 0 && obj->_cycling != kCycleInvisible) { // If cursor inside object - if (x >= (uint16)obj->x && x <= obj->x + curImage->x2 && y >= (uint16)obj->y && y <= obj->y + curImage->y2) { + if (x >= (uint16)obj->_x && x <= obj->_x + curImage->_x2 && y >= (uint16)obj->_y && y <= obj->_y + curImage->_y2) { // If object is closest so far - if (obj->y + curImage->y2 > y2Max) { - y2Max = obj->y + curImage->y2; + if (obj->_y + curImage->_y2 > y2Max) { + y2Max = obj->_y + curImage->_y2; objIndex = i; // Found an object! } } } else { // ...or a dummy object that has a hotspot rectangle - if (curImage == 0 && obj->vxPath != 0 && !obj->carriedFl) { + if (curImage == 0 && obj->_vxPath != 0 && !obj->_carriedFl) { // If cursor inside special rectangle - if ((int16)x >= obj->oldx && (int16)x < obj->oldx + obj->vxPath && (int16)y >= obj->oldy && (int16)y < obj->oldy + obj->vyPath) { + if ((int16)x >= obj->_oldx && (int16)x < obj->_oldx + obj->_vxPath && (int16)y >= obj->_oldy && (int16)y < obj->_oldy + obj->_vyPath) { // If object is closest so far - if (obj->oldy + obj->vyPath - 1 > (int16)y2Max) { - y2Max = obj->oldy + obj->vyPath - 1; + if (obj->_oldy + obj->_vyPath - 1 > (int16)y2Max) { + y2Max = obj->_oldy + obj->_vyPath - 1; objIndex = i; // Found an object! } } @@ -240,7 +240,7 @@ void ObjectHandler::lookObject(object_t *obj) { // Hero swapped - look at other obj = &_objects[_vm->_heroImage]; - _vm->_parser->command("%s %s", _vm->_text->getVerb(_vm->_look, 0), _vm->_text->getNoun(obj->nounIndex, 0)); + _vm->_parser->command("%s %s", _vm->_text->getVerb(_vm->_look, 0), _vm->_text->getNoun(obj->_nounIndex, 0)); } /** @@ -249,26 +249,26 @@ void ObjectHandler::lookObject(object_t *obj) { void ObjectHandler::freeObjects() { debugC(1, kDebugObject, "freeObjects"); - if (_vm->_hero != 0 && _vm->_hero->seqList[0].seqPtr != 0) { + if (_vm->_hero != 0 && _vm->_hero->_seqList[0]._seqPtr != 0) { // Free all sequence lists and image data for (int16 i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; - for (int16 j = 0; j < obj->seqNumb; j++) { - seq_t *seq = obj->seqList[j].seqPtr; + for (int16 j = 0; j < obj->_seqNumb; j++) { + seq_t *seq = obj->_seqList[j]._seqPtr; seq_t *next; if (seq == 0) // Failure during database load break; - if (seq->imagePtr != 0) { - free(seq->imagePtr); - seq->imagePtr = 0; + if (seq->_imagePtr != 0) { + free(seq->_imagePtr); + seq->_imagePtr = 0; } - seq = seq->nextSeqPtr; - while (seq != obj->seqList[j].seqPtr) { - if (seq->imagePtr != 0) { - free(seq->imagePtr); - seq->imagePtr = 0; + seq = seq->_nextSeqPtr; + while (seq != obj->_seqList[j]._seqPtr) { + if (seq->_imagePtr != 0) { + free(seq->_imagePtr); + seq->_imagePtr = 0; } - next = seq->nextSeqPtr; + next = seq->_nextSeqPtr; free(seq); seq = next; } @@ -279,13 +279,13 @@ void ObjectHandler::freeObjects() { if (_uses) { for (int16 i = 0; i < _usesSize; i++) - free(_uses[i].targets); + free(_uses[i]._targets); free(_uses); } for (int16 i = 0; i < _objCount; i++) { - free(_objects[i].stateDataIndex); - _objects[i].stateDataIndex = 0; + free(_objects[i]._stateDataIndex); + _objects[i]._stateDataIndex = 0; } free(_objects); @@ -307,20 +307,20 @@ int ObjectHandler::y2comp(const void *a, const void *b) { // Why does qsort try the same indexes? return 0; - if (p1->priority == kPriorityBackground) + if (p1->_priority == kPriorityBackground) return -1; - if (p2->priority == kPriorityBackground) + if (p2->_priority == kPriorityBackground) return 1; - if (p1->priority == kPriorityForeground) + if (p1->_priority == kPriorityForeground) return 1; - if (p2->priority == kPriorityForeground) + if (p2->_priority == kPriorityForeground) return -1; - int ay2 = p1->y + p1->currImagePtr->y2; - int by2 = p2->y + p2->currImagePtr->y2; + int ay2 = p1->_y + p1->_currImagePtr->_y2; + int by2 = p2->_y + p2->_currImagePtr->_y2; return ay2 - by2; } @@ -332,7 +332,7 @@ bool ObjectHandler::isCarrying(uint16 wordIndex) { debugC(1, kDebugObject, "isCarrying(%d)", wordIndex); for (int i = 0; i < _numObj; i++) { - if ((wordIndex == _objects[i].nounIndex) && _objects[i].carriedFl) + if ((wordIndex == _objects[i]._nounIndex) && _objects[i]._carriedFl) return true; } return false; @@ -346,10 +346,10 @@ void ObjectHandler::showTakeables() { for (int j = 0; j < _numObj; j++) { object_t *obj = &_objects[j]; - if ((obj->cycling != kCycleInvisible) && - (obj->screenIndex == *_vm->_screen_p) && - (((TAKE & obj->genericCmd) == TAKE) || obj->objValue)) { - Utils::notifyBox(Common::String::format("You can also see:\n%s.", _vm->_text->getNoun(obj->nounIndex, LOOK_NAME))); + if ((obj->_cycling != kCycleInvisible) && + (obj->_screenIndex == *_vm->_screen_p) && + (((TAKE & obj->_genericCmd) == TAKE) || obj->_objValue)) { + Utils::notifyBox(Common::String::format("You can also see:\n%s.", _vm->_text->getNoun(obj->_nounIndex, LOOK_NAME))); } } } @@ -360,19 +360,19 @@ void ObjectHandler::showTakeables() { bool ObjectHandler::findObjectSpace(object_t *obj, int16 *destx, int16 *desty) { debugC(1, kDebugObject, "findObjectSpace(obj, %d, %d)", *destx, *desty); - seq_t *curImage = obj->currImagePtr; - int16 y = obj->y + curImage->y2 - 1; + seq_t *curImage = obj->_currImagePtr; + int16 y = obj->_y + curImage->_y2 - 1; bool foundFl = true; // Try left rear corner - for (int16 x = *destx = obj->x + curImage->x1; x < *destx + kHeroMaxWidth; x++) { + for (int16 x = *destx = obj->_x + curImage->_x1; x < *destx + kHeroMaxWidth; x++) { 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++) { + for (int16 x = *destx = obj->_x + curImage->_x2 - kHeroMaxWidth + 1; x <= obj->_x + (int16)curImage->_x2; x++) { if (checkBoundary(x, y)) foundFl = false; } @@ -381,7 +381,7 @@ bool ObjectHandler::findObjectSpace(object_t *obj, int16 *destx, int16 *desty) { if (!foundFl) { // Try left front corner foundFl = true; y += 2; - for (int16 x = *destx = obj->x + curImage->x1; x < *destx + kHeroMaxWidth; x++) { + for (int16 x = *destx = obj->_x + curImage->_x1; x < *destx + kHeroMaxWidth; x++) { if (checkBoundary(x, y)) foundFl = false; } @@ -389,7 +389,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++) { + for (int16 x = *destx = obj->_x + curImage->_x2 - kHeroMaxWidth + 1; x <= obj->_x + (int16)curImage->_x2; x++) { if (checkBoundary(x, y)) foundFl = false; } @@ -400,13 +400,13 @@ bool ObjectHandler::findObjectSpace(object_t *obj, int16 *destx, int16 *desty) { } void ObjectHandler::readUse(Common::ReadStream &in, uses_t &curUse) { - curUse.objId = in.readSint16BE(); - curUse.dataIndex = in.readUint16BE(); + curUse._objId = in.readSint16BE(); + curUse._dataIndex = in.readUint16BE(); uint16 numSubElem = in.readUint16BE(); - curUse.targets = (target_t *)malloc(sizeof(target_t) * numSubElem); + curUse._targets = (target_t *)malloc(sizeof(target_t) * numSubElem); for (int j = 0; j < numSubElem; j++) { - curUse.targets[j].nounIndex = in.readUint16BE(); - curUse.targets[j].verbIndex = in.readUint16BE(); + curUse._targets[j]._nounIndex = in.readUint16BE(); + curUse._targets[j]._verbIndex = in.readUint16BE(); } } /** @@ -414,7 +414,7 @@ void ObjectHandler::readUse(Common::ReadStream &in, uses_t &curUse) { */ void ObjectHandler::loadObjectUses(Common::ReadStream &in) { uses_t tmpUse; - tmpUse.targets = 0; + tmpUse._targets = 0; //Read _uses for (int varnt = 0; varnt < _vm->_numVariant; varnt++) { @@ -429,68 +429,68 @@ void ObjectHandler::loadObjectUses(Common::ReadStream &in) { readUse(in, _uses[i]); else { readUse(in, tmpUse); - free(tmpUse.targets); - tmpUse.targets = 0; + free(tmpUse._targets); + tmpUse._targets = 0; } } } } void ObjectHandler::readObject(Common::ReadStream &in, object_t &curObject) { - curObject.nounIndex = in.readUint16BE(); - curObject.dataIndex = in.readUint16BE(); + curObject._nounIndex = in.readUint16BE(); + curObject._dataIndex = in.readUint16BE(); uint16 numSubElem = in.readUint16BE(); if (numSubElem == 0) - curObject.stateDataIndex = 0; + curObject._stateDataIndex = 0; else - curObject.stateDataIndex = (uint16 *)malloc(sizeof(uint16) * numSubElem); + curObject._stateDataIndex = (uint16 *)malloc(sizeof(uint16) * numSubElem); for (int j = 0; j < numSubElem; j++) - curObject.stateDataIndex[j] = in.readUint16BE(); - - curObject.pathType = (path_t) in.readSint16BE(); - curObject.vxPath = in.readSint16BE(); - curObject.vyPath = in.readSint16BE(); - curObject.actIndex = in.readUint16BE(); - curObject.seqNumb = in.readByte(); - curObject.currImagePtr = 0; - - if (curObject.seqNumb == 0) { - curObject.seqList[0].imageNbr = 0; - curObject.seqList[0].seqPtr = 0; + curObject._stateDataIndex[j] = in.readUint16BE(); + + curObject._pathType = (path_t) in.readSint16BE(); + curObject._vxPath = in.readSint16BE(); + curObject._vyPath = in.readSint16BE(); + curObject._actIndex = in.readUint16BE(); + curObject._seqNumb = in.readByte(); + curObject._currImagePtr = 0; + + if (curObject._seqNumb == 0) { + curObject._seqList[0]._imageNbr = 0; + curObject._seqList[0]._seqPtr = 0; } - for (int j = 0; j < curObject.seqNumb; j++) { - curObject.seqList[j].imageNbr = in.readUint16BE(); - curObject.seqList[j].seqPtr = 0; + for (int j = 0; j < curObject._seqNumb; j++) { + curObject._seqList[j]._imageNbr = in.readUint16BE(); + curObject._seqList[j]._seqPtr = 0; } - curObject.cycling = (cycle_t)in.readByte(); - curObject.cycleNumb = in.readByte(); - curObject.frameInterval = in.readByte(); - curObject.frameTimer = in.readByte(); - curObject.radius = in.readByte(); - curObject.screenIndex = in.readByte(); - curObject.x = in.readSint16BE(); - curObject.y = in.readSint16BE(); - curObject.oldx = in.readSint16BE(); - curObject.oldy = in.readSint16BE(); - curObject.vx = in.readByte(); - curObject.vy = in.readByte(); - curObject.objValue = in.readByte(); - curObject.genericCmd = in.readSint16BE(); - curObject.cmdIndex = in.readUint16BE(); - curObject.carriedFl = (in.readByte() != 0); - curObject.state = in.readByte(); - curObject.verbOnlyFl = (in.readByte() != 0); - curObject.priority = in.readByte(); - curObject.viewx = in.readSint16BE(); - curObject.viewy = in.readSint16BE(); - curObject.direction = in.readSint16BE(); - curObject.curSeqNum = in.readByte(); - curObject.curImageNum = in.readByte(); - curObject.oldvx = in.readByte(); - curObject.oldvy = in.readByte(); + curObject._cycling = (cycle_t)in.readByte(); + curObject._cycleNumb = in.readByte(); + curObject._frameInterval = in.readByte(); + curObject._frameTimer = in.readByte(); + curObject._radius = in.readByte(); + curObject._screenIndex = in.readByte(); + curObject._x = in.readSint16BE(); + curObject._y = in.readSint16BE(); + curObject._oldx = in.readSint16BE(); + curObject._oldy = in.readSint16BE(); + curObject._vx = in.readByte(); + curObject._vy = in.readByte(); + curObject._objValue = in.readByte(); + curObject._genericCmd = in.readSint16BE(); + curObject._cmdIndex = in.readUint16BE(); + curObject._carriedFl = (in.readByte() != 0); + curObject._state = in.readByte(); + curObject._verbOnlyFl = (in.readByte() != 0); + curObject._priority = in.readByte(); + curObject._viewx = in.readSint16BE(); + curObject._viewy = in.readSint16BE(); + curObject._direction = in.readSint16BE(); + curObject._curSeqNum = in.readByte(); + curObject._curImageNum = in.readByte(); + curObject._oldvx = in.readByte(); + curObject._oldvy = in.readByte(); } /** * Load ObjectArr from Hugo.dat @@ -498,7 +498,7 @@ void ObjectHandler::readObject(Common::ReadStream &in, object_t &curObject) { void ObjectHandler::loadObjectArr(Common::ReadStream &in) { debugC(6, kDebugObject, "loadObject(&in)"); object_t tmpObject; - tmpObject.stateDataIndex = 0; + tmpObject._stateDataIndex = 0; for (int varnt = 0; varnt < _vm->_numVariant; varnt++) { uint16 numElem = in.readUint16BE(); @@ -514,8 +514,8 @@ void ObjectHandler::loadObjectArr(Common::ReadStream &in) { else { // Skip over uneeded objects. readObject(in, tmpObject); - free(tmpObject.stateDataIndex); - tmpObject.stateDataIndex = 0; + free(tmpObject._stateDataIndex); + tmpObject._stateDataIndex = 0; } } } @@ -528,7 +528,7 @@ void ObjectHandler::loadObjectArr(Common::ReadStream &in) { void ObjectHandler::setCarriedScreen(int screenNum) { for (int i = kHeroIndex + 1; i < _numObj; i++) {// Any others if (isCarried(i)) // being carried - _objects[i].screenIndex = screenNum; + _objects[i]._screenIndex = screenNum; } } @@ -562,30 +562,30 @@ void ObjectHandler::saveObjects(Common::WriteStream *out) { // Save where curr_seq_p is pointing to saveSeq(&_objects[i]); - out->writeByte(_objects[i].pathType); - out->writeSint16BE(_objects[i].vxPath); - out->writeSint16BE(_objects[i].vyPath); - out->writeByte(_objects[i].cycling); - out->writeByte(_objects[i].cycleNumb); - out->writeByte(_objects[i].frameTimer); - out->writeByte(_objects[i].screenIndex); - out->writeSint16BE(_objects[i].x); - out->writeSint16BE(_objects[i].y); - out->writeSint16BE(_objects[i].oldx); - out->writeSint16BE(_objects[i].oldy); - out->writeSByte(_objects[i].vx); - out->writeSByte(_objects[i].vy); - out->writeByte(_objects[i].objValue); - out->writeByte((_objects[i].carriedFl) ? 1 : 0); - out->writeByte(_objects[i].state); - out->writeByte(_objects[i].priority); - out->writeSint16BE(_objects[i].viewx); - out->writeSint16BE(_objects[i].viewy); - out->writeSint16BE(_objects[i].direction); - out->writeByte(_objects[i].curSeqNum); - out->writeByte(_objects[i].curImageNum); - out->writeSByte(_objects[i].oldvx); - out->writeSByte(_objects[i].oldvy); + out->writeByte(_objects[i]._pathType); + out->writeSint16BE(_objects[i]._vxPath); + out->writeSint16BE(_objects[i]._vyPath); + out->writeByte(_objects[i]._cycling); + out->writeByte(_objects[i]._cycleNumb); + out->writeByte(_objects[i]._frameTimer); + out->writeByte(_objects[i]._screenIndex); + out->writeSint16BE(_objects[i]._x); + out->writeSint16BE(_objects[i]._y); + out->writeSint16BE(_objects[i]._oldx); + out->writeSint16BE(_objects[i]._oldy); + out->writeSByte(_objects[i]._vx); + out->writeSByte(_objects[i]._vy); + out->writeByte(_objects[i]._objValue); + out->writeByte((_objects[i]._carriedFl) ? 1 : 0); + out->writeByte(_objects[i]._state); + out->writeByte(_objects[i]._priority); + out->writeSint16BE(_objects[i]._viewx); + out->writeSint16BE(_objects[i]._viewy); + out->writeSint16BE(_objects[i]._direction); + out->writeByte(_objects[i]._curSeqNum); + out->writeByte(_objects[i]._curImageNum); + out->writeSByte(_objects[i]._oldvx); + out->writeSByte(_objects[i]._oldvy); } } @@ -594,30 +594,30 @@ void ObjectHandler::saveObjects(Common::WriteStream *out) { */ void ObjectHandler::restoreObjects(Common::SeekableReadStream *in) { for (int i = 0; i < _numObj; i++) { - _objects[i].pathType = (path_t) in->readByte(); - _objects[i].vxPath = in->readSint16BE(); - _objects[i].vyPath = in->readSint16BE(); - _objects[i].cycling = (cycle_t) in->readByte(); - _objects[i].cycleNumb = in->readByte(); - _objects[i].frameTimer = in->readByte(); - _objects[i].screenIndex = in->readByte(); - _objects[i].x = in->readSint16BE(); - _objects[i].y = in->readSint16BE(); - _objects[i].oldx = in->readSint16BE(); - _objects[i].oldy = in->readSint16BE(); - _objects[i].vx = in->readSByte(); - _objects[i].vy = in->readSByte(); - _objects[i].objValue = in->readByte(); - _objects[i].carriedFl = (in->readByte() == 1); - _objects[i].state = in->readByte(); - _objects[i].priority = in->readByte(); - _objects[i].viewx = in->readSint16BE(); - _objects[i].viewy = in->readSint16BE(); - _objects[i].direction = in->readSint16BE(); - _objects[i].curSeqNum = in->readByte(); - _objects[i].curImageNum = in->readByte(); - _objects[i].oldvx = in->readSByte(); - _objects[i].oldvy = in->readSByte(); + _objects[i]._pathType = (path_t) in->readByte(); + _objects[i]._vxPath = in->readSint16BE(); + _objects[i]._vyPath = in->readSint16BE(); + _objects[i]._cycling = (cycle_t) in->readByte(); + _objects[i]._cycleNumb = in->readByte(); + _objects[i]._frameTimer = in->readByte(); + _objects[i]._screenIndex = in->readByte(); + _objects[i]._x = in->readSint16BE(); + _objects[i]._y = in->readSint16BE(); + _objects[i]._oldx = in->readSint16BE(); + _objects[i]._oldy = in->readSint16BE(); + _objects[i]._vx = in->readSByte(); + _objects[i]._vy = in->readSByte(); + _objects[i]._objValue = in->readByte(); + _objects[i]._carriedFl = (in->readByte() == 1); + _objects[i]._state = in->readByte(); + _objects[i]._priority = in->readByte(); + _objects[i]._viewx = in->readSint16BE(); + _objects[i]._viewy = in->readSint16BE(); + _objects[i]._direction = in->readSint16BE(); + _objects[i]._curSeqNum = in->readByte(); + _objects[i]._curImageNum = in->readByte(); + _objects[i]._oldvx = in->readSByte(); + _objects[i]._oldvy = in->readSByte(); } } @@ -627,7 +627,7 @@ void ObjectHandler::restoreObjects(Common::SeekableReadStream *in) { int ObjectHandler::calcMaxScore() { int score = 0; for (int i = 0; i < _numObj; i++) - score += _objects[i].objValue; + score += _objects[i]._objValue; return score; } @@ -788,26 +788,26 @@ void ObjectHandler::boundaryCollision(object_t *obj) { if (obj == _vm->_hero) { // Hotspots only relevant to HERO int x; - if (obj->vx > 0) - x = obj->x + obj->currImagePtr->x2; + if (obj->_vx > 0) + x = obj->_x + obj->_currImagePtr->_x2; else - x = obj->x + obj->currImagePtr->x1; - int y = obj->y + obj->currImagePtr->y2; + x = obj->_x + obj->_currImagePtr->_x1; + int y = obj->_y + obj->_currImagePtr->_y2; - int16 index = _vm->_mouse->findExit(x, y, obj->screenIndex); + int16 index = _vm->_mouse->findExit(x, y, obj->_screenIndex); if (index >= 0) _vm->_scheduler->insertActionList(_vm->_mouse->getHotspotActIndex(index)); } else { // Check whether an object collided with HERO - int dx = _vm->_hero->x + _vm->_hero->currImagePtr->x1 - obj->x - obj->currImagePtr->x1; - int dy = _vm->_hero->y + _vm->_hero->currImagePtr->y2 - obj->y - obj->currImagePtr->y2; + int dx = _vm->_hero->_x + _vm->_hero->_currImagePtr->_x1 - obj->_x - obj->_currImagePtr->_x1; + int dy = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2 - obj->_y - obj->_currImagePtr->_y2; // If object's radius is infinity, use a closer value - int8 radius = obj->radius; + int8 radius = obj->_radius; if (radius < 0) radius = kStepDx * 2; if ((abs(dx) <= radius) && (abs(dy) <= radius)) - _vm->_scheduler->insertActionList(obj->actIndex); + _vm->_scheduler->insertActionList(obj->_actIndex); } } diff --git a/engines/hugo/object.h b/engines/hugo/object.h index 84c20db041..8f8043dbbc 100644 --- a/engines/hugo/object.h +++ b/engines/hugo/object.h @@ -35,14 +35,14 @@ namespace Hugo { struct target_t { // Secondary target for action - uint16 nounIndex; // Secondary object - uint16 verbIndex; // Action on secondary object + uint16 _nounIndex; // Secondary object + uint16 _verbIndex; // Action on secondary object }; struct uses_t { // Define uses of certain objects - int16 objId; // Primary object - uint16 dataIndex; // String if no secondary object matches - target_t *targets; // List of secondary targets + int16 _objId; // Primary object + uint16 _dataIndex; // String if no secondary object matches + target_t *_targets; // List of secondary targets }; class ObjectHandler { diff --git a/engines/hugo/object_v1d.cpp b/engines/hugo/object_v1d.cpp index 831dc88dea..7b8f90e189 100644 --- a/engines/hugo/object_v1d.cpp +++ b/engines/hugo/object_v1d.cpp @@ -64,7 +64,7 @@ void ObjectHandler_v1d::updateImages() { for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; - if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling >= kCycleAlmostInvisible)) + if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling >= kCycleAlmostInvisible)) objindex[num_objs++] = i; } @@ -75,27 +75,27 @@ void ObjectHandler_v1d::updateImages() { for (int i = 0; i < num_objs; i++) { object_t *obj = &_objects[objindex[i]]; // Count down inter-frame timer - if (obj->frameTimer) - obj->frameTimer--; + if (obj->_frameTimer) + obj->_frameTimer--; - if (obj->cycling > kCycleAlmostInvisible) { // Only if visible - switch (obj->cycling) { + if (obj->_cycling > kCycleAlmostInvisible) { // Only if visible + switch (obj->_cycling) { case kCycleNotCycling: - _vm->_screen->displayFrame(obj->x, obj->y, obj->currImagePtr, false); + _vm->_screen->displayFrame(obj->_x, obj->_y, obj->_currImagePtr, false); break; case kCycleForward: - if (obj->frameTimer) // Not time to see next frame yet - _vm->_screen->displayFrame(obj->x, obj->y, obj->currImagePtr, false); + if (obj->_frameTimer) // Not time to see next frame yet + _vm->_screen->displayFrame(obj->_x, obj->_y, obj->_currImagePtr, false); else - _vm->_screen->displayFrame(obj->x, obj->y, obj->currImagePtr->nextSeqPtr, false); + _vm->_screen->displayFrame(obj->_x, obj->_y, obj->_currImagePtr->_nextSeqPtr, false); break; case kCycleBackward: { - seq_t *seqPtr = obj->currImagePtr; - if (!obj->frameTimer) { // Show next frame - while (seqPtr->nextSeqPtr != obj->currImagePtr) - seqPtr = seqPtr->nextSeqPtr; + seq_t *seqPtr = obj->_currImagePtr; + if (!obj->_frameTimer) { // Show next frame + while (seqPtr->_nextSeqPtr != obj->_currImagePtr) + seqPtr = seqPtr->_nextSeqPtr; } - _vm->_screen->displayFrame(obj->x, obj->y, seqPtr, false); + _vm->_screen->displayFrame(obj->_x, obj->_y, seqPtr, false); break; } default: @@ -109,28 +109,28 @@ void ObjectHandler_v1d::updateImages() { // Cycle any animating objects for (int i = 0; i < num_objs; i++) { object_t *obj = &_objects[objindex[i]]; - if (obj->cycling != kCycleInvisible) { + if (obj->_cycling != kCycleInvisible) { // Only if it's visible - if (obj->cycling == kCycleAlmostInvisible) - obj->cycling = kCycleInvisible; + if (obj->_cycling == kCycleAlmostInvisible) + obj->_cycling = kCycleInvisible; // Now Rotate to next picture in sequence - switch (obj->cycling) { + switch (obj->_cycling) { case kCycleNotCycling: break; case kCycleForward: - if (!obj->frameTimer) { + if (!obj->_frameTimer) { // Time to step to next frame - obj->currImagePtr = obj->currImagePtr->nextSeqPtr; + obj->_currImagePtr = obj->_currImagePtr->_nextSeqPtr; // Find out if this is last frame of sequence // If so, reset frame_timer and decrement n_cycle - if (obj->frameInterval || obj->cycleNumb) { - obj->frameTimer = obj->frameInterval; - for (int j = 0; j < obj->seqNumb; j++) { - if (obj->currImagePtr->nextSeqPtr == obj->seqList[j].seqPtr) { - if (obj->cycleNumb) { // Decr cycleNumb if Non-continous - if (!--obj->cycleNumb) - obj->cycling = kCycleNotCycling; + if (obj->_frameInterval || obj->_cycleNumb) { + obj->_frameTimer = obj->_frameInterval; + for (int j = 0; j < obj->_seqNumb; j++) { + if (obj->_currImagePtr->_nextSeqPtr == obj->_seqList[j]._seqPtr) { + if (obj->_cycleNumb) { // Decr cycleNumb if Non-continous + if (!--obj->_cycleNumb) + obj->_cycling = kCycleNotCycling; } } } @@ -138,20 +138,20 @@ void ObjectHandler_v1d::updateImages() { } break; case kCycleBackward: { - if (!obj->frameTimer) { + if (!obj->_frameTimer) { // Time to step to prev frame - seq_t *seqPtr = obj->currImagePtr; - while (obj->currImagePtr->nextSeqPtr != seqPtr) - obj->currImagePtr = obj->currImagePtr->nextSeqPtr; + seq_t *seqPtr = obj->_currImagePtr; + while (obj->_currImagePtr->_nextSeqPtr != seqPtr) + obj->_currImagePtr = obj->_currImagePtr->_nextSeqPtr; // Find out if this is first frame of sequence // If so, reset frame_timer and decrement n_cycle - if (obj->frameInterval || obj->cycleNumb) { - obj->frameTimer = obj->frameInterval; - for (int j = 0; j < obj->seqNumb; j++) { - if (obj->currImagePtr == obj->seqList[j].seqPtr) { - if (obj->cycleNumb){ // Decr cycleNumb if Non-continous - if (!--obj->cycleNumb) - obj->cycling = kCycleNotCycling; + if (obj->_frameInterval || obj->_cycleNumb) { + obj->_frameTimer = obj->_frameInterval; + for (int j = 0; j < obj->_seqNumb; j++) { + if (obj->_currImagePtr == obj->_seqList[j]._seqPtr) { + if (obj->_cycleNumb){ // Decr cycleNumb if Non-continous + if (!--obj->_cycleNumb) + obj->_cycling = kCycleNotCycling; } } } @@ -162,8 +162,8 @@ void ObjectHandler_v1d::updateImages() { default: break; } - obj->oldx = obj->x; - obj->oldy = obj->y; + obj->_oldx = obj->_x; + obj->_oldy = obj->_y; } } } @@ -184,161 +184,161 @@ void ObjectHandler_v1d::moveObjects() { // Don't store foreground or background objects for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object - seq_t *currImage = obj->currImagePtr; // Get ptr to current image - if (obj->screenIndex == *_vm->_screen_p) { - switch (obj->pathType) { + seq_t *currImage = obj->_currImagePtr; // Get ptr to current image + if (obj->_screenIndex == *_vm->_screen_p) { + switch (obj->_pathType) { case kPathChase: { // Allowable motion wrt boundary - int dx = _vm->_hero->x + _vm->_hero->currImagePtr->x1 - obj->x - currImage->x1; - int dy = _vm->_hero->y + _vm->_hero->currImagePtr->y2 - obj->y - currImage->y2 - 1; + int dx = _vm->_hero->_x + _vm->_hero->_currImagePtr->_x1 - obj->_x - currImage->_x1; + int dy = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2 - obj->_y - currImage->_y2 - 1; if (abs(dx) <= 1) - obj->vx = 0; + obj->_vx = 0; else - obj->vx = (dx > 0) ? MIN(dx, obj->vxPath) : MAX(dx, -obj->vxPath); + obj->_vx = (dx > 0) ? MIN(dx, obj->_vxPath) : MAX(dx, -obj->_vxPath); if (abs(dy) <= 1) - obj->vy = 0; + obj->_vy = 0; else - obj->vy = (dy > 0) ? MIN(dy, obj->vyPath) : MAX(dy, -obj->vyPath); + obj->_vy = (dy > 0) ? MIN(dy, obj->_vyPath) : MAX(dy, -obj->_vyPath); // Set first image in sequence (if multi-seq object) - if (obj->seqNumb == 4) { - if (!obj->vx) { // Got 4 directions - if (obj->vx != obj->oldvx) {// vx just stopped + if (obj->_seqNumb == 4) { + if (!obj->_vx) { // Got 4 directions + if (obj->_vx != obj->_oldvx) {// vx just stopped if (dy > 0) - obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_DOWN]._seqPtr; else - obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_UP]._seqPtr; } - } else if (obj->vx != obj->oldvx) { + } else if (obj->_vx != obj->_oldvx) { if (dx > 0) - obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr; else - obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr; } } - if (obj->vx || obj->vy) { - if (obj->seqNumb > 1) - obj->cycling = kCycleForward; + if (obj->_vx || obj->_vy) { + if (obj->_seqNumb > 1) + obj->_cycling = kCycleForward; } else { - obj->cycling = kCycleNotCycling; + obj->_cycling = kCycleNotCycling; boundaryCollision(obj); // Must have got hero! } - obj->oldvx = obj->vx; - obj->oldvy = obj->vy; - currImage = obj->currImagePtr; // Get (new) ptr to current image + obj->_oldvx = obj->_vx; + obj->_oldvy = obj->_vy; + currImage = obj->_currImagePtr; // Get (new) ptr to current image break; } case kPathWander: if (!_vm->_rnd->getRandomNumber(3 * _vm->_normalTPS)) { // Kick on random interval - obj->vx = _vm->_rnd->getRandomNumber(obj->vxPath << 1) - obj->vxPath; - obj->vy = _vm->_rnd->getRandomNumber(obj->vyPath << 1) - obj->vyPath; + obj->_vx = _vm->_rnd->getRandomNumber(obj->_vxPath << 1) - obj->_vxPath; + obj->_vy = _vm->_rnd->getRandomNumber(obj->_vyPath << 1) - obj->_vyPath; // Set first image in sequence (if multi-seq object) - if (obj->seqNumb > 1) { - if (!obj->vx && (obj->seqNumb > 2)) { - if (obj->vx != obj->oldvx) { // vx just stopped - if (obj->vy > 0) - obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr; + if (obj->_seqNumb > 1) { + if (!obj->_vx && (obj->_seqNumb > 2)) { + if (obj->_vx != obj->_oldvx) { // vx just stopped + if (obj->_vy > 0) + obj->_currImagePtr = obj->_seqList[SEQ_DOWN]._seqPtr; else - obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_UP]._seqPtr; } - } else if (obj->vx != obj->oldvx) { - if (obj->vx > 0) - obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr; + } else if (obj->_vx != obj->_oldvx) { + if (obj->_vx > 0) + obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr; else - obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr; } - if (obj->vx || obj->vy) - obj->cycling = kCycleForward; + if (obj->_vx || obj->_vy) + obj->_cycling = kCycleForward; else - obj->cycling = kCycleNotCycling; + obj->_cycling = kCycleNotCycling; } - obj->oldvx = obj->vx; - obj->oldvy = obj->vy; - currImage = obj->currImagePtr; // Get (new) ptr to current image + obj->_oldvx = obj->_vx; + obj->_oldvy = obj->_vy; + currImage = obj->_currImagePtr; // Get (new) ptr to current image } break; default: ; // Really, nothing } // Store boundaries - if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating)) - storeBoundary(obj->x + currImage->x1, obj->x + currImage->x2, obj->y + currImage->y2); + if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) + storeBoundary(obj->_x + currImage->_x1, obj->_x + currImage->_x2, obj->_y + currImage->_y2); } } // Move objects, allowing for boundaries for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object - if ((obj->screenIndex == *_vm->_screen_p) && (obj->vx || obj->vy)) { + if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_vx || obj->_vy)) { // Only process if it's moving // Do object movement. Delta_x,y return allowed movement in x,y // to move as close to a boundary as possible without crossing it. - seq_t *currImage = obj->currImagePtr; // Get ptr to current image + seq_t *currImage = obj->_currImagePtr; // Get ptr to current image // object coordinates - int x1 = obj->x + currImage->x1; // Left edge of object - int x2 = obj->x + currImage->x2; // Right edge - int y1 = obj->y + currImage->y1; // Top edge - int y2 = obj->y + currImage->y2; // Bottom edge + int x1 = obj->_x + currImage->_x1; // Left edge of object + int x2 = obj->_x + currImage->_x2; // Right edge + int y1 = obj->_y + currImage->_y1; // Top edge + int y2 = obj->_y + currImage->_y2; // Bottom edge - if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating)) + if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) clearBoundary(x1, x2, y2); // Clear our own boundary // Allowable motion wrt boundary - int dx = deltaX(x1, x2, obj->vx, y2); - if (dx != obj->vx) { + int dx = deltaX(x1, x2, obj->_vx, y2); + if (dx != obj->_vx) { // An object boundary collision! boundaryCollision(obj); - obj->vx = 0; + obj->_vx = 0; } - int dy = deltaY(x1, x2, obj->vy, y2); - if (dy != obj->vy) { + int dy = deltaY(x1, x2, obj->_vy, y2); + if (dy != obj->_vy) { // An object boundary collision! boundaryCollision(obj); - obj->vy = 0; + obj->_vy = 0; } - if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating)) + if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) storeBoundary(x1, x2, y2); // Re-store our own boundary - obj->x += dx; // Update object position - obj->y += dy; + obj->_x += dx; // Update object position + obj->_y += dy; // Don't let object go outside screen if (x1 < kEdge) - obj->x = kEdge2; + obj->_x = kEdge2; if (x2 > (kXPix - kEdge)) - obj->x = kXPix - kEdge2 - (x2 - x1); + obj->_x = kXPix - kEdge2 - (x2 - x1); if (y1 < kEdge) - obj->y = kEdge2; + obj->_y = kEdge2; if (y2 > (kYPix - kEdge)) - obj->y = kYPix - kEdge2 - (y2 - y1); + obj->_y = kYPix - kEdge2 - (y2 - y1); - if ((obj->vx == 0) && (obj->vy == 0)) - obj->cycling = kCycleNotCycling; + if ((obj->_vx == 0) && (obj->_vy == 0)) + obj->_cycling = kCycleNotCycling; } } // Clear all object baselines from the boundary file. for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object - seq_t *currImage = obj->currImagePtr; // Get ptr to current image - if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating)) - clearBoundary(obj->oldx + currImage->x1, obj->oldx + currImage->x2, obj->oldy + currImage->y2); + seq_t *currImage = obj->_currImagePtr; // Get ptr to current image + if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) + clearBoundary(obj->_oldx + currImage->_x1, obj->_oldx + currImage->_x2, obj->_oldy + currImage->_y2); } // If maze mode is enabled, do special maze processing - if (_vm->_maze.enabledFl) { - seq_t *currImage = _vm->_hero->currImagePtr;// Get ptr to current image + if (_vm->_maze._enabledFl) { + seq_t *currImage = _vm->_hero->_currImagePtr;// Get ptr to current image // hero coordinates - int x1 = _vm->_hero->x + currImage->x1; // Left edge of object - int x2 = _vm->_hero->x + currImage->x2; // Right edge - int y1 = _vm->_hero->y + currImage->y1; // Top edge - int y2 = _vm->_hero->y + currImage->y2; // Bottom edge + int x1 = _vm->_hero->_x + currImage->_x1; // Left edge of object + int x2 = _vm->_hero->_x + currImage->_x2; // Right edge + int y1 = _vm->_hero->_y + currImage->_y1; // Top edge + int y2 = _vm->_hero->_y + currImage->_y2; // Bottom edge _vm->_scheduler->processMaze(x1, x2, y1, y2); } @@ -355,11 +355,11 @@ void ObjectHandler_v1d::swapImages(int objIndex1, int objIndex2) { seqList_t tmpSeqList[kMaxSeqNumb]; int seqListSize = sizeof(seqList_t) * kMaxSeqNumb; - memmove(tmpSeqList, _objects[objIndex1].seqList, seqListSize); - memmove(_objects[objIndex1].seqList, _objects[objIndex2].seqList, seqListSize); - memmove(_objects[objIndex2].seqList, tmpSeqList, seqListSize); - _objects[objIndex1].currImagePtr = _objects[objIndex1].seqList[0].seqPtr; - _objects[objIndex2].currImagePtr = _objects[objIndex2].seqList[0].seqPtr; + memmove(tmpSeqList, _objects[objIndex1]._seqList, seqListSize); + memmove(_objects[objIndex1]._seqList, _objects[objIndex2]._seqList, seqListSize); + memmove(_objects[objIndex2]._seqList, tmpSeqList, seqListSize); + _objects[objIndex1]._currImagePtr = _objects[objIndex1]._seqList[0]._seqPtr; + _objects[objIndex2]._currImagePtr = _objects[objIndex2]._seqList[0]._seqPtr; _vm->_heroImage = (_vm->_heroImage == kHeroIndex) ? objIndex2 : kHeroIndex; } @@ -367,9 +367,9 @@ void ObjectHandler_v1d::homeIn(int objIndex1, const int objIndex2, const int8 ob // object obj1 will home in on object obj2 object_t *obj1 = &_objects[objIndex1]; object_t *obj2 = &_objects[objIndex2]; - obj1->pathType = kPathAuto; - int dx = obj1->x + obj1->currImagePtr->x1 - obj2->x - obj2->currImagePtr->x1; - int dy = obj1->y + obj1->currImagePtr->y1 - obj2->y - obj2->currImagePtr->y1; + obj1->_pathType = kPathAuto; + int dx = obj1->_x + obj1->_currImagePtr->_x1 - obj2->_x - obj2->_currImagePtr->_x1; + int dy = obj1->_y + obj1->_currImagePtr->_y1 - obj2->_y - obj2->_currImagePtr->_y1; if (dx == 0) // Don't EVER divide by zero! dx = 1; @@ -377,11 +377,11 @@ void ObjectHandler_v1d::homeIn(int objIndex1, const int objIndex2, const 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(dx); + obj1->_vy = abs((objDy * dy) / dx) * -sign(dy); } else { - obj1->vy = objDy * sign(dy); - obj1->vx = abs((objDx * dx) / dy) * sign(dx); + obj1->_vy = objDy * sign(dy); + obj1->_vx = abs((objDx * dx) / dy) * sign(dx); } } } // End of namespace Hugo diff --git a/engines/hugo/object_v1w.cpp b/engines/hugo/object_v1w.cpp index 4388ef5520..dd3de5fe40 100644 --- a/engines/hugo/object_v1w.cpp +++ b/engines/hugo/object_v1w.cpp @@ -64,7 +64,7 @@ void ObjectHandler_v1w::updateImages() { for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; - if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling >= kCycleAlmostInvisible)) + if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling >= kCycleAlmostInvisible)) objindex[num_objs++] = i; } @@ -75,27 +75,27 @@ void ObjectHandler_v1w::updateImages() { for (int i = 0; i < num_objs; i++) { object_t *obj = &_objects[objindex[i]]; // Count down inter-frame timer - if (obj->frameTimer) - obj->frameTimer--; + if (obj->_frameTimer) + obj->_frameTimer--; - if (obj->cycling > kCycleAlmostInvisible) { // Only if visible - switch (obj->cycling) { + if (obj->_cycling > kCycleAlmostInvisible) { // Only if visible + switch (obj->_cycling) { case kCycleNotCycling: - _vm->_screen->displayFrame(obj->x, obj->y, obj->currImagePtr, obj->priority == kPriorityOverOverlay); + _vm->_screen->displayFrame(obj->_x, obj->_y, obj->_currImagePtr, obj->_priority == kPriorityOverOverlay); break; case kCycleForward: - if (obj->frameTimer) // Not time to see next frame yet - _vm->_screen->displayFrame(obj->x, obj->y, obj->currImagePtr, obj->priority == kPriorityOverOverlay); + if (obj->_frameTimer) // Not time to see next frame yet + _vm->_screen->displayFrame(obj->_x, obj->_y, obj->_currImagePtr, obj->_priority == kPriorityOverOverlay); else - _vm->_screen->displayFrame(obj->x, obj->y, obj->currImagePtr->nextSeqPtr, obj->priority == kPriorityOverOverlay); + _vm->_screen->displayFrame(obj->_x, obj->_y, obj->_currImagePtr->_nextSeqPtr, obj->_priority == kPriorityOverOverlay); break; case kCycleBackward: { - seq_t *seqPtr = obj->currImagePtr; - if (!obj->frameTimer) { // Show next frame - while (seqPtr->nextSeqPtr != obj->currImagePtr) - seqPtr = seqPtr->nextSeqPtr; + seq_t *seqPtr = obj->_currImagePtr; + if (!obj->_frameTimer) { // Show next frame + while (seqPtr->_nextSeqPtr != obj->_currImagePtr) + seqPtr = seqPtr->_nextSeqPtr; } - _vm->_screen->displayFrame(obj->x, obj->y, seqPtr, obj->priority == kPriorityOverOverlay); + _vm->_screen->displayFrame(obj->_x, obj->_y, seqPtr, obj->_priority == kPriorityOverOverlay); break; } default: @@ -107,28 +107,28 @@ void ObjectHandler_v1w::updateImages() { // Cycle any animating objects for (int i = 0; i < num_objs; i++) { object_t *obj = &_objects[objindex[i]]; - if (obj->cycling != kCycleInvisible) { + if (obj->_cycling != kCycleInvisible) { // Only if it's visible - if (obj->cycling == kCycleAlmostInvisible) - obj->cycling = kCycleInvisible; + if (obj->_cycling == kCycleAlmostInvisible) + obj->_cycling = kCycleInvisible; // Now Rotate to next picture in sequence - switch (obj->cycling) { + switch (obj->_cycling) { case kCycleNotCycling: break; case kCycleForward: - if (!obj->frameTimer) { + if (!obj->_frameTimer) { // Time to step to next frame - obj->currImagePtr = obj->currImagePtr->nextSeqPtr; + obj->_currImagePtr = obj->_currImagePtr->_nextSeqPtr; // Find out if this is last frame of sequence // If so, reset frame_timer and decrement n_cycle - if (obj->frameInterval || obj->cycleNumb) { - obj->frameTimer = obj->frameInterval; - for (int j = 0; j < obj->seqNumb; j++) { - if (obj->currImagePtr->nextSeqPtr == obj->seqList[j].seqPtr) { - if (obj->cycleNumb) { // Decr cycleNumb if Non-continous - if (!--obj->cycleNumb) - obj->cycling = kCycleNotCycling; + if (obj->_frameInterval || obj->_cycleNumb) { + obj->_frameTimer = obj->_frameInterval; + for (int j = 0; j < obj->_seqNumb; j++) { + if (obj->_currImagePtr->_nextSeqPtr == obj->_seqList[j]._seqPtr) { + if (obj->_cycleNumb) { // Decr cycleNumb if Non-continous + if (!--obj->_cycleNumb) + obj->_cycling = kCycleNotCycling; } } } @@ -136,20 +136,20 @@ void ObjectHandler_v1w::updateImages() { } break; case kCycleBackward: { - if (!obj->frameTimer) { + if (!obj->_frameTimer) { // Time to step to prev frame - seq_t *seqPtr = obj->currImagePtr; - while (obj->currImagePtr->nextSeqPtr != seqPtr) - obj->currImagePtr = obj->currImagePtr->nextSeqPtr; + seq_t *seqPtr = obj->_currImagePtr; + while (obj->_currImagePtr->_nextSeqPtr != seqPtr) + obj->_currImagePtr = obj->_currImagePtr->_nextSeqPtr; // Find out if this is first frame of sequence // If so, reset frame_timer and decrement n_cycle - if (obj->frameInterval || obj->cycleNumb) { - obj->frameTimer = obj->frameInterval; - for (int j = 0; j < obj->seqNumb; j++) { - if (obj->currImagePtr == obj->seqList[j].seqPtr) { - if (obj->cycleNumb){ // Decr cycleNumb if Non-continous - if (!--obj->cycleNumb) - obj->cycling = kCycleNotCycling; + if (obj->_frameInterval || obj->_cycleNumb) { + obj->_frameTimer = obj->_frameInterval; + for (int j = 0; j < obj->_seqNumb; j++) { + if (obj->_currImagePtr == obj->_seqList[j]._seqPtr) { + if (obj->_cycleNumb){ // Decr cycleNumb if Non-continous + if (!--obj->_cycleNumb) + obj->_cycling = kCycleNotCycling; } } } @@ -160,8 +160,8 @@ void ObjectHandler_v1w::updateImages() { default: break; } - obj->oldx = obj->x; - obj->oldy = obj->y; + obj->_oldx = obj->_x; + obj->_oldy = obj->_y; } } } @@ -181,174 +181,174 @@ void ObjectHandler_v1w::moveObjects() { // Don't store foreground or background objects for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object - seq_t *currImage = obj->currImagePtr; // Get ptr to current image - if (obj->screenIndex == *_vm->_screen_p) { - switch (obj->pathType) { + seq_t *currImage = obj->_currImagePtr; // Get ptr to current image + if (obj->_screenIndex == *_vm->_screen_p) { + switch (obj->_pathType) { case kPathChase: case kPathChase2: { - int8 radius = obj->radius; // Default to object's radius + int8 radius = obj->_radius; // Default to object's radius if (radius < 0) // If radius infinity, use closer value radius = kStepDx; // Allowable motion wrt boundary - int dx = _vm->_hero->x + _vm->_hero->currImagePtr->x1 - obj->x - currImage->x1; - int dy = _vm->_hero->y + _vm->_hero->currImagePtr->y2 - obj->y - currImage->y2 - 1; + int dx = _vm->_hero->_x + _vm->_hero->_currImagePtr->_x1 - obj->_x - currImage->_x1; + int dy = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2 - obj->_y - currImage->_y2 - 1; if (abs(dx) <= radius) - obj->vx = 0; + obj->_vx = 0; else - obj->vx = (dx > 0) ? MIN(dx, obj->vxPath) : MAX(dx, -obj->vxPath); + obj->_vx = (dx > 0) ? MIN(dx, obj->_vxPath) : MAX(dx, -obj->_vxPath); if (abs(dy) <= radius) - obj->vy = 0; + obj->_vy = 0; else - obj->vy = (dy > 0) ? MIN(dy, obj->vyPath) : MAX(dy, -obj->vyPath); + obj->_vy = (dy > 0) ? MIN(dy, obj->_vyPath) : MAX(dy, -obj->_vyPath); // Set first image in sequence (if multi-seq object) - switch (obj->seqNumb) { + switch (obj->_seqNumb) { case 4: - if (!obj->vx) { // Got 4 directions - if (obj->vx != obj->oldvx) { // vx just stopped + if (!obj->_vx) { // Got 4 directions + if (obj->_vx != obj->_oldvx) { // vx just stopped if (dy >= 0) - obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_DOWN]._seqPtr; else - obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_UP]._seqPtr; } - } else if (obj->vx != obj->oldvx) { + } else if (obj->_vx != obj->_oldvx) { if (dx > 0) - obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr; else - obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr; } break; case 3: case 2: - if (obj->vx != obj->oldvx) { // vx just stopped + if (obj->_vx != obj->_oldvx) { // vx just stopped if (dx > 0) // Left & right only - obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr; else - obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr; } break; } - if (obj->vx || obj->vy) { - obj->cycling = kCycleForward; + if (obj->_vx || obj->_vy) { + obj->_cycling = kCycleForward; } else { - obj->cycling = kCycleNotCycling; + obj->_cycling = kCycleNotCycling; boundaryCollision(obj); // Must have got hero! } - obj->oldvx = obj->vx; - obj->oldvy = obj->vy; - currImage = obj->currImagePtr; // Get (new) ptr to current image + obj->_oldvx = obj->_vx; + obj->_oldvy = obj->_vy; + currImage = obj->_currImagePtr; // Get (new) ptr to current image break; } case kPathWander2: case kPathWander: if (!_vm->_rnd->getRandomNumber(3 * _vm->_normalTPS)) { // Kick on random interval - obj->vx = _vm->_rnd->getRandomNumber(obj->vxPath << 1) - obj->vxPath; - obj->vy = _vm->_rnd->getRandomNumber(obj->vyPath << 1) - obj->vyPath; + obj->_vx = _vm->_rnd->getRandomNumber(obj->_vxPath << 1) - obj->_vxPath; + obj->_vy = _vm->_rnd->getRandomNumber(obj->_vyPath << 1) - obj->_vyPath; // Set first image in sequence (if multi-seq object) - if (obj->seqNumb > 1) { - if (!obj->vx && (obj->seqNumb >= 4)) { - if (obj->vx != obj->oldvx) { // vx just stopped - if (obj->vy > 0) - obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr; + if (obj->_seqNumb > 1) { + if (!obj->_vx && (obj->_seqNumb >= 4)) { + if (obj->_vx != obj->_oldvx) { // vx just stopped + if (obj->_vy > 0) + obj->_currImagePtr = obj->_seqList[SEQ_DOWN]._seqPtr; else - obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_UP]._seqPtr; } - } else if (obj->vx != obj->oldvx) { - if (obj->vx > 0) - obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr; + } else if (obj->_vx != obj->_oldvx) { + if (obj->_vx > 0) + obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr; else - obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr; } } - obj->oldvx = obj->vx; - obj->oldvy = obj->vy; - currImage = obj->currImagePtr; // Get (new) ptr to current image + obj->_oldvx = obj->_vx; + obj->_oldvy = obj->_vy; + currImage = obj->_currImagePtr; // Get (new) ptr to current image } - if (obj->vx || obj->vy) - obj->cycling = kCycleForward; + if (obj->_vx || obj->_vy) + obj->_cycling = kCycleForward; break; default: ; // Really, nothing } // Store boundaries - if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating)) - storeBoundary(obj->x + currImage->x1, obj->x + currImage->x2, obj->y + currImage->y2); + if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) + storeBoundary(obj->_x + currImage->_x1, obj->_x + currImage->_x2, obj->_y + currImage->_y2); } } // Move objects, allowing for boundaries for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object - if ((obj->screenIndex == *_vm->_screen_p) && (obj->vx || obj->vy)) { + if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_vx || obj->_vy)) { // Only process if it's moving // Do object movement. Delta_x,y return allowed movement in x,y // to move as close to a boundary as possible without crossing it. - seq_t *currImage = obj->currImagePtr; // Get ptr to current image + seq_t *currImage = obj->_currImagePtr; // Get ptr to current image // object coordinates - int x1 = obj->x + currImage->x1; // Left edge of object - int x2 = obj->x + currImage->x2; // Right edge - int y1 = obj->y + currImage->y1; // Top edge - int y2 = obj->y + currImage->y2; // Bottom edge + int x1 = obj->_x + currImage->_x1; // Left edge of object + int x2 = obj->_x + currImage->_x2; // Right edge + int y1 = obj->_y + currImage->_y1; // Top edge + int y2 = obj->_y + currImage->_y2; // Bottom edge - if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating)) + if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) clearBoundary(x1, x2, y2); // Clear our own boundary // Allowable motion wrt boundary - int dx = deltaX(x1, x2, obj->vx, y2); - if (dx != obj->vx) { + int dx = deltaX(x1, x2, obj->_vx, y2); + if (dx != obj->_vx) { // An object boundary collision! boundaryCollision(obj); - obj->vx = 0; + obj->_vx = 0; } - int dy = deltaY(x1, x2, obj->vy, y2); - if (dy != obj->vy) { + int dy = deltaY(x1, x2, obj->_vy, y2); + if (dy != obj->_vy) { // An object boundary collision! boundaryCollision(obj); - obj->vy = 0; + obj->_vy = 0; } - if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating)) + if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) storeBoundary(x1, x2, y2); // Re-store our own boundary - obj->x += dx; // Update object position - obj->y += dy; + obj->_x += dx; // Update object position + obj->_y += dy; // Don't let object go outside screen if (x1 < kEdge) - obj->x = kEdge2; + obj->_x = kEdge2; if (x2 > (kXPix - kEdge)) - obj->x = kXPix - kEdge2 - (x2 - x1); + obj->_x = kXPix - kEdge2 - (x2 - x1); if (y1 < kEdge) - obj->y = kEdge2; + obj->_y = kEdge2; if (y2 > (kYPix - kEdge)) - obj->y = kYPix - kEdge2 - (y2 - y1); + obj->_y = kYPix - kEdge2 - (y2 - y1); - if ((obj->vx == 0) && (obj->vy == 0) && (obj->pathType != kPathWander2) && (obj->pathType != kPathChase2)) - obj->cycling = kCycleNotCycling; + if ((obj->_vx == 0) && (obj->_vy == 0) && (obj->_pathType != kPathWander2) && (obj->_pathType != kPathChase2)) + obj->_cycling = kCycleNotCycling; } } // Clear all object baselines from the boundary file. for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object - seq_t *currImage = obj->currImagePtr; // Get ptr to current image - if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating)) - clearBoundary(obj->oldx + currImage->x1, obj->oldx + currImage->x2, obj->oldy + currImage->y2); + seq_t *currImage = obj->_currImagePtr; // Get ptr to current image + if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) + clearBoundary(obj->_oldx + currImage->_x1, obj->_oldx + currImage->_x2, obj->_oldy + currImage->_y2); } // If maze mode is enabled, do special maze processing - if (_vm->_maze.enabledFl) { - seq_t *currImage = _vm->_hero->currImagePtr; // Get ptr to current image + if (_vm->_maze._enabledFl) { + seq_t *currImage = _vm->_hero->_currImagePtr; // Get ptr to current image // hero coordinates - int x1 = _vm->_hero->x + currImage->x1; // Left edge of object - int x2 = _vm->_hero->x + currImage->x2; // Right edge - int y1 = _vm->_hero->y + currImage->y1; // Top edge - int y2 = _vm->_hero->y + currImage->y2; // Bottom edge + int x1 = _vm->_hero->_x + currImage->_x1; // Left edge of object + int x2 = _vm->_hero->_x + currImage->_x2; // Right edge + int y1 = _vm->_hero->_y + currImage->_y1; // Top edge + int y2 = _vm->_hero->_y + currImage->_y2; // Bottom edge _vm->_scheduler->processMaze(x1, x2, y1, y2); } @@ -367,15 +367,15 @@ void ObjectHandler_v1w::swapImages(int objIndex1, int objIndex2) { seqList_t tmpSeqList[kMaxSeqNumb]; int seqListSize = sizeof(seqList_t) * kMaxSeqNumb; - memmove(tmpSeqList, _objects[objIndex1].seqList, seqListSize); - memmove(_objects[objIndex1].seqList, _objects[objIndex2].seqList, seqListSize); - memmove(_objects[objIndex2].seqList, tmpSeqList, seqListSize); + memmove(tmpSeqList, _objects[objIndex1]._seqList, seqListSize); + memmove(_objects[objIndex1]._seqList, _objects[objIndex2]._seqList, seqListSize); + memmove(_objects[objIndex2]._seqList, tmpSeqList, seqListSize); restoreSeq(&_objects[objIndex1]); - _objects[objIndex2].currImagePtr = _objects[objIndex2].seqList[0].seqPtr; + _objects[objIndex2]._currImagePtr = _objects[objIndex2]._seqList[0]._seqPtr; _vm->_heroImage = (_vm->_heroImage == kHeroIndex) ? objIndex2 : kHeroIndex; // Make sure baseline stays constant - _objects[objIndex1].y += _objects[objIndex2].currImagePtr->y2 - _objects[objIndex1].currImagePtr->y2; + _objects[objIndex1]._y += _objects[objIndex2]._currImagePtr->_y2 - _objects[objIndex1]._currImagePtr->_y2; } } // End of namespace Hugo diff --git a/engines/hugo/object_v2d.cpp b/engines/hugo/object_v2d.cpp index 4a22fab2c0..025374521c 100644 --- a/engines/hugo/object_v2d.cpp +++ b/engines/hugo/object_v2d.cpp @@ -64,7 +64,7 @@ void ObjectHandler_v2d::updateImages() { for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; - if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling >= kCycleAlmostInvisible)) + if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling >= kCycleAlmostInvisible)) objindex[num_objs++] = i; } @@ -75,27 +75,27 @@ void ObjectHandler_v2d::updateImages() { for (int i = 0; i < num_objs; i++) { object_t *obj = &_objects[objindex[i]]; // Count down inter-frame timer - if (obj->frameTimer) - obj->frameTimer--; + if (obj->_frameTimer) + obj->_frameTimer--; - if (obj->cycling > kCycleAlmostInvisible) { // Only if visible - switch (obj->cycling) { + if (obj->_cycling > kCycleAlmostInvisible) { // Only if visible + switch (obj->_cycling) { case kCycleNotCycling: - _vm->_screen->displayFrame(obj->x, obj->y, obj->currImagePtr, obj->priority == kPriorityOverOverlay); + _vm->_screen->displayFrame(obj->_x, obj->_y, obj->_currImagePtr, obj->_priority == kPriorityOverOverlay); break; case kCycleForward: - if (obj->frameTimer) // Not time to see next frame yet - _vm->_screen->displayFrame(obj->x, obj->y, obj->currImagePtr, obj->priority == kPriorityOverOverlay); + if (obj->_frameTimer) // Not time to see next frame yet + _vm->_screen->displayFrame(obj->_x, obj->_y, obj->_currImagePtr, obj->_priority == kPriorityOverOverlay); else - _vm->_screen->displayFrame(obj->x, obj->y, obj->currImagePtr->nextSeqPtr, obj->priority == kPriorityOverOverlay); + _vm->_screen->displayFrame(obj->_x, obj->_y, obj->_currImagePtr->_nextSeqPtr, obj->_priority == kPriorityOverOverlay); break; case kCycleBackward: { - seq_t *seqPtr = obj->currImagePtr; - if (!obj->frameTimer) { // Show next frame - while (seqPtr->nextSeqPtr != obj->currImagePtr) - seqPtr = seqPtr->nextSeqPtr; + seq_t *seqPtr = obj->_currImagePtr; + if (!obj->_frameTimer) { // Show next frame + while (seqPtr->_nextSeqPtr != obj->_currImagePtr) + seqPtr = seqPtr->_nextSeqPtr; } - _vm->_screen->displayFrame(obj->x, obj->y, seqPtr, obj->priority == kPriorityOverOverlay); + _vm->_screen->displayFrame(obj->_x, obj->_y, seqPtr, obj->_priority == kPriorityOverOverlay); break; } default: @@ -109,28 +109,28 @@ void ObjectHandler_v2d::updateImages() { // Cycle any animating objects for (int i = 0; i < num_objs; i++) { object_t *obj = &_objects[objindex[i]]; - if (obj->cycling != kCycleInvisible) { + if (obj->_cycling != kCycleInvisible) { // Only if it's visible - if (obj->cycling == kCycleAlmostInvisible) - obj->cycling = kCycleInvisible; + if (obj->_cycling == kCycleAlmostInvisible) + obj->_cycling = kCycleInvisible; // Now Rotate to next picture in sequence - switch (obj->cycling) { + switch (obj->_cycling) { case kCycleNotCycling: break; case kCycleForward: - if (!obj->frameTimer) { + if (!obj->_frameTimer) { // Time to step to next frame - obj->currImagePtr = obj->currImagePtr->nextSeqPtr; + obj->_currImagePtr = obj->_currImagePtr->_nextSeqPtr; // Find out if this is last frame of sequence // If so, reset frame_timer and decrement n_cycle - if (obj->frameInterval || obj->cycleNumb) { - obj->frameTimer = obj->frameInterval; - for (int j = 0; j < obj->seqNumb; j++) { - if (obj->currImagePtr->nextSeqPtr == obj->seqList[j].seqPtr) { - if (obj->cycleNumb) { // Decr cycleNumb if Non-continous - if (!--obj->cycleNumb) - obj->cycling = kCycleNotCycling; + if (obj->_frameInterval || obj->_cycleNumb) { + obj->_frameTimer = obj->_frameInterval; + for (int j = 0; j < obj->_seqNumb; j++) { + if (obj->_currImagePtr->_nextSeqPtr == obj->_seqList[j]._seqPtr) { + if (obj->_cycleNumb) { // Decr cycleNumb if Non-continous + if (!--obj->_cycleNumb) + obj->_cycling = kCycleNotCycling; } } } @@ -138,20 +138,20 @@ void ObjectHandler_v2d::updateImages() { } break; case kCycleBackward: { - if (!obj->frameTimer) { + if (!obj->_frameTimer) { // Time to step to prev frame - seq_t *seqPtr = obj->currImagePtr; - while (obj->currImagePtr->nextSeqPtr != seqPtr) - obj->currImagePtr = obj->currImagePtr->nextSeqPtr; + seq_t *seqPtr = obj->_currImagePtr; + while (obj->_currImagePtr->_nextSeqPtr != seqPtr) + obj->_currImagePtr = obj->_currImagePtr->_nextSeqPtr; // Find out if this is first frame of sequence // If so, reset frame_timer and decrement n_cycle - if (obj->frameInterval || obj->cycleNumb) { - obj->frameTimer = obj->frameInterval; - for (int j = 0; j < obj->seqNumb; j++) { - if (obj->currImagePtr == obj->seqList[j].seqPtr) { - if (obj->cycleNumb){ // Decr cycleNumb if Non-continous - if (!--obj->cycleNumb) - obj->cycling = kCycleNotCycling; + if (obj->_frameInterval || obj->_cycleNumb) { + obj->_frameTimer = obj->_frameInterval; + for (int j = 0; j < obj->_seqNumb; j++) { + if (obj->_currImagePtr == obj->_seqList[j]._seqPtr) { + if (obj->_cycleNumb){ // Decr cycleNumb if Non-continous + if (!--obj->_cycleNumb) + obj->_cycling = kCycleNotCycling; } } } @@ -162,8 +162,8 @@ void ObjectHandler_v2d::updateImages() { default: break; } - obj->oldx = obj->x; - obj->oldy = obj->y; + obj->_oldx = obj->_x; + obj->_oldy = obj->_y; } } } @@ -184,174 +184,174 @@ void ObjectHandler_v2d::moveObjects() { // Don't store foreground or background objects for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object - seq_t *currImage = obj->currImagePtr; // Get ptr to current image - if (obj->screenIndex == *_vm->_screen_p) { - switch (obj->pathType) { + seq_t *currImage = obj->_currImagePtr; // Get ptr to current image + if (obj->_screenIndex == *_vm->_screen_p) { + switch (obj->_pathType) { case kPathChase: case kPathChase2: { - int8 radius = obj->radius; // Default to object's radius + int8 radius = obj->_radius; // Default to object's radius if (radius < 0) // If radius infinity, use closer value radius = kStepDx; // Allowable motion wrt boundary - int dx = _vm->_hero->x + _vm->_hero->currImagePtr->x1 - obj->x - currImage->x1; - int dy = _vm->_hero->y + _vm->_hero->currImagePtr->y2 - obj->y - currImage->y2 - 1; + int dx = _vm->_hero->_x + _vm->_hero->_currImagePtr->_x1 - obj->_x - currImage->_x1; + int dy = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2 - obj->_y - currImage->_y2 - 1; if (abs(dx) <= radius) - obj->vx = 0; + obj->_vx = 0; else - obj->vx = (dx > 0) ? MIN(dx, obj->vxPath) : MAX(dx, -obj->vxPath); + obj->_vx = (dx > 0) ? MIN(dx, obj->_vxPath) : MAX(dx, -obj->_vxPath); if (abs(dy) <= radius) - obj->vy = 0; + obj->_vy = 0; else - obj->vy = (dy > 0) ? MIN(dy, obj->vyPath) : MAX(dy, -obj->vyPath); + obj->_vy = (dy > 0) ? MIN(dy, obj->_vyPath) : MAX(dy, -obj->_vyPath); // Set first image in sequence (if multi-seq object) - switch (obj->seqNumb) { + switch (obj->_seqNumb) { case 4: - if (!obj->vx) { // Got 4 directions - if (obj->vx != obj->oldvx) { // vx just stopped + if (!obj->_vx) { // Got 4 directions + if (obj->_vx != obj->_oldvx) { // vx just stopped if (dy > 0) - obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_DOWN]._seqPtr; else - obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_UP]._seqPtr; } - } else if (obj->vx != obj->oldvx) { + } else if (obj->_vx != obj->_oldvx) { if (dx > 0) - obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr; else - obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr; } break; case 3: case 2: - if (obj->vx != obj->oldvx) { // vx just stopped + if (obj->_vx != obj->_oldvx) { // vx just stopped if (dx > 0) // Left & right only - obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr; else - obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr; } break; } - if (obj->vx || obj->vy) { - obj->cycling = kCycleForward; + if (obj->_vx || obj->_vy) { + obj->_cycling = kCycleForward; } else { - obj->cycling = kCycleNotCycling; + obj->_cycling = kCycleNotCycling; boundaryCollision(obj); // Must have got hero! } - obj->oldvx = obj->vx; - obj->oldvy = obj->vy; - currImage = obj->currImagePtr; // Get (new) ptr to current image + obj->_oldvx = obj->_vx; + obj->_oldvy = obj->_vy; + currImage = obj->_currImagePtr; // Get (new) ptr to current image break; } case kPathWander2: case kPathWander: if (!_vm->_rnd->getRandomNumber(3 * _vm->_normalTPS)) { // Kick on random interval - obj->vx = _vm->_rnd->getRandomNumber(obj->vxPath << 1) - obj->vxPath; - obj->vy = _vm->_rnd->getRandomNumber(obj->vyPath << 1) - obj->vyPath; + obj->_vx = _vm->_rnd->getRandomNumber(obj->_vxPath << 1) - obj->_vxPath; + obj->_vy = _vm->_rnd->getRandomNumber(obj->_vyPath << 1) - obj->_vyPath; // Set first image in sequence (if multi-seq object) - if (obj->seqNumb > 1) { - if (!obj->vx && (obj->seqNumb >= 4)) { - if (obj->vx != obj->oldvx) { // vx just stopped - if (obj->vy > 0) - obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr; + if (obj->_seqNumb > 1) { + if (!obj->_vx && (obj->_seqNumb >= 4)) { + if (obj->_vx != obj->_oldvx) { // vx just stopped + if (obj->_vy > 0) + obj->_currImagePtr = obj->_seqList[SEQ_DOWN]._seqPtr; else - obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_UP]._seqPtr; } - } else if (obj->vx != obj->oldvx) { - if (obj->vx > 0) - obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr; + } else if (obj->_vx != obj->_oldvx) { + if (obj->_vx > 0) + obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr; else - obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr; } } - obj->oldvx = obj->vx; - obj->oldvy = obj->vy; - currImage = obj->currImagePtr; // Get (new) ptr to current image + obj->_oldvx = obj->_vx; + obj->_oldvy = obj->_vy; + currImage = obj->_currImagePtr; // Get (new) ptr to current image } - if (obj->vx || obj->vy) - obj->cycling = kCycleForward; + if (obj->_vx || obj->_vy) + obj->_cycling = kCycleForward; break; default: ; // Really, nothing } // Store boundaries - if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating)) - storeBoundary(obj->x + currImage->x1, obj->x + currImage->x2, obj->y + currImage->y2); + if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) + storeBoundary(obj->_x + currImage->_x1, obj->_x + currImage->_x2, obj->_y + currImage->_y2); } } // Move objects, allowing for boundaries for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object - if ((obj->screenIndex == *_vm->_screen_p) && (obj->vx || obj->vy)) { + if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_vx || obj->_vy)) { // Only process if it's moving // Do object movement. Delta_x,y return allowed movement in x,y // to move as close to a boundary as possible without crossing it. - seq_t *currImage = obj->currImagePtr; // Get ptr to current image + seq_t *currImage = obj->_currImagePtr; // Get ptr to current image // object coordinates - int x1 = obj->x + currImage->x1; // Left edge of object - int x2 = obj->x + currImage->x2; // Right edge - int y1 = obj->y + currImage->y1; // Top edge - int y2 = obj->y + currImage->y2; // Bottom edge + int x1 = obj->_x + currImage->_x1; // Left edge of object + int x2 = obj->_x + currImage->_x2; // Right edge + int y1 = obj->_y + currImage->_y1; // Top edge + int y2 = obj->_y + currImage->_y2; // Bottom edge - if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating)) + if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) clearBoundary(x1, x2, y2); // Clear our own boundary // Allowable motion wrt boundary - int dx = deltaX(x1, x2, obj->vx, y2); - if (dx != obj->vx) { + int dx = deltaX(x1, x2, obj->_vx, y2); + if (dx != obj->_vx) { // An object boundary collision! boundaryCollision(obj); - obj->vx = 0; + obj->_vx = 0; } - int dy = deltaY(x1, x2, obj->vy, y2); - if (dy != obj->vy) { + int dy = deltaY(x1, x2, obj->_vy, y2); + if (dy != obj->_vy) { // An object boundary collision! boundaryCollision(obj); - obj->vy = 0; + obj->_vy = 0; } - if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating)) + if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) storeBoundary(x1, x2, y2); // Re-store our own boundary - obj->x += dx; // Update object position - obj->y += dy; + obj->_x += dx; // Update object position + obj->_y += dy; // Don't let object go outside screen if (x1 < kEdge) - obj->x = kEdge2; + obj->_x = kEdge2; if (x2 > (kXPix - kEdge)) - obj->x = kXPix - kEdge2 - (x2 - x1); + obj->_x = kXPix - kEdge2 - (x2 - x1); if (y1 < kEdge) - obj->y = kEdge2; + obj->_y = kEdge2; if (y2 > (kYPix - kEdge)) - obj->y = kYPix - kEdge2 - (y2 - y1); + obj->_y = kYPix - kEdge2 - (y2 - y1); - if ((obj->vx == 0) && (obj->vy == 0) && (obj->pathType != kPathWander2) && (obj->pathType != kPathChase2)) - obj->cycling = kCycleNotCycling; + if ((obj->_vx == 0) && (obj->_vy == 0) && (obj->_pathType != kPathWander2) && (obj->_pathType != kPathChase2)) + obj->_cycling = kCycleNotCycling; } } // Clear all object baselines from the boundary file. for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object - seq_t *currImage = obj->currImagePtr; // Get ptr to current image - if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating)) - clearBoundary(obj->oldx + currImage->x1, obj->oldx + currImage->x2, obj->oldy + currImage->y2); + seq_t *currImage = obj->_currImagePtr; // Get ptr to current image + if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) + clearBoundary(obj->_oldx + currImage->_x1, obj->_oldx + currImage->_x2, obj->_oldy + currImage->_y2); } // If maze mode is enabled, do special maze processing - if (_vm->_maze.enabledFl) { - seq_t *currImage = _vm->_hero->currImagePtr; // Get ptr to current image + if (_vm->_maze._enabledFl) { + seq_t *currImage = _vm->_hero->_currImagePtr; // Get ptr to current image // hero coordinates - int x1 = _vm->_hero->x + currImage->x1; // Left edge of object - int x2 = _vm->_hero->x + currImage->x2; // Right edge - int y1 = _vm->_hero->y + currImage->y1; // Top edge - int y2 = _vm->_hero->y + currImage->y2; // Bottom edge + int x1 = _vm->_hero->_x + currImage->_x1; // Left edge of object + int x2 = _vm->_hero->_x + currImage->_x2; // Right edge + int y1 = _vm->_hero->_y + currImage->_y1; // Top edge + int y2 = _vm->_hero->_y + currImage->_y2; // Bottom edge _vm->_scheduler->processMaze(x1, x2, y1, y2); } @@ -361,9 +361,9 @@ void ObjectHandler_v2d::homeIn(const int objIndex1, const int objIndex2, const i // object obj1 will home in on object obj2 object_t *obj1 = &_objects[objIndex1]; object_t *obj2 = &_objects[objIndex2]; - obj1->pathType = kPathAuto; - int dx = obj1->x + obj1->currImagePtr->x1 - obj2->x - obj2->currImagePtr->x1; - int dy = obj1->y + obj1->currImagePtr->y1 - obj2->y - obj2->currImagePtr->y1; + obj1->_pathType = kPathAuto; + int dx = obj1->_x + obj1->_currImagePtr->_x1 - obj2->_x - obj2->_currImagePtr->_x1; + int dy = obj1->_y + obj1->_currImagePtr->_y1 - obj2->_y - obj2->_currImagePtr->_y1; if (dx == 0) // Don't EVER divide by zero! dx = 1; @@ -371,11 +371,11 @@ void ObjectHandler_v2d::homeIn(const int objIndex1, const int objIndex2, const i dy = 1; if (abs(dx) > abs(dy)) { - obj1->vx = objDx * -sign(dx); - obj1->vy = abs((objDy * dy) / dx) * -sign(dy); + obj1->_vx = objDx * -sign(dx); + obj1->_vy = abs((objDy * dy) / dx) * -sign(dy); } else { - obj1->vy = objDy * -sign(dy); - obj1->vx = abs((objDx * dx) / dy) * -sign(dx); + obj1->_vy = objDy * -sign(dy); + obj1->_vx = abs((objDx * dx) / dy) * -sign(dx); } } } // End of namespace Hugo diff --git a/engines/hugo/object_v3d.cpp b/engines/hugo/object_v3d.cpp index cde7f5fd62..15d5fcd936 100644 --- a/engines/hugo/object_v3d.cpp +++ b/engines/hugo/object_v3d.cpp @@ -65,175 +65,175 @@ void ObjectHandler_v3d::moveObjects() { // Don't store foreground or background objects for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object - seq_t *currImage = obj->currImagePtr; // Get ptr to current image - if (obj->screenIndex == *_vm->_screen_p) { - switch (obj->pathType) { + seq_t *currImage = obj->_currImagePtr; // Get ptr to current image + if (obj->_screenIndex == *_vm->_screen_p) { + switch (obj->_pathType) { case kPathChase: case kPathChase2: { - int8 radius = obj->radius; // Default to object's radius + int8 radius = obj->_radius; // Default to object's radius if (radius < 0) // If radius infinity, use closer value radius = kStepDx; // Allowable motion wrt boundary - int dx = _vm->_hero->x + _vm->_hero->currImagePtr->x1 - obj->x - currImage->x1; - int dy = _vm->_hero->y + _vm->_hero->currImagePtr->y2 - obj->y - currImage->y2 - 1; + int dx = _vm->_hero->_x + _vm->_hero->_currImagePtr->_x1 - obj->_x - currImage->_x1; + int dy = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2 - obj->_y - currImage->_y2 - 1; if (abs(dx) <= radius) - obj->vx = 0; + obj->_vx = 0; else - obj->vx = (dx > 0) ? MIN(dx, obj->vxPath) : MAX(dx, -obj->vxPath); + obj->_vx = (dx > 0) ? MIN(dx, obj->_vxPath) : MAX(dx, -obj->_vxPath); if (abs(dy) <= radius) - obj->vy = 0; + obj->_vy = 0; else - obj->vy = (dy > 0) ? MIN(dy, obj->vyPath) : MAX(dy, -obj->vyPath); + obj->_vy = (dy > 0) ? MIN(dy, obj->_vyPath) : MAX(dy, -obj->_vyPath); // Set first image in sequence (if multi-seq object) - switch (obj->seqNumb) { + switch (obj->_seqNumb) { case 4: - if (!obj->vx) { // Got 4 directions - if (obj->vx != obj->oldvx) { // vx just stopped + if (!obj->_vx) { // Got 4 directions + if (obj->_vx != obj->_oldvx) { // vx just stopped if (dy >= 0) - obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_DOWN]._seqPtr; else - obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_UP]._seqPtr; } - } else if (obj->vx != obj->oldvx) { + } else if (obj->_vx != obj->_oldvx) { if (dx > 0) - obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr; else - obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr; } break; case 3: case 2: - if (obj->vx != obj->oldvx) { // vx just stopped + if (obj->_vx != obj->_oldvx) { // vx just stopped if (dx > 0) // Left & right only - obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr; else - obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr; } break; } - if (obj->vx || obj->vy) { - obj->cycling = kCycleForward; + if (obj->_vx || obj->_vy) { + obj->_cycling = kCycleForward; } else { - obj->cycling = kCycleNotCycling; + obj->_cycling = kCycleNotCycling; boundaryCollision(obj); // Must have got hero! } - obj->oldvx = obj->vx; - obj->oldvy = obj->vy; - currImage = obj->currImagePtr; // Get (new) ptr to current image + obj->_oldvx = obj->_vx; + obj->_oldvy = obj->_vy; + currImage = obj->_currImagePtr; // Get (new) ptr to current image break; } case kPathWander2: case kPathWander: if (!_vm->_rnd->getRandomNumber(3 * _vm->_normalTPS)) { // Kick on random interval - obj->vx = _vm->_rnd->getRandomNumber(obj->vxPath << 1) - obj->vxPath; - obj->vy = _vm->_rnd->getRandomNumber(obj->vyPath << 1) - obj->vyPath; + obj->_vx = _vm->_rnd->getRandomNumber(obj->_vxPath << 1) - obj->_vxPath; + obj->_vy = _vm->_rnd->getRandomNumber(obj->_vyPath << 1) - obj->_vyPath; // Set first image in sequence (if multi-seq object) - if (obj->seqNumb > 1) { - if (!obj->vx && (obj->seqNumb >= 4)) { - if (obj->vx != obj->oldvx) { // vx just stopped - if (obj->vy > 0) - obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr; + if (obj->_seqNumb > 1) { + if (!obj->_vx && (obj->_seqNumb >= 4)) { + if (obj->_vx != obj->_oldvx) { // vx just stopped + if (obj->_vy > 0) + obj->_currImagePtr = obj->_seqList[SEQ_DOWN]._seqPtr; else - obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_UP]._seqPtr; } - } else if (obj->vx != obj->oldvx) { - if (obj->vx > 0) - obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr; + } else if (obj->_vx != obj->_oldvx) { + if (obj->_vx > 0) + obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr; else - obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr; } } - obj->oldvx = obj->vx; - obj->oldvy = obj->vy; - currImage = obj->currImagePtr; // Get (new) ptr to current image + obj->_oldvx = obj->_vx; + obj->_oldvy = obj->_vy; + currImage = obj->_currImagePtr; // Get (new) ptr to current image } - if (obj->vx || obj->vy) - obj->cycling = kCycleForward; + if (obj->_vx || obj->_vy) + obj->_cycling = kCycleForward; break; default: ; // Really, nothing } // Store boundaries - if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating)) - storeBoundary(obj->x + currImage->x1, obj->x + currImage->x2, obj->y + currImage->y2); + if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) + storeBoundary(obj->_x + currImage->_x1, obj->_x + currImage->_x2, obj->_y + currImage->_y2); } } // Move objects, allowing for boundaries for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object - if ((obj->screenIndex == *_vm->_screen_p) && (obj->vx || obj->vy)) { + if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_vx || obj->_vy)) { // Only process if it's moving // Do object movement. Delta_x,y return allowed movement in x,y // to move as close to a boundary as possible without crossing it. - seq_t *currImage = obj->currImagePtr; // Get ptr to current image + seq_t *currImage = obj->_currImagePtr; // Get ptr to current image // object coordinates - int x1 = obj->x + currImage->x1; // Left edge of object - int x2 = obj->x + currImage->x2; // Right edge - int y1 = obj->y + currImage->y1; // Top edge - int y2 = obj->y + currImage->y2; // Bottom edge + int x1 = obj->_x + currImage->_x1; // Left edge of object + int x2 = obj->_x + currImage->_x2; // Right edge + int y1 = obj->_y + currImage->_y1; // Top edge + int y2 = obj->_y + currImage->_y2; // Bottom edge - if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating)) + if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) clearBoundary(x1, x2, y2); // Clear our own boundary // Allowable motion wrt boundary - int dx = deltaX(x1, x2, obj->vx, y2); - if (dx != obj->vx) { + int dx = deltaX(x1, x2, obj->_vx, y2); + if (dx != obj->_vx) { // An object boundary collision! boundaryCollision(obj); - obj->vx = 0; + obj->_vx = 0; } - int dy = deltaY(x1, x2, obj->vy, y2); - if (dy != obj->vy) { + int dy = deltaY(x1, x2, obj->_vy, y2); + if (dy != obj->_vy) { // An object boundary collision! boundaryCollision(obj); - obj->vy = 0; + obj->_vy = 0; } - if ((obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating)) + if ((obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) storeBoundary(x1, x2, y2); // Re-store our own boundary - obj->x += dx; // Update object position - obj->y += dy; + obj->_x += dx; // Update object position + obj->_y += dy; // Don't let object go outside screen if (x1 < kEdge) - obj->x = kEdge2; + obj->_x = kEdge2; if (x2 > (kXPix - kEdge)) - obj->x = kXPix - kEdge2 - (x2 - x1); + obj->_x = kXPix - kEdge2 - (x2 - x1); if (y1 < kEdge) - obj->y = kEdge2; + obj->_y = kEdge2; if (y2 > (kYPix - kEdge)) - obj->y = kYPix - kEdge2 - (y2 - y1); + obj->_y = kYPix - kEdge2 - (y2 - y1); - if ((obj->vx == 0) && (obj->vy == 0) && (obj->pathType != kPathWander2) && (obj->pathType != kPathChase2)) - obj->cycling = kCycleNotCycling; + if ((obj->_vx == 0) && (obj->_vy == 0) && (obj->_pathType != kPathWander2) && (obj->_pathType != kPathChase2)) + obj->_cycling = kCycleNotCycling; } } // Clear all object baselines from the boundary file. for (int i = 0; i < _numObj; i++) { object_t *obj = &_objects[i]; // Get pointer to object - seq_t *currImage = obj->currImagePtr; // Get ptr to current image - if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling > kCycleAlmostInvisible) && (obj->priority == kPriorityFloating)) - clearBoundary(obj->oldx + currImage->x1, obj->oldx + currImage->x2, obj->oldy + currImage->y2); + seq_t *currImage = obj->_currImagePtr; // Get ptr to current image + if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) + clearBoundary(obj->_oldx + currImage->_x1, obj->_oldx + currImage->_x2, obj->_oldy + currImage->_y2); } // If maze mode is enabled, do special maze processing - if (_vm->_maze.enabledFl) { - seq_t *currImage = _vm->_hero->currImagePtr;// Get ptr to current image + if (_vm->_maze._enabledFl) { + seq_t *currImage = _vm->_hero->_currImagePtr;// Get ptr to current image // hero coordinates - int x1 = _vm->_hero->x + currImage->x1; // Left edge of object - int x2 = _vm->_hero->x + currImage->x2; // Right edge - int y1 = _vm->_hero->y + currImage->y1; // Top edge - int y2 = _vm->_hero->y + currImage->y2; // Bottom edge + int x1 = _vm->_hero->_x + currImage->_x1; // Left edge of object + int x2 = _vm->_hero->_x + currImage->_x2; // Right edge + int y1 = _vm->_hero->_y + currImage->_y1; // Top edge + int y2 = _vm->_hero->_y + currImage->_y2; // Bottom edge _vm->_scheduler->processMaze(x1, x2, y1, y2); } @@ -252,15 +252,15 @@ void ObjectHandler_v3d::swapImages(int objIndex1, int objIndex2) { seqList_t tmpSeqList[kMaxSeqNumb]; int seqListSize = sizeof(seqList_t) * kMaxSeqNumb; - memmove(tmpSeqList, _objects[objIndex1].seqList, seqListSize); - memmove(_objects[objIndex1].seqList, _objects[objIndex2].seqList, seqListSize); - memmove(_objects[objIndex2].seqList, tmpSeqList, seqListSize); + memmove(tmpSeqList, _objects[objIndex1]._seqList, seqListSize); + memmove(_objects[objIndex1]._seqList, _objects[objIndex2]._seqList, seqListSize); + memmove(_objects[objIndex2]._seqList, tmpSeqList, seqListSize); restoreSeq(&_objects[objIndex1]); - _objects[objIndex2].currImagePtr = _objects[objIndex2].seqList[0].seqPtr; + _objects[objIndex2]._currImagePtr = _objects[objIndex2]._seqList[0]._seqPtr; _vm->_heroImage = (_vm->_heroImage == kHeroIndex) ? objIndex2 : kHeroIndex; // Make sure baseline stays constant - _objects[objIndex1].y += _objects[objIndex2].currImagePtr->y2 - _objects[objIndex1].currImagePtr->y2; + _objects[objIndex1]._y += _objects[objIndex2]._currImagePtr->_y2 - _objects[objIndex1]._currImagePtr->_y2; } } // End of namespace Hugo diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp index 4eaed6fecf..b4255e607b 100644 --- a/engines/hugo/parser.cpp +++ b/engines/hugo/parser.cpp @@ -58,21 +58,21 @@ Parser::~Parser() { } uint16 Parser::getCmdDefaultVerbIdx(const uint16 index) const { - return _cmdList[index][0].verbIndex; + return _cmdList[index][0]._verbIndex; } /** * Read a cmd structure from Hugo.dat */ void Parser::readCmd(Common::ReadStream &in, cmd &curCmd) { - curCmd.verbIndex = in.readUint16BE(); - curCmd.reqIndex = in.readUint16BE(); - curCmd.textDataNoCarryIndex = in.readUint16BE(); - curCmd.reqState = in.readByte(); - curCmd.newState = in.readByte(); - curCmd.textDataWrongIndex = in.readUint16BE(); - curCmd.textDataDoneIndex = in.readUint16BE(); - curCmd.actIndex = in.readUint16BE(); + curCmd._verbIndex = in.readUint16BE(); + curCmd._reqIndex = in.readUint16BE(); + curCmd._textDataNoCarryIndex = in.readUint16BE(); + curCmd._reqState = in.readByte(); + curCmd._newState = in.readByte(); + curCmd._textDataWrongIndex = in.readUint16BE(); + curCmd._textDataDoneIndex = in.readUint16BE(); + curCmd._actIndex = in.readUint16BE(); } /** @@ -100,12 +100,12 @@ void Parser::loadCmdList(Common::ReadStream &in) { void Parser::readBG(Common::ReadStream &in, background_t &curBG) { - curBG.verbIndex = in.readUint16BE(); - curBG.nounIndex = in.readUint16BE(); - curBG.commentIndex = in.readSint16BE(); - curBG.matchFl = (in.readByte() != 0); - curBG.roomState = in.readByte(); - curBG.bonusIndex = in.readByte(); + curBG._verbIndex = in.readUint16BE(); + curBG._nounIndex = in.readUint16BE(); + curBG._commentIndex = in.readSint16BE(); + curBG._matchFl = (in.readByte() != 0); + curBG._roomState = in.readByte(); + curBG._bonusIndex = in.readByte(); } /** @@ -165,11 +165,11 @@ const char *Parser::useBG(const char *name) { debugC(1, kDebugEngine, "useBG(%s)", name); objectList_t p = _backgroundObjects[*_vm->_screen_p]; - for (int i = 0; p[i].verbIndex != 0; i++) { - if ((name == _vm->_text->getNoun(p[i].nounIndex, 0) && - p[i].verbIndex != _vm->_look) && - ((p[i].roomState == kStateDontCare) || (p[i].roomState == _vm->_screenStates[*_vm->_screen_p]))) - return _vm->_text->getVerb(p[i].verbIndex, 0); + for (int i = 0; p[i]._verbIndex != 0; i++) { + if ((name == _vm->_text->getNoun(p[i]._nounIndex, 0) && + p[i]._verbIndex != _vm->_look) && + ((p[i]._roomState == kStateDontCare) || (p[i]._roomState == _vm->_screenStates[*_vm->_screen_p]))) + return _vm->_text->getVerb(p[i]._verbIndex, 0); } return 0; @@ -222,7 +222,7 @@ void Parser::charHandler() { _cmdLine[--_cmdLineIndex] = '\0'; break; case Common::KEYCODE_RETURN: // EOL, pass line to line handler - if (_cmdLineIndex && (_vm->_hero->pathType != kPathQuiet)) { + if (_cmdLineIndex && (_vm->_hero->_pathType != kPathQuiet)) { // Remove inventory bar if active if (_vm->_inventory->getInventoryState() == kInventoryActive) _vm->_inventory->setInventoryState(kInventoryUp); @@ -248,9 +248,9 @@ void Parser::charHandler() { _cmdLineCursor = (_cmdLineCursor == '_') ? ' ' : '_'; // See if recall button pressed - if (gameStatus.recallFl) { + if (gameStatus._recallFl) { // Copy previous line to current cmdline - gameStatus.recallFl = false; + gameStatus._recallFl = false; strcpy(_cmdLine, _vm->_line); _cmdLineIndex = strlen(_cmdLine); } @@ -259,9 +259,9 @@ void Parser::charHandler() { sprintf(_vm->_scoreLine, "F1-Help %s Score: %d of %d Sound %s", (_vm->_config.turboFl) ? "T" : " ", _vm->getScore(), _vm->getMaxScore(), (_vm->_config.soundFl) ? "On" : "Off"); // See if "look" button pressed - if (gameStatus.lookFl) { + if (gameStatus._lookFl) { command("look around"); - gameStatus.lookFl = false; + gameStatus._lookFl = false; } } @@ -288,8 +288,8 @@ void Parser::keyHandler(Common::Event event) { _vm->_file->restoreGame(0); break; case Common::KEYCODE_s: - if (gameStatus.viewState == kViewPlay) { - if (gameStatus.gameOverFl) + if (gameStatus._viewState == kViewPlay) { + if (gameStatus._gameOverFl) _vm->gameOverMsg(); else _vm->_file->saveGame(-1, Common::String()); @@ -304,8 +304,8 @@ void Parser::keyHandler(Common::Event event) { // Process key down event - called from OnKeyDown() switch (nChar) { // Set various toggle states case Common::KEYCODE_ESCAPE: // Escape key, may want to QUIT - if (gameStatus.viewState == kViewIntro) - gameStatus.skipIntroFl = true; + if (gameStatus._viewState == kViewIntro) + gameStatus._skipIntroFl = true; else { if (_vm->_inventory->getInventoryState() == kInventoryActive) // Remove inventory, if displayed _vm->_inventory->setInventoryState(kInventoryUp); @@ -333,7 +333,7 @@ void Parser::keyHandler(Common::Event event) { break; case Common::KEYCODE_F1: // User Help (DOS) if (_checkDoubleF1Fl) - gameStatus.helpFl = true; + gameStatus._helpFl = true; else _vm->_screen->userHelp(); _checkDoubleF1Fl = !_checkDoubleF1Fl; @@ -343,11 +343,11 @@ void Parser::keyHandler(Common::Event event) { _vm->_sound->toggleMusic(); break; case Common::KEYCODE_F3: // Repeat last line - gameStatus.recallFl = true; + gameStatus._recallFl = true; break; case Common::KEYCODE_F4: // Save game - if (gameStatus.viewState == kViewPlay) { - if (gameStatus.gameOverFl) + if (gameStatus._viewState == kViewPlay) { + if (gameStatus._gameOverFl) _vm->gameOverMsg(); else _vm->_file->saveGame(-1, Common::String()); @@ -366,7 +366,7 @@ void Parser::keyHandler(Common::Event event) { warning("STUB: F9 (DOS) - BossKey"); break; default: // Any other key - if (!gameStatus.storyModeFl) { // Keyboard disabled + if (!gameStatus._storyModeFl) { // Keyboard disabled // Add printable keys to ring buffer uint16 bnext = _putIndex + 1; if (bnext >= sizeof(_ringBuffer)) @@ -452,7 +452,7 @@ void Parser::showDosInventory() const { for (int i = 0; i < _vm->_object->_numObj; i++) { // Find widths of 2 columns if (_vm->_object->isCarried(i)) { - uint16 len = strlen(_vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2)); + uint16 len = strlen(_vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 2)); if (index++ & 1) // Right hand column len2 = (len > len2) ? len : len2; else @@ -473,9 +473,9 @@ void Parser::showDosInventory() const { for (int i = 0; i < _vm->_object->_numObj; i++) { // Assign strings if (_vm->_object->isCarried(i)) { if (index++ & 1) - buffer += Common::String(_vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2)) + "\n"; + buffer += Common::String(_vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 2)) + "\n"; else - buffer += Common::String(_vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2)) + Common::String(blanks, len1 - strlen(_vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2))); + buffer += Common::String(_vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 2)) + Common::String(blanks, len1 - strlen(_vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 2))); } } if (index & 1) diff --git a/engines/hugo/parser.h b/engines/hugo/parser.h index f8b9d9f13b..18f4916b1e 100644 --- a/engines/hugo/parser.h +++ b/engines/hugo/parser.h @@ -48,14 +48,14 @@ enum seqTextParser { * The following determines how a verb is acted on, for an object */ struct cmd { - uint16 verbIndex; // the verb - uint16 reqIndex; // ptr to list of required objects - uint16 textDataNoCarryIndex; // ptr to string if any of above not carried - byte reqState; // required state for verb to be done - byte newState; // new states if verb done - uint16 textDataWrongIndex; // ptr to string if wrong state - uint16 textDataDoneIndex; // ptr to string if verb done - uint16 actIndex; // Ptr to action list if verb done + uint16 _verbIndex; // the verb + uint16 _reqIndex; // ptr to list of required objects + uint16 _textDataNoCarryIndex; // ptr to string if any of above not carried + byte _reqState; // required state for verb to be done + byte _newState; // new states if verb done + uint16 _textDataWrongIndex; // ptr to string if wrong state + uint16 _textDataDoneIndex; // ptr to string if verb done + uint16 _actIndex; // Ptr to action list if verb done }; /** @@ -65,12 +65,12 @@ struct cmd { * "don't understand" we produce an interesting msg to keep user sane. */ struct background_t { - uint16 verbIndex; - uint16 nounIndex; - int commentIndex; // Index of comment produced on match - bool matchFl; // TRUE if noun must match when present - byte roomState; // "State" of room. Comments might differ. - byte bonusIndex; // Index of bonus score (0 = no bonus) + uint16 _verbIndex; + uint16 _nounIndex; + int _commentIndex; // Index of comment produced on match + bool _matchFl; // TRUE if noun must match when present + byte _roomState; // "State" of room. Comments might differ. + byte _bonusIndex; // Index of bonus score (0 = no bonus) }; typedef background_t *objectList_t; diff --git a/engines/hugo/parser_v1d.cpp b/engines/hugo/parser_v1d.cpp index ccd428311b..aa43cce536 100644 --- a/engines/hugo/parser_v1d.cpp +++ b/engines/hugo/parser_v1d.cpp @@ -81,32 +81,32 @@ const char *Parser_v1d::findNextNoun(const char *noun) const { bool Parser_v1d::isNear_v1(const char *verb, const 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 + if (!noun && !obj->_verbOnlyFl) { // No noun specified & object not context senesitive return false; - } else if (noun && (noun != _vm->_text->getNoun(obj->nounIndex, 0))) { // Noun specified & not same as object + } else if (noun && (noun != _vm->_text->getNoun(obj->_nounIndex, 0))) { // Noun specified & not same as object return false; - } else if (obj->carriedFl) { // Object is being carried + } else if (obj->_carriedFl) { // Object is being carried return true; - } else if (obj->screenIndex != *_vm->_screen_p) { // Not in same screen - if (obj->objValue) + } else if (obj->_screenIndex != *_vm->_screen_p) { // Not in same screen + if (obj->_objValue) strcpy (comment, _vm->_text->getTextParser(kCmtAny4)); return false; } - if (obj->cycling == kCycleInvisible) { - if (obj->seqNumb) { // There is an image + if (obj->_cycling == kCycleInvisible) { + if (obj->_seqNumb) { // There is an image strcpy(comment, _vm->_text->getTextParser(kCmtAny5)); return false; } else { // No image, assume visible - if ((obj->radius < 0) || - ((abs(obj->x - _vm->_hero->x) <= obj->radius) && - (abs(obj->y - _vm->_hero->y - _vm->_hero->currImagePtr->y2) <= obj->radius))) { + if ((obj->_radius < 0) || + ((abs(obj->_x - _vm->_hero->_x) <= obj->_radius) && + (abs(obj->_y - _vm->_hero->_y - _vm->_hero->_currImagePtr->_y2) <= obj->_radius))) { return true; } else { // User is either not close enough (stationary, valueless objects) // or is not carrying it (small, portable objects of value) if (noun) { // Don't say unless object specified - if (obj->objValue && (verb != _vm->_text->getVerb(_vm->_take, 0))) + if (obj->_objValue && (verb != _vm->_text->getVerb(_vm->_take, 0))) strcpy(comment, _vm->_text->getTextParser(kCmtAny4)); else strcpy(comment, _vm->_text->getTextParser(kCmtClose)); @@ -116,15 +116,15 @@ bool Parser_v1d::isNear_v1(const char *verb, const char *noun, object_t *obj, ch } } - if ((obj->radius < 0) || - ((abs(obj->x - _vm->_hero->x) <= obj->radius) && - (abs(obj->y + obj->currImagePtr->y2 - _vm->_hero->y - _vm->_hero->currImagePtr->y2) <= obj->radius))) { + if ((obj->_radius < 0) || + ((abs(obj->_x - _vm->_hero->_x) <= obj->_radius) && + (abs(obj->_y + obj->_currImagePtr->_y2 - _vm->_hero->_y - _vm->_hero->_currImagePtr->_y2) <= obj->_radius))) { return true; } else { // User is either not close enough (stationary, valueless objects) // or is not carrying it (small, portable objects of value) if (noun) { // Don't say unless object specified - if (obj->objValue && (verb != _vm->_text->getVerb(_vm->_take, 0))) + if (obj->_objValue && (verb != _vm->_text->getVerb(_vm->_take, 0))) strcpy(comment, _vm->_text->getTextParser(kCmtAny4)); else strcpy(comment, _vm->_text->getTextParser(kCmtClose)); @@ -143,28 +143,28 @@ bool Parser_v1d::isNear_v1(const char *verb, const char *noun, object_t *obj, ch bool Parser_v1d::isGenericVerb_v1(const char *word, object_t *obj) { debugC(1, kDebugParser, "isGenericVerb(%s, object_t *obj)", word); - if (!obj->genericCmd) + if (!obj->_genericCmd) return false; // Following is equivalent to switch, but couldn't do one if (word == _vm->_text->getVerb(_vm->_look, 0)) { - if ((LOOK & obj->genericCmd) == LOOK) - Utils::notifyBox(_vm->_text->getTextData(obj->dataIndex)); + if ((LOOK & obj->_genericCmd) == LOOK) + Utils::notifyBox(_vm->_text->getTextData(obj->_dataIndex)); else Utils::notifyBox(_vm->_text->getTextParser(kTBUnusual_1d)); } else if (word == _vm->_text->getVerb(_vm->_take, 0)) { - if (obj->carriedFl) + if (obj->_carriedFl) Utils::notifyBox(_vm->_text->getTextParser(kTBHave)); - else if ((TAKE & obj->genericCmd) == TAKE) + else if ((TAKE & obj->_genericCmd) == TAKE) takeObject(obj); - else if (!obj->verbOnlyFl) // Make sure not taking object in context! + else if (!obj->_verbOnlyFl) // Make sure not taking object in context! Utils::notifyBox(_vm->_text->getTextParser(kTBNoUse)); else return false; } else if (word == _vm->_text->getVerb(_vm->_drop, 0)) { - if (!obj->carriedFl) + if (!obj->_carriedFl) Utils::notifyBox(_vm->_text->getTextParser(kTBDontHave)); - else if ((DROP & obj->genericCmd) == DROP) + else if ((DROP & obj->_genericCmd) == DROP) dropObject(obj); else Utils::notifyBox(_vm->_text->getTextParser(kTBNeed)); @@ -185,42 +185,42 @@ bool Parser_v1d::isObjectVerb_v1(const char *word, object_t *obj) { debugC(1, kDebugParser, "isObjectVerb(%s, object_t *obj)", word); // First, find matching verb in cmd list - uint16 cmdIndex = obj->cmdIndex; // ptr to list of commands + uint16 cmdIndex = obj->_cmdIndex; // ptr to list of commands if (!cmdIndex) // No commands for this obj return false; int i; - for (i = 0; _cmdList[cmdIndex][i].verbIndex != 0; i++) { // For each cmd - if (!strcmp(word, _vm->_text->getVerb(_cmdList[cmdIndex][i].verbIndex, 0))) // Is this verb catered for? + for (i = 0; _cmdList[cmdIndex][i]._verbIndex != 0; i++) { // For each cmd + if (!strcmp(word, _vm->_text->getVerb(_cmdList[cmdIndex][i]._verbIndex, 0))) // Is this verb catered for? break; } - if (_cmdList[cmdIndex][i].verbIndex == 0) // No + if (_cmdList[cmdIndex][i]._verbIndex == 0) // No return false; // Verb match found, check all required objects are being carried cmd *cmnd = &_cmdList[cmdIndex][i]; // ptr to struct cmd - if (cmnd->reqIndex) { // At least 1 thing in list - uint16 *reqs = _arrayReqs[cmnd->reqIndex]; // ptr to list of required objects + if (cmnd->_reqIndex) { // At least 1 thing in list + uint16 *reqs = _arrayReqs[cmnd->_reqIndex]; // ptr to list of required objects for (i = 0; reqs[i]; i++) { // for each obj if (!_vm->_object->isCarrying(reqs[i])) { - Utils::notifyBox(_vm->_text->getTextData(cmnd->textDataNoCarryIndex)); + Utils::notifyBox(_vm->_text->getTextData(cmnd->_textDataNoCarryIndex)); return true; } } } // Required objects are present, now check state is correct - if ((obj->state != cmnd->reqState) && (cmnd->reqState != kStateDontCare)){ - Utils::notifyBox(_vm->_text->getTextData(cmnd->textDataWrongIndex)); + if ((obj->_state != cmnd->_reqState) && (cmnd->_reqState != kStateDontCare)){ + Utils::notifyBox(_vm->_text->getTextData(cmnd->_textDataWrongIndex)); return true; } // Everything checked. Change the state and carry out any actions - if (cmnd->reqState != kStateDontCare) // Don't change new state if required state didn't care - obj->state = cmnd->newState; - Utils::notifyBox(_vm->_text->getTextData(cmnd->textDataDoneIndex)); - _vm->_scheduler->insertActionList(cmnd->actIndex); + if (cmnd->_reqState != kStateDontCare) // Don't change new state if required state didn't care + obj->_state = cmnd->_newState; + Utils::notifyBox(_vm->_text->getTextData(cmnd->_textDataDoneIndex)); + _vm->_scheduler->insertActionList(cmnd->_actIndex); // Special case if verb is Take or Drop. Assume additional generic actions if ((word == _vm->_text->getVerb(_vm->_take, 0)) || (word == _vm->_text->getVerb(_vm->_drop, 0))) isGenericVerb_v1(word, obj); @@ -237,9 +237,9 @@ bool Parser_v1d::isBackgroundWord_v1(const char *noun, const char *verb, objectL if (!noun) return false; - for (int i = 0; obj[i].verbIndex; i++) { - if ((verb == _vm->_text->getVerb(obj[i].verbIndex, 0)) && (noun == _vm->_text->getNoun(obj[i].nounIndex, 0))) { - Utils::notifyBox(_vm->_file->fetchString(obj[i].commentIndex)); + for (int i = 0; obj[i]._verbIndex; i++) { + if ((verb == _vm->_text->getVerb(obj[i]._verbIndex, 0)) && (noun == _vm->_text->getNoun(obj[i]._nounIndex, 0))) { + Utils::notifyBox(_vm->_file->fetchString(obj[i]._commentIndex)); return true; } } @@ -252,13 +252,13 @@ bool Parser_v1d::isBackgroundWord_v1(const char *noun, const char *verb, objectL void Parser_v1d::takeObject(object_t *obj) { debugC(1, kDebugParser, "takeObject(object_t *obj)"); - obj->carriedFl = true; - if (obj->seqNumb) // Don't change if no image to display - obj->cycling = kCycleAlmostInvisible; + obj->_carriedFl = true; + if (obj->_seqNumb) // Don't change if no image to display + obj->_cycling = kCycleAlmostInvisible; - _vm->adjustScore(obj->objValue); + _vm->adjustScore(obj->_objValue); - Utils::notifyBox(Common::String::format(TAKE_TEXT, _vm->_text->getNoun(obj->nounIndex, TAKE_NAME))); + Utils::notifyBox(Common::String::format(TAKE_TEXT, _vm->_text->getNoun(obj->_nounIndex, TAKE_NAME))); } /** @@ -267,13 +267,13 @@ void Parser_v1d::takeObject(object_t *obj) { void Parser_v1d::dropObject(object_t *obj) { debugC(1, kDebugParser, "dropObject(object_t *obj)"); - obj->carriedFl = false; - obj->screenIndex = *_vm->_screen_p; - if (obj->seqNumb) // Don't change if no image to display - obj->cycling = kCycleNotCycling; - obj->x = _vm->_hero->x - 1; - obj->y = _vm->_hero->y + _vm->_hero->currImagePtr->y2 - 1; - _vm->adjustScore(-obj->objValue); + obj->_carriedFl = false; + obj->_screenIndex = *_vm->_screen_p; + if (obj->_seqNumb) // Don't change if no image to display + obj->_cycling = kCycleNotCycling; + obj->_x = _vm->_hero->_x - 1; + obj->_y = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2 - 1; + _vm->adjustScore(-obj->_objValue); Utils::notifyBox(_vm->_text->getTextParser(kTBOk)); } @@ -284,15 +284,15 @@ void Parser_v1d::dropObject(object_t *obj) { bool Parser_v1d::isCatchallVerb_v1(bool testNounFl, const char *noun, const char *verb, objectList_t obj) const { debugC(1, kDebugParser, "isCatchallVerb(%d, %s, %s, object_list_t obj)", (testNounFl) ? 1 : 0, noun, verb); - if (_vm->_maze.enabledFl) + if (_vm->_maze._enabledFl) return false; if (testNounFl && !noun) return false; - for (int i = 0; obj[i].verbIndex; i++) { - if ((verb == _vm->_text->getVerb(obj[i].verbIndex, 0)) && ((noun == _vm->_text->getNoun(obj[i].nounIndex, 0)) || (obj[i].nounIndex == 0))) { - Utils::notifyBox(_vm->_file->fetchString(obj[i].commentIndex)); + for (int i = 0; obj[i]._verbIndex; i++) { + if ((verb == _vm->_text->getVerb(obj[i]._verbIndex, 0)) && ((noun == _vm->_text->getNoun(obj[i]._nounIndex, 0)) || (obj[i]._nounIndex == 0))) { + Utils::notifyBox(_vm->_file->fetchString(obj[i]._commentIndex)); return true; } } @@ -310,7 +310,7 @@ void Parser_v1d::lineHandler() { // Toggle God Mode if (!strncmp(_vm->_line, "PPG", 3)) { _vm->_sound->playSound(!_vm->_soundTest, kSoundPriorityHigh); - gameStatus.godModeFl = !gameStatus.godModeFl; + gameStatus._godModeFl = !gameStatus._godModeFl; return; } @@ -321,7 +321,7 @@ void Parser_v1d::lineHandler() { // fetch Hero carries named object // fetch all Hero carries all possible objects // find Takes hero to screen containing named object - if (gameStatus.godModeFl) { + if (gameStatus._godModeFl) { // Special code to allow me to go straight to any screen if (strstr(_vm->_line, "goto")) { for (int i = 0; i < _vm->_numScreens; i++) { @@ -335,7 +335,7 @@ void Parser_v1d::lineHandler() { // Special code to allow me to get objects from anywhere if (strstr(_vm->_line, "fetch all")) { for (int i = 0; i < _vm->_object->_numObj; i++) { - if (_vm->_object->_objects[i].genericCmd & TAKE) + if (_vm->_object->_objects[i]._genericCmd & TAKE) takeObject(&_vm->_object->_objects[i]); } return; @@ -343,7 +343,7 @@ void Parser_v1d::lineHandler() { if (strstr(_vm->_line, "fetch")) { for (int i = 0; i < _vm->_object->_numObj; i++) { - if (!scumm_stricmp(&_vm->_line[strlen("fetch") + 1], _vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 0))) { + if (!scumm_stricmp(&_vm->_line[strlen("fetch") + 1], _vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 0))) { takeObject(&_vm->_object->_objects[i]); return; } @@ -353,8 +353,8 @@ void Parser_v1d::lineHandler() { // Special code to allow me to goto objects if (strstr(_vm->_line, "find")) { for (int i = 0; i < _vm->_object->_numObj; i++) { - if (!scumm_stricmp(&_vm->_line[strlen("find") + 1], _vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 0))) { - _vm->_scheduler->newScreen(_vm->_object->_objects[i].screenIndex); + if (!scumm_stricmp(&_vm->_line[strlen("find") + 1], _vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 0))) { + _vm->_scheduler->newScreen(_vm->_object->_objects[i]._screenIndex); return; } } @@ -369,7 +369,7 @@ void Parser_v1d::lineHandler() { // SAVE/RESTORE if (!strcmp("save", _vm->_line)) { - if (gameStatus.gameOverFl) + if (gameStatus._gameOverFl) _vm->gameOverMsg(); else _vm->_file->saveGame(-1, Common::String()); @@ -387,7 +387,7 @@ void Parser_v1d::lineHandler() { if (strspn(_vm->_line, " ") == strlen(_vm->_line)) // Nothing but spaces! return; - if (gameStatus.gameOverFl) { + if (gameStatus._gameOverFl) { // No commands allowed! _vm->gameOverMsg(); return; @@ -425,8 +425,8 @@ void Parser_v1d::lineHandler() { void Parser_v1d::showInventory() const { status_t &gameStatus = _vm->getGameStatus(); - if (gameStatus.viewState == kViewPlay) { - if (gameStatus.gameOverFl) + if (gameStatus._viewState == kViewPlay) { + if (gameStatus._gameOverFl) _vm->gameOverMsg(); else showDosInventory(); diff --git a/engines/hugo/parser_v1w.cpp b/engines/hugo/parser_v1w.cpp index b1657c3bf4..832e6fd1b0 100644 --- a/engines/hugo/parser_v1w.cpp +++ b/engines/hugo/parser_v1w.cpp @@ -61,7 +61,7 @@ void Parser_v1w::lineHandler() { // Toggle God Mode if (!strncmp(_vm->_line, "PPG", 3)) { _vm->_sound->playSound(!_vm->_soundTest, kSoundPriorityHigh); - gameStatus.godModeFl = !gameStatus.godModeFl; + gameStatus._godModeFl = !gameStatus._godModeFl; return; } @@ -72,7 +72,7 @@ void Parser_v1w::lineHandler() { // fetch Hero carries named object // fetch all Hero carries all possible objects // find Takes hero to screen containing named object - if (gameStatus.godModeFl) { + if (gameStatus._godModeFl) { // Special code to allow me to go straight to any screen if (strstr(_vm->_line, "goto")) { for (int i = 0; i < _vm->_numScreens; i++) { @@ -86,7 +86,7 @@ void Parser_v1w::lineHandler() { // Special code to allow me to get objects from anywhere if (strstr(_vm->_line, "fetch all")) { for (int i = 0; i < _vm->_object->_numObj; i++) { - if (_vm->_object->_objects[i].genericCmd & TAKE) + if (_vm->_object->_objects[i]._genericCmd & TAKE) takeObject(&_vm->_object->_objects[i]); } return; @@ -94,7 +94,7 @@ void Parser_v1w::lineHandler() { if (strstr(_vm->_line, "fetch")) { for (int i = 0; i < _vm->_object->_numObj; i++) { - if (!scumm_stricmp(&_vm->_line[strlen("fetch") + 1], _vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 0))) { + if (!scumm_stricmp(&_vm->_line[strlen("fetch") + 1], _vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 0))) { takeObject(&_vm->_object->_objects[i]); return; } @@ -104,8 +104,8 @@ void Parser_v1w::lineHandler() { // Special code to allow me to goto objects if (strstr(_vm->_line, "find")) { for (int i = 0; i < _vm->_object->_numObj; i++) { - if (!scumm_stricmp(&_vm->_line[strlen("find") + 1], _vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 0))) { - _vm->_scheduler->newScreen(_vm->_object->_objects[i].screenIndex); + if (!scumm_stricmp(&_vm->_line[strlen("find") + 1], _vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 0))) { + _vm->_scheduler->newScreen(_vm->_object->_objects[i]._screenIndex); return; } } @@ -121,12 +121,12 @@ void Parser_v1w::lineHandler() { } // SAVE/RESTORE - if (!strcmp("save", _vm->_line) && gameStatus.viewState == kViewPlay) { + if (!strcmp("save", _vm->_line) && gameStatus._viewState == kViewPlay) { _vm->_file->saveGame(-1, Common::String()); return; } - if (!strcmp("restore", _vm->_line) && (gameStatus.viewState == kViewPlay || gameStatus.viewState == kViewIdle)) { + if (!strcmp("restore", _vm->_line) && (gameStatus._viewState == kViewPlay || gameStatus._viewState == kViewIdle)) { _vm->_file->restoreGame(-1); return; } @@ -137,7 +137,7 @@ void Parser_v1w::lineHandler() { if (strspn(_vm->_line, " ") == strlen(_vm->_line)) // Nothing but spaces! return; - if (gameStatus.gameOverFl) { + if (gameStatus._gameOverFl) { // No commands allowed! _vm->gameOverMsg(); return; @@ -148,7 +148,7 @@ void Parser_v1w::lineHandler() { // Test for nearby objects referenced explicitly for (int i = 0; i < _vm->_object->_numObj; i++) { object_t *obj = &_vm->_object->_objects[i]; - if (isWordPresent(_vm->_text->getNounArray(obj->nounIndex))) { + if (isWordPresent(_vm->_text->getNounArray(obj->_nounIndex))) { if (isObjectVerb_v3(obj, farComment) || isGenericVerb_v3(obj, farComment)) return; } @@ -158,7 +158,7 @@ void Parser_v1w::lineHandler() { // Note comment is unused if not near. for (int i = 0; i < _vm->_object->_numObj; i++) { object_t *obj = &_vm->_object->_objects[i]; - if (obj->verbOnlyFl) { + if (obj->_verbOnlyFl) { char contextComment[kCompLineSize * 5] = ""; // Unused comment for context objects if (isObjectVerb_v3(obj, contextComment) || isGenericVerb_v3(obj, contextComment)) return; @@ -185,7 +185,7 @@ void Parser_v1w::lineHandler() { // Nothing matches. Report recognition success to user. const char *verb = findVerb(); const char *noun = findNoun(); - if (verb == _vm->_text->getVerb(_vm->_look, 0) && _vm->_maze.enabledFl) { + if (verb == _vm->_text->getVerb(_vm->_look, 0) && _vm->_maze._enabledFl) { Utils::notifyBox(_vm->_text->getTextParser(kTBMaze)); _vm->_object->showTakeables(); } else if (verb && noun) { // A combination I didn't think of @@ -202,14 +202,14 @@ void Parser_v1w::lineHandler() { void Parser_v1w::showInventory() const { status_t &gameStatus = _vm->getGameStatus(); istate_t inventState = _vm->_inventory->getInventoryState(); - if (gameStatus.gameOverFl) { + if (gameStatus._gameOverFl) { _vm->gameOverMsg(); - } else if ((inventState == kInventoryOff) && (gameStatus.viewState == kViewPlay)) { + } else if ((inventState == kInventoryOff) && (gameStatus._viewState == kViewPlay)) { _vm->_inventory->setInventoryState(kInventoryDown); - gameStatus.viewState = kViewInvent; + gameStatus._viewState = kViewInvent; } else if (inventState == kInventoryActive) { _vm->_inventory->setInventoryState(kInventoryUp); - gameStatus.viewState = kViewInvent; + gameStatus._viewState = kViewInvent; } } diff --git a/engines/hugo/parser_v2d.cpp b/engines/hugo/parser_v2d.cpp index 0095c4d726..2daf3c5e9f 100644 --- a/engines/hugo/parser_v2d.cpp +++ b/engines/hugo/parser_v2d.cpp @@ -60,7 +60,7 @@ void Parser_v2d::lineHandler() { // Toggle God Mode if (!strncmp(_vm->_line, "PPG", 3)) { _vm->_sound->playSound(!_vm->_soundTest, kSoundPriorityHigh); - gameStatus.godModeFl = !gameStatus.godModeFl; + gameStatus._godModeFl = !gameStatus._godModeFl; return; } @@ -71,7 +71,7 @@ void Parser_v2d::lineHandler() { // fetch Hero carries named object // fetch all Hero carries all possible objects // find Takes hero to screen containing named object - if (gameStatus.godModeFl) { + if (gameStatus._godModeFl) { // Special code to allow me to go straight to any screen if (strstr(_vm->_line, "goto")) { for (int i = 0; i < _vm->_numScreens; i++) { @@ -85,7 +85,7 @@ void Parser_v2d::lineHandler() { // Special code to allow me to get objects from anywhere if (strstr(_vm->_line, "fetch all")) { for (int i = 0; i < _vm->_object->_numObj; i++) { - if (_vm->_object->_objects[i].genericCmd & TAKE) + if (_vm->_object->_objects[i]._genericCmd & TAKE) takeObject(&_vm->_object->_objects[i]); } return; @@ -93,7 +93,7 @@ void Parser_v2d::lineHandler() { if (strstr(_vm->_line, "fetch")) { for (int i = 0; i < _vm->_object->_numObj; i++) { - if (!scumm_stricmp(&_vm->_line[strlen("fetch") + 1], _vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 0))) { + if (!scumm_stricmp(&_vm->_line[strlen("fetch") + 1], _vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 0))) { takeObject(&_vm->_object->_objects[i]); return; } @@ -103,8 +103,8 @@ void Parser_v2d::lineHandler() { // Special code to allow me to goto objects if (strstr(_vm->_line, "find")) { for (int i = 0; i < _vm->_object->_numObj; i++) { - if (!scumm_stricmp(&_vm->_line[strlen("find") + 1], _vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 0))) { - _vm->_scheduler->newScreen(_vm->_object->_objects[i].screenIndex); + if (!scumm_stricmp(&_vm->_line[strlen("find") + 1], _vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 0))) { + _vm->_scheduler->newScreen(_vm->_object->_objects[i]._screenIndex); return; } } @@ -119,7 +119,7 @@ void Parser_v2d::lineHandler() { // SAVE/RESTORE if (!strcmp("save", _vm->_line)) { - if (gameStatus.gameOverFl) + if (gameStatus._gameOverFl) _vm->gameOverMsg(); else _vm->_file->saveGame(-1, Common::String()); @@ -137,7 +137,7 @@ void Parser_v2d::lineHandler() { if (strspn(_vm->_line, " ") == strlen(_vm->_line)) // Nothing but spaces! return; - if (gameStatus.gameOverFl) { + if (gameStatus._gameOverFl) { // No commands allowed! _vm->gameOverMsg(); return; @@ -172,7 +172,7 @@ void Parser_v2d::lineHandler() { && !isCatchallVerb_v1(false, noun, verb, _catchallList)) { if (*farComment != '\0') { // An object matched but not near enough Utils::notifyBox(farComment); - } else if (_vm->_maze.enabledFl && (verb == _vm->_text->getVerb(_vm->_look, 0))) { + } else if (_vm->_maze._enabledFl && (verb == _vm->_text->getVerb(_vm->_look, 0))) { Utils::notifyBox(_vm->_text->getTextParser(kTBMaze)); _vm->_object->showTakeables(); } else if (verb && noun) { // A combination I didn't think of diff --git a/engines/hugo/parser_v3d.cpp b/engines/hugo/parser_v3d.cpp index b45e9186b3..abfe263f6e 100644 --- a/engines/hugo/parser_v3d.cpp +++ b/engines/hugo/parser_v3d.cpp @@ -60,7 +60,7 @@ void Parser_v3d::lineHandler() { // Toggle God Mode if (!strncmp(_vm->_line, "PPG", 3)) { _vm->_sound->playSound(!_vm->_soundTest, kSoundPriorityHigh); - gameStatus.godModeFl = !gameStatus.godModeFl; + gameStatus._godModeFl = !gameStatus._godModeFl; return; } @@ -71,7 +71,7 @@ void Parser_v3d::lineHandler() { // fetch Hero carries named object // fetch all Hero carries all possible objects // find Takes hero to screen containing named object - if (gameStatus.godModeFl) { + if (gameStatus._godModeFl) { // Special code to allow me to go straight to any screen if (strstr(_vm->_line, "goto")) { for (int i = 0; i < _vm->_numScreens; i++) { @@ -85,7 +85,7 @@ void Parser_v3d::lineHandler() { // Special code to allow me to get objects from anywhere if (strstr(_vm->_line, "fetch all")) { for (int i = 0; i < _vm->_object->_numObj; i++) { - if (_vm->_object->_objects[i].genericCmd & TAKE) + if (_vm->_object->_objects[i]._genericCmd & TAKE) takeObject(&_vm->_object->_objects[i]); } return; @@ -93,7 +93,7 @@ void Parser_v3d::lineHandler() { if (strstr(_vm->_line, "fetch")) { for (int i = 0; i < _vm->_object->_numObj; i++) { - if (!scumm_stricmp(&_vm->_line[strlen("fetch") + 1], _vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 0))) { + if (!scumm_stricmp(&_vm->_line[strlen("fetch") + 1], _vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 0))) { takeObject(&_vm->_object->_objects[i]); return; } @@ -103,8 +103,8 @@ void Parser_v3d::lineHandler() { // Special code to allow me to goto objects if (strstr(_vm->_line, "find")) { for (int i = 0; i < _vm->_object->_numObj; i++) { - if (!scumm_stricmp(&_vm->_line[strlen("find") + 1], _vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 0))) { - _vm->_scheduler->newScreen(_vm->_object->_objects[i].screenIndex); + if (!scumm_stricmp(&_vm->_line[strlen("find") + 1], _vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 0))) { + _vm->_scheduler->newScreen(_vm->_object->_objects[i]._screenIndex); return; } } @@ -121,7 +121,7 @@ void Parser_v3d::lineHandler() { // SAVE/RESTORE if (!strcmp("save", _vm->_line)) { - if (gameStatus.gameOverFl) + if (gameStatus._gameOverFl) _vm->gameOverMsg(); else _vm->_file->saveGame(-1, Common::String()); @@ -139,7 +139,7 @@ void Parser_v3d::lineHandler() { if (strspn(_vm->_line, " ") == strlen(_vm->_line)) // Nothing but spaces! return; - if (gameStatus.gameOverFl) { + if (gameStatus._gameOverFl) { // No commands allowed! _vm->gameOverMsg(); return; @@ -150,7 +150,7 @@ void Parser_v3d::lineHandler() { // Test for nearby objects referenced explicitly for (int i = 0; i < _vm->_object->_numObj; i++) { object_t *obj = &_vm->_object->_objects[i]; - if (isWordPresent(_vm->_text->getNounArray(obj->nounIndex))) { + if (isWordPresent(_vm->_text->getNounArray(obj->_nounIndex))) { if (isObjectVerb_v3(obj, farComment) || isGenericVerb_v3(obj, farComment)) return; } @@ -160,7 +160,7 @@ void Parser_v3d::lineHandler() { // Note comment is unused if not near. for (int i = 0; i < _vm->_object->_numObj; i++) { object_t *obj = &_vm->_object->_objects[i]; - if (obj->verbOnlyFl) { + if (obj->_verbOnlyFl) { char contextComment[kCompLineSize * 5] = ""; // Unused comment for context objects if (isObjectVerb_v3(obj, contextComment) || isGenericVerb_v3(obj, contextComment)) return; @@ -208,47 +208,47 @@ bool Parser_v3d::isObjectVerb_v3(object_t *obj, char *comment) { debugC(1, kDebugParser, "isObjectVerb(object_t *obj, %s)", comment); // First, find matching verb in cmd list - uint16 cmdIndex = obj->cmdIndex; // ptr to list of commands + uint16 cmdIndex = obj->_cmdIndex; // ptr to list of commands if (cmdIndex == 0) // No commands for this obj return false; int i; - for (i = 0; _cmdList[cmdIndex][i].verbIndex != 0; i++) { // For each cmd - if (isWordPresent(_vm->_text->getVerbArray(_cmdList[cmdIndex][i].verbIndex))) // Was this verb used? + for (i = 0; _cmdList[cmdIndex][i]._verbIndex != 0; i++) { // For each cmd + if (isWordPresent(_vm->_text->getVerbArray(_cmdList[cmdIndex][i]._verbIndex))) // Was this verb used? break; } - if (_cmdList[cmdIndex][i].verbIndex == 0) // No verbs used. + if (_cmdList[cmdIndex][i]._verbIndex == 0) // No verbs used. return false; // Verb match found. Check if object is Near - char *verb = *_vm->_text->getVerbArray(_cmdList[cmdIndex][i].verbIndex); + char *verb = *_vm->_text->getVerbArray(_cmdList[cmdIndex][i]._verbIndex); if (!isNear_v3(obj, verb, comment)) return false; // Check all required objects are being carried cmd *cmnd = &_cmdList[cmdIndex][i]; // ptr to struct cmd - if (cmnd->reqIndex) { // At least 1 thing in list - uint16 *reqs = _arrayReqs[cmnd->reqIndex]; // ptr to list of required objects + if (cmnd->_reqIndex) { // At least 1 thing in list + uint16 *reqs = _arrayReqs[cmnd->_reqIndex]; // ptr to list of required objects for (i = 0; reqs[i]; i++) { // for each obj if (!_vm->_object->isCarrying(reqs[i])) { - Utils::notifyBox(_vm->_text->getTextData(cmnd->textDataNoCarryIndex)); + Utils::notifyBox(_vm->_text->getTextData(cmnd->_textDataNoCarryIndex)); return true; } } } // Required objects are present, now check state is correct - if ((obj->state != cmnd->reqState) && (cmnd->reqState != kStateDontCare)) { - Utils::notifyBox(_vm->_text->getTextData(cmnd->textDataWrongIndex)); + if ((obj->_state != cmnd->_reqState) && (cmnd->_reqState != kStateDontCare)) { + Utils::notifyBox(_vm->_text->getTextData(cmnd->_textDataWrongIndex)); return true; } // Everything checked. Change the state and carry out any actions - if (cmnd->reqState != kStateDontCare) // Don't change new state if required state didn't care - obj->state = cmnd->newState; - Utils::notifyBox(_vm->_text->getTextData(cmnd->textDataDoneIndex)); - _vm->_scheduler->insertActionList(cmnd->actIndex); + if (cmnd->_reqState != kStateDontCare) // Don't change new state if required state didn't care + obj->_state = cmnd->_newState; + Utils::notifyBox(_vm->_text->getTextData(cmnd->_textDataDoneIndex)); + _vm->_scheduler->insertActionList(cmnd->_actIndex); // See if any additional generic actions if ((verb == _vm->_text->getVerb(_vm->_look, 0)) || (verb == _vm->_text->getVerb(_vm->_take, 0)) || (verb == _vm->_text->getVerb(_vm->_drop, 0))) @@ -262,18 +262,18 @@ bool Parser_v3d::isObjectVerb_v3(object_t *obj, char *comment) { bool Parser_v3d::isGenericVerb_v3(object_t *obj, char *comment) { debugC(1, kDebugParser, "isGenericVerb(object_t *obj, %s)", comment); - if (!obj->genericCmd) + if (!obj->_genericCmd) return false; // Following is equivalent to switch, but couldn't do one if (isWordPresent(_vm->_text->getVerbArray(_vm->_look)) && isNear_v3(obj, _vm->_text->getVerb(_vm->_look, 0), comment)) { // Test state-dependent look before general look - if ((obj->genericCmd & LOOK_S) == LOOK_S) { - Utils::notifyBox(_vm->_text->getTextData(obj->stateDataIndex[obj->state])); + if ((obj->_genericCmd & LOOK_S) == LOOK_S) { + Utils::notifyBox(_vm->_text->getTextData(obj->_stateDataIndex[obj->_state])); } else { - if ((LOOK & obj->genericCmd) == LOOK) { - if (obj->dataIndex != 0) - Utils::notifyBox(_vm->_text->getTextData(obj->dataIndex)); + if ((LOOK & obj->_genericCmd) == LOOK) { + if (obj->_dataIndex != 0) + Utils::notifyBox(_vm->_text->getTextData(obj->_dataIndex)); else return false; } else { @@ -281,22 +281,22 @@ bool Parser_v3d::isGenericVerb_v3(object_t *obj, char *comment) { } } } else if (isWordPresent(_vm->_text->getVerbArray(_vm->_take)) && isNear_v3(obj, _vm->_text->getVerb(_vm->_take, 0), comment)) { - if (obj->carriedFl) + if (obj->_carriedFl) Utils::notifyBox(_vm->_text->getTextParser(kTBHave)); - else if ((TAKE & obj->genericCmd) == TAKE) + else if ((TAKE & obj->_genericCmd) == TAKE) takeObject(obj); - else if (obj->cmdIndex) // No comment if possible commands + else if (obj->_cmdIndex) // No comment if possible commands return false; - else if (!obj->verbOnlyFl && (TAKE & obj->genericCmd) == TAKE) // Make sure not taking object in context! + else if (!obj->_verbOnlyFl && (TAKE & obj->_genericCmd) == TAKE) // Make sure not taking object in context! Utils::notifyBox(_vm->_text->getTextParser(kTBNoUse)); else return false; } else if (isWordPresent(_vm->_text->getVerbArray(_vm->_drop))) { - if (!obj->carriedFl && ((DROP & obj->genericCmd) == DROP)) + if (!obj->_carriedFl && ((DROP & obj->_genericCmd) == DROP)) Utils::notifyBox(_vm->_text->getTextParser(kTBDontHave)); - else if (obj->carriedFl && ((DROP & obj->genericCmd) == DROP)) + else if (obj->_carriedFl && ((DROP & obj->_genericCmd) == DROP)) dropObject(obj); - else if (obj->cmdIndex == 0) + else if (obj->_cmdIndex == 0) Utils::notifyBox(_vm->_text->getTextParser(kTBNeed)); else return false; @@ -316,32 +316,32 @@ bool Parser_v3d::isGenericVerb_v3(object_t *obj, char *comment) { bool Parser_v3d::isNear_v3(object_t *obj, const char *verb, char *comment) const { debugC(1, kDebugParser, "isNear(object_t *obj, %s, %s)", verb, comment); - if (obj->carriedFl) // Object is being carried + if (obj->_carriedFl) // Object is being carried return true; - if (obj->screenIndex != *_vm->_screen_p) { + if (obj->_screenIndex != *_vm->_screen_p) { // Not in same screen - if (obj->objValue) + if (obj->_objValue) strcpy(comment, _vm->_text->getTextParser(kCmtAny1)); else strcpy(comment, _vm->_text->getTextParser(kCmtAny2)); return false; } - if (obj->cycling == kCycleInvisible) { - if (obj->seqNumb) { + if (obj->_cycling == kCycleInvisible) { + if (obj->_seqNumb) { // There is an image strcpy(comment, _vm->_text->getTextParser(kCmtAny3)); return false; } else { // No image, assume visible - if ((obj->radius < 0) || - ((abs(obj->x - _vm->_hero->x) <= obj->radius) && - (abs(obj->y - _vm->_hero->y - _vm->_hero->currImagePtr->y2) <= obj->radius))) { + if ((obj->_radius < 0) || + ((abs(obj->_x - _vm->_hero->_x) <= obj->_radius) && + (abs(obj->_y - _vm->_hero->_y - _vm->_hero->_currImagePtr->_y2) <= obj->_radius))) { return true; } else { // User is not close enough - if (obj->objValue && (verb != _vm->_text->getVerb(_vm->_take, 0))) + if (obj->_objValue && (verb != _vm->_text->getVerb(_vm->_take, 0))) strcpy(comment, _vm->_text->getTextParser(kCmtAny1)); else strcpy(comment, _vm->_text->getTextParser(kCmtClose)); @@ -350,13 +350,13 @@ bool Parser_v3d::isNear_v3(object_t *obj, const char *verb, char *comment) const } } - if ((obj->radius < 0) || - ((abs(obj->x - _vm->_hero->x) <= obj->radius) && - (abs(obj->y + obj->currImagePtr->y2 - _vm->_hero->y - _vm->_hero->currImagePtr->y2) <= obj->radius))) { + if ((obj->_radius < 0) || + ((abs(obj->_x - _vm->_hero->_x) <= obj->_radius) && + (abs(obj->_y + obj->_currImagePtr->_y2 - _vm->_hero->_y - _vm->_hero->_currImagePtr->_y2) <= obj->_radius))) { return true; } else { // User is not close enough - if (obj->objValue && (verb != _vm->_text->getVerb(_vm->_take, 0))) + if (obj->_objValue && (verb != _vm->_text->getVerb(_vm->_take, 0))) strcpy(comment, _vm->_text->getTextParser(kCmtAny1)); else strcpy(comment, _vm->_text->getTextParser(kCmtClose)); @@ -371,15 +371,15 @@ bool Parser_v3d::isNear_v3(object_t *obj, const char *verb, char *comment) const void Parser_v3d::takeObject(object_t *obj) { debugC(1, kDebugParser, "takeObject(object_t *obj)"); - obj->carriedFl = true; - if (obj->seqNumb) { // Don't change if no image to display - obj->cycling = kCycleInvisible; + obj->_carriedFl = true; + if (obj->_seqNumb) { // Don't change if no image to display + obj->_cycling = kCycleInvisible; } - _vm->adjustScore(obj->objValue); + _vm->adjustScore(obj->_objValue); - if (obj->seqNumb > 0) // If object has an image, force walk to dropped - obj->viewx = -1; // (possibly moved) object next time taken! - Utils::notifyBox(Common::String::format(TAKE_TEXT, _vm->_text->getNoun(obj->nounIndex, TAKE_NAME))); + if (obj->_seqNumb > 0) // If object has an image, force walk to dropped + obj->_viewx = -1; // (possibly moved) object next time taken! + Utils::notifyBox(Common::String::format(TAKE_TEXT, _vm->_text->getNoun(obj->_nounIndex, TAKE_NAME))); } /** @@ -388,16 +388,16 @@ void Parser_v3d::takeObject(object_t *obj) { void Parser_v3d::dropObject(object_t *obj) { debugC(1, kDebugParser, "dropObject(object_t *obj)"); - obj->carriedFl = false; - obj->screenIndex = *_vm->_screen_p; - if ((obj->seqNumb > 1) || (obj->seqList[0].imageNbr > 1)) - obj->cycling = kCycleForward; + obj->_carriedFl = false; + obj->_screenIndex = *_vm->_screen_p; + if ((obj->_seqNumb > 1) || (obj->_seqList[0]._imageNbr > 1)) + obj->_cycling = kCycleForward; else - obj->cycling = kCycleNotCycling; - obj->x = _vm->_hero->x - 1; - obj->y = _vm->_hero->y + _vm->_hero->currImagePtr->y2 - 1; - obj->y = (obj->y + obj->currImagePtr->y2 < kYPix) ? obj->y : kYPix - obj->currImagePtr->y2 - 10; - _vm->adjustScore(-obj->objValue); + obj->_cycling = kCycleNotCycling; + obj->_x = _vm->_hero->_x - 1; + obj->_y = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2 - 1; + obj->_y = (obj->_y + obj->_currImagePtr->_y2 < kYPix) ? obj->_y : kYPix - obj->_currImagePtr->_y2 - 10; + _vm->adjustScore(-obj->_objValue); Utils::notifyBox(_vm->_text->getTextParser(kTBOk)); } @@ -410,19 +410,19 @@ void Parser_v3d::dropObject(object_t *obj) { bool Parser_v3d::isCatchallVerb_v3(objectList_t obj) const { debugC(1, kDebugParser, "isCatchallVerb(object_list_t obj)"); - if (_vm->_maze.enabledFl) + if (_vm->_maze._enabledFl) return false; - for (int i = 0; obj[i].verbIndex != 0; i++) { - if (isWordPresent(_vm->_text->getVerbArray(obj[i].verbIndex)) && obj[i].nounIndex == 0 && - (!obj[i].matchFl || !findNoun()) && - ((obj[i].roomState == kStateDontCare) || - (obj[i].roomState == _vm->_screenStates[*_vm->_screen_p]))) { - Utils::notifyBox(_vm->_file->fetchString(obj[i].commentIndex)); - _vm->_scheduler->processBonus(obj[i].bonusIndex); + for (int i = 0; obj[i]._verbIndex != 0; i++) { + if (isWordPresent(_vm->_text->getVerbArray(obj[i]._verbIndex)) && obj[i]._nounIndex == 0 && + (!obj[i]._matchFl || !findNoun()) && + ((obj[i]._roomState == kStateDontCare) || + (obj[i]._roomState == _vm->_screenStates[*_vm->_screen_p]))) { + Utils::notifyBox(_vm->_file->fetchString(obj[i]._commentIndex)); + _vm->_scheduler->processBonus(obj[i]._bonusIndex); // If this is LOOK (without a noun), show any takeable objects - if (*(_vm->_text->getVerbArray(obj[i].verbIndex)) == _vm->_text->getVerb(_vm->_look, 0)) + if (*(_vm->_text->getVerbArray(obj[i]._verbIndex)) == _vm->_text->getVerb(_vm->_look, 0)) _vm->_object->showTakeables(); return true; @@ -438,16 +438,16 @@ bool Parser_v3d::isCatchallVerb_v3(objectList_t obj) const { bool Parser_v3d::isBackgroundWord_v3(objectList_t obj) const { debugC(1, kDebugParser, "isBackgroundWord(object_list_t obj)"); - if (_vm->_maze.enabledFl) + if (_vm->_maze._enabledFl) return false; - for (int i = 0; obj[i].verbIndex != 0; i++) { - if (isWordPresent(_vm->_text->getVerbArray(obj[i].verbIndex)) && - isWordPresent(_vm->_text->getNounArray(obj[i].nounIndex)) && - ((obj[i].roomState == kStateDontCare) || - (obj[i].roomState == _vm->_screenStates[*_vm->_screen_p]))) { - Utils::notifyBox(_vm->_file->fetchString(obj[i].commentIndex)); - _vm->_scheduler->processBonus(obj[i].bonusIndex); + for (int i = 0; obj[i]._verbIndex != 0; i++) { + if (isWordPresent(_vm->_text->getVerbArray(obj[i]._verbIndex)) && + isWordPresent(_vm->_text->getNounArray(obj[i]._nounIndex)) && + ((obj[i]._roomState == kStateDontCare) || + (obj[i]._roomState == _vm->_screenStates[*_vm->_screen_p]))) { + Utils::notifyBox(_vm->_file->fetchString(obj[i]._commentIndex)); + _vm->_scheduler->processBonus(obj[i]._bonusIndex); return true; } } diff --git a/engines/hugo/route.cpp b/engines/hugo/route.cpp index 281aacf031..552ddaf5c9 100644 --- a/engines/hugo/route.cpp +++ b/engines/hugo/route.cpp @@ -67,35 +67,35 @@ void Route::setDirection(const uint16 keyCode) { switch (keyCode) { case Common::KEYCODE_UP: case Common::KEYCODE_KP8: - obj->currImagePtr = obj->seqList[SEQ_UP].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_UP]._seqPtr; break; case Common::KEYCODE_DOWN: case Common::KEYCODE_KP2: - obj->currImagePtr = obj->seqList[SEQ_DOWN].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_DOWN]._seqPtr; break; case Common::KEYCODE_LEFT: case Common::KEYCODE_KP4: - obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr; break; case Common::KEYCODE_RIGHT: case Common::KEYCODE_KP6: - obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr; break; case Common::KEYCODE_HOME: case Common::KEYCODE_KP7: - obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr; break; case Common::KEYCODE_END: case Common::KEYCODE_KP1: - obj->currImagePtr = obj->seqList[SEQ_LEFT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_LEFT]._seqPtr; break; case Common::KEYCODE_PAGEUP: case Common::KEYCODE_KP9: - obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr; break; case Common::KEYCODE_PAGEDOWN: case Common::KEYCODE_KP3: - obj->currImagePtr = obj->seqList[SEQ_RIGHT].seqPtr; + obj->_currImagePtr = obj->_seqList[SEQ_RIGHT]._seqPtr; break; } } @@ -109,66 +109,66 @@ void Route::setWalk(const uint16 direction) { object_t *obj = _vm->_hero; // Pointer to hero object - if (_vm->getGameStatus().storyModeFl || obj->pathType != kPathUser) // Make sure user has control + if (_vm->getGameStatus()._storyModeFl || obj->_pathType != kPathUser) // Make sure user has control return; - if (!obj->vx && !obj->vy) + if (!obj->_vx && !obj->_vy) _oldWalkDirection = 0; // Fix for consistant restarts if (direction != _oldWalkDirection) { // Direction has changed setDirection(direction); // Face new direction - obj->vx = obj->vy = 0; + obj->_vx = obj->_vy = 0; switch (direction) { // And set correct velocity case Common::KEYCODE_UP: case Common::KEYCODE_KP8: - obj->vy = -kStepDy; + obj->_vy = -kStepDy; break; case Common::KEYCODE_DOWN: case Common::KEYCODE_KP2: - obj->vy = kStepDy; + obj->_vy = kStepDy; break; case Common::KEYCODE_LEFT: case Common::KEYCODE_KP4: - obj->vx = -kStepDx; + obj->_vx = -kStepDx; break; case Common::KEYCODE_RIGHT: case Common::KEYCODE_KP6: - obj->vx = kStepDx; + obj->_vx = kStepDx; break; case Common::KEYCODE_HOME: case Common::KEYCODE_KP7: - obj->vx = -kStepDx; + obj->_vx = -kStepDx; // Note: in v1 Dos and v2 Dos, obj->vy is set to DY - obj->vy = -kStepDy / 2; + obj->_vy = -kStepDy / 2; break; case Common::KEYCODE_END: case Common::KEYCODE_KP1: - obj->vx = -kStepDx; + obj->_vx = -kStepDx; // Note: in v1 Dos and v2 Dos, obj->vy is set to -DY - obj->vy = kStepDy / 2; + obj->_vy = kStepDy / 2; break; case Common::KEYCODE_PAGEUP: case Common::KEYCODE_KP9: - obj->vx = kStepDx; + obj->_vx = kStepDx; // Note: in v1 Dos and v2 Dos, obj->vy is set to -DY - obj->vy = -kStepDy / 2; + obj->_vy = -kStepDy / 2; break; case Common::KEYCODE_PAGEDOWN: case Common::KEYCODE_KP3: - obj->vx = kStepDx; + obj->_vx = kStepDx; // Note: in v1 Dos and v2 Dos, obj->vy is set to DY - obj->vy = kStepDy / 2; + obj->_vy = kStepDy / 2; break; } _oldWalkDirection = direction; - obj->cycling = kCycleForward; + obj->_cycling = kCycleForward; } else { // Same key twice - halt hero - obj->vy = 0; - obj->vx = 0; + obj->_vy = 0; + obj->_vx = 0; _oldWalkDirection = 0; - obj->cycling = kCycleNotCycling; + obj->_cycling = kCycleNotCycling; } } @@ -228,7 +228,7 @@ void Route::segment(int16 x, int16 y) { if (y <= 0 || y >= kYPix - 1) return; - if (_vm->_hero->x < x1) { + if (_vm->_hero->_x < x1) { // Hero x not in segment, search x1..x2 // Find all segments above current for (x = x1; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x <= x2; x++) { @@ -241,7 +241,7 @@ void Route::segment(int16 x, int16 y) { if (_boundaryMap[y + 1][x] == 0) segment(x, y + 1); } - } else if (_vm->_hero->x + kHeroMaxWidth > x2) { + } else if (_vm->_hero->_x + kHeroMaxWidth > x2) { // Hero x not in segment, search x1..x2 // Find all segments above current for (x = x2; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x >= x1; x--) { @@ -257,22 +257,22 @@ void Route::segment(int16 x, int16 y) { } else { // Organize search around hero x position - this gives // better chance for more direct route. - for (x = _vm->_hero->x; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x <= x2; x++) { + for (x = _vm->_hero->_x; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x <= x2; x++) { if (_boundaryMap[y - 1][x] == 0) segment(x, y - 1); } - for (x = x1; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x < _vm->_hero->x; x++) { + for (x = x1; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x < _vm->_hero->_x; x++) { if (_boundaryMap[y - 1][x] == 0) segment(x, y - 1); } - for (x = _vm->_hero->x; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x <= x2; x++) { + for (x = _vm->_hero->_x; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x <= x2; x++) { if (_boundaryMap[y + 1][x] == 0) segment(x, y + 1); } - for (x = x1; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x < _vm->_hero->x; x++) { + for (x = x1; !(_routeFoundFl || _fullStackFl || _fullSegmentFl) && x < _vm->_hero->_x; x++) { if (_boundaryMap[y + 1][x] == 0) segment(x, y + 1); } @@ -327,16 +327,16 @@ bool Route::findRoute(const int16 cx, const int16 cy) { _destY = cy; // Destination coords _destX = cx; // Destination coords - int16 herox1 = _vm->_hero->x + _vm->_hero->currImagePtr->x1; // Hero baseline - int16 herox2 = _vm->_hero->x + _vm->_hero->currImagePtr->x2; // Hero baseline - int16 heroy = _vm->_hero->y + _vm->_hero->currImagePtr->y2; // Hero baseline + int16 herox1 = _vm->_hero->_x + _vm->_hero->_currImagePtr->_x1; // Hero baseline + int16 herox2 = _vm->_hero->_x + _vm->_hero->_currImagePtr->_x2; // Hero baseline + int16 heroy = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2; // Hero baseline // Store all object baselines into objbound (except hero's = [0]) object_t *obj; // Ptr to object int i; for (i = 1, obj = &_vm->_object->_objects[i]; i < _vm->_object->_numObj; i++, obj++) { - if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling != kCycleInvisible) && (obj->priority == kPriorityFloating)) - _vm->_object->storeBoundary(obj->oldx + obj->currImagePtr->x1, obj->oldx + obj->currImagePtr->x2, obj->oldy + obj->currImagePtr->y2); + if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling != kCycleInvisible) && (obj->_priority == kPriorityFloating)) + _vm->_object->storeBoundary(obj->_oldx + obj->_currImagePtr->_x1, obj->_oldx + obj->_currImagePtr->_x2, obj->_oldy + obj->_currImagePtr->_y2); } // Combine objbound and boundary bitmaps to local byte map @@ -350,8 +350,8 @@ bool Route::findRoute(const int16 cx, const int16 cy) { // Clear all object baselines from objbound for (i = 0, obj = _vm->_object->_objects; i < _vm->_object->_numObj; i++, obj++) { - if ((obj->screenIndex == *_vm->_screen_p) && (obj->cycling != kCycleInvisible) && (obj->priority == kPriorityFloating)) - _vm->_object->clearBoundary(obj->oldx + obj->currImagePtr->x1, obj->oldx + obj->currImagePtr->x2, obj->oldy + obj->currImagePtr->y2); + if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling != kCycleInvisible) && (obj->_priority == kPriorityFloating)) + _vm->_object->clearBoundary(obj->_oldx + obj->_currImagePtr->_x1, obj->_oldx + obj->_currImagePtr->_x2, obj->_oldy + obj->_currImagePtr->_y2); } // Search from hero to destination @@ -433,18 +433,18 @@ void Route::processRoute() { return; // Current hero position - int16 herox = _vm->_hero->x + _vm->_hero->currImagePtr->x1; - int16 heroy = _vm->_hero->y + _vm->_hero->currImagePtr->y2; + int16 herox = _vm->_hero->_x + _vm->_hero->_currImagePtr->_x1; + int16 heroy = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2; Point *routeNode = &_route[_routeIndex]; // Arrived at node? if (abs(herox - routeNode->x) < kStepDx + 1 && abs(heroy - routeNode->y) < kStepDy) { // kStepDx too low // Close enough - position hero exactly - _vm->_hero->x = _vm->_hero->oldx = routeNode->x - _vm->_hero->currImagePtr->x1; - _vm->_hero->y = _vm->_hero->oldy = routeNode->y - _vm->_hero->currImagePtr->y2; - _vm->_hero->vx = _vm->_hero->vy = 0; - _vm->_hero->cycling = kCycleNotCycling; + _vm->_hero->_x = _vm->_hero->_oldx = routeNode->x - _vm->_hero->_currImagePtr->_x1; + _vm->_hero->_y = _vm->_hero->_oldy = routeNode->y - _vm->_hero->_currImagePtr->_y2; + _vm->_hero->_vx = _vm->_hero->_vy = 0; + _vm->_hero->_cycling = kCycleNotCycling; // Arrived at final node? if (--_routeIndex < 0) { @@ -458,7 +458,7 @@ void Route::processRoute() { _vm->_object->lookObject(&_vm->_object->_objects[_routeObjId]); turnedFl = false; } else { - setDirection(_vm->_object->_objects[_routeObjId].direction); + setDirection(_vm->_object->_objects[_routeObjId]._direction); _routeIndex++; // Come round again turnedFl = true; } @@ -468,7 +468,7 @@ void Route::processRoute() { _vm->_object->useObject(_routeObjId); turnedFl = false; } else { - setDirection(_vm->_object->_objects[_routeObjId].direction); + setDirection(_vm->_object->_objects[_routeObjId]._direction); _routeIndex++; // Come round again turnedFl = true; } @@ -477,7 +477,7 @@ void Route::processRoute() { break; } } - } else if (_vm->_hero->vx == 0 && _vm->_hero->vy == 0) { + } else if (_vm->_hero->_vx == 0 && _vm->_hero->_vy == 0) { // Set direction of travel if at a node // Note realignment when changing to (thinner) up/down sprite, // otherwise hero could bump into boundaries along route. @@ -487,10 +487,10 @@ void Route::processRoute() { setWalk(Common::KEYCODE_LEFT); } else if (heroy < routeNode->y) { setWalk(Common::KEYCODE_DOWN); - _vm->_hero->x = _vm->_hero->oldx = routeNode->x - _vm->_hero->currImagePtr->x1; + _vm->_hero->_x = _vm->_hero->_oldx = routeNode->x - _vm->_hero->_currImagePtr->_x1; } else if (heroy > routeNode->y) { setWalk(Common::KEYCODE_UP); - _vm->_hero->x = _vm->_hero->oldx = routeNode->x - _vm->_hero->currImagePtr->x1; + _vm->_hero->_x = _vm->_hero->_oldx = routeNode->x - _vm->_hero->_currImagePtr->_x1; } } } @@ -504,7 +504,7 @@ bool Route::startRoute(const go_t routeType, const int16 objId, int16 cx, int16 debugC(1, kDebugRoute, "startRoute(%d, %d, %d, %d)", routeType, objId, cx, cy); // Don't attempt to walk if user does not have control - if (_vm->_hero->pathType != kPathUser) + if (_vm->_hero->_pathType != kPathUser) return false; // if inventory showing, make it go away @@ -521,7 +521,7 @@ bool Route::startRoute(const go_t routeType, const int16 objId, int16 cx, int16 bool foundFl = false; // TRUE if route found ok if ((foundFl = findRoute(cx, cy))) { // Found a route? _routeIndex = _routeListIndex; // Node index - _vm->_hero->vx = _vm->_hero->vy = 0; // Stop manual motion + _vm->_hero->_vx = _vm->_hero->_vy = 0; // Stop manual motion } return foundFl; diff --git a/engines/hugo/schedule.cpp b/engines/hugo/schedule.cpp index 896e8fa2ce..18e414420a 100644 --- a/engines/hugo/schedule.cpp +++ b/engines/hugo/schedule.cpp @@ -112,7 +112,7 @@ void Scheduler::insertActionList(const uint16 actIndex) { uint32 Scheduler::getWinTicks() const { debugC(5, kDebugSchedule, "getWinTicks()"); - return _vm->getGameStatus().tick; + return _vm->getGameStatus()._tick; } /** @@ -656,32 +656,32 @@ void Scheduler::screenActions(const int screenNum) { void Scheduler::processMaze(const int x1, const int x2, const int y1, const int y2) { debugC(1, kDebugSchedule, "processMaze"); - if (x1 < _vm->_maze.x1) { + if (x1 < _vm->_maze._x1) { // Exit west _actListArr[_alNewscrIndex][3].a8.screenIndex = *_vm->_screen_p - 1; - _actListArr[_alNewscrIndex][0].a2.x = _vm->_maze.x2 - kShiftSize - (x2 - x1); - _actListArr[_alNewscrIndex][0].a2.y = _vm->_hero->y; + _actListArr[_alNewscrIndex][0].a2.x = _vm->_maze._x2 - kShiftSize - (x2 - x1); + _actListArr[_alNewscrIndex][0].a2.y = _vm->_hero->_y; _vm->_route->resetRoute(); insertActionList(_alNewscrIndex); - } else if (x2 > _vm->_maze.x2) { + } else if (x2 > _vm->_maze._x2) { // Exit east _actListArr[_alNewscrIndex][3].a8.screenIndex = *_vm->_screen_p + 1; - _actListArr[_alNewscrIndex][0].a2.x = _vm->_maze.x1 + kShiftSize; - _actListArr[_alNewscrIndex][0].a2.y = _vm->_hero->y; + _actListArr[_alNewscrIndex][0].a2.x = _vm->_maze._x1 + kShiftSize; + _actListArr[_alNewscrIndex][0].a2.y = _vm->_hero->_y; _vm->_route->resetRoute(); insertActionList(_alNewscrIndex); - } else if (y1 < _vm->_maze.y1 - kShiftSize) { + } else if (y1 < _vm->_maze._y1 - kShiftSize) { // Exit north - _actListArr[_alNewscrIndex][3].a8.screenIndex = *_vm->_screen_p - _vm->_maze.size; - _actListArr[_alNewscrIndex][0].a2.x = _vm->_maze.x3; - _actListArr[_alNewscrIndex][0].a2.y = _vm->_maze.y2 - kShiftSize - (y2 - y1); + _actListArr[_alNewscrIndex][3].a8.screenIndex = *_vm->_screen_p - _vm->_maze._size; + _actListArr[_alNewscrIndex][0].a2.x = _vm->_maze._x3; + _actListArr[_alNewscrIndex][0].a2.y = _vm->_maze._y2 - kShiftSize - (y2 - y1); _vm->_route->resetRoute(); insertActionList(_alNewscrIndex); - } else if (y2 > _vm->_maze.y2 - kShiftSize / 2) { + } else if (y2 > _vm->_maze._y2 - kShiftSize / 2) { // Exit south - _actListArr[_alNewscrIndex][3].a8.screenIndex = *_vm->_screen_p + _vm->_maze.size; - _actListArr[_alNewscrIndex][0].a2.x = _vm->_maze.x4; - _actListArr[_alNewscrIndex][0].a2.y = _vm->_maze.y1 + kShiftSize; + _actListArr[_alNewscrIndex][3].a8.screenIndex = *_vm->_screen_p + _vm->_maze._size; + _actListArr[_alNewscrIndex][0].a2.x = _vm->_maze._x4; + _actListArr[_alNewscrIndex][0].a2.y = _vm->_maze._y1 + kShiftSize; _vm->_route->resetRoute(); insertActionList(_alNewscrIndex); } @@ -1144,7 +1144,7 @@ void Scheduler::insertAction(act *action) { break; // Workaround: When dying, switch to storyMode in order to block the keyboard. case GAMEOVER: - _vm->getGameStatus().storyModeFl = true; + _vm->getGameStatus()._storyModeFl = true; // No break on purpose default: curEvent->localActionFl = true; // Rest are for current screen only @@ -1205,12 +1205,12 @@ event_t *Scheduler::doAction(event_t *curEvent) { insertActionList(action->a0.actIndex); break; case START_OBJ: // act1: Start an object cycling - _vm->_object->_objects[action->a1.objIndex].cycleNumb = action->a1.cycleNumb; - _vm->_object->_objects[action->a1.objIndex].cycling = action->a1.cycle; + _vm->_object->_objects[action->a1.objIndex]._cycleNumb = action->a1.cycleNumb; + _vm->_object->_objects[action->a1.objIndex]._cycling = action->a1.cycle; break; case INIT_OBJXY: // act2: Initialize an object - _vm->_object->_objects[action->a2.objIndex].x = action->a2.x; // Coordinates - _vm->_object->_objects[action->a2.objIndex].y = action->a2.y; + _vm->_object->_objects[action->a2.objIndex]._x = action->a2.x; // Coordinates + _vm->_object->_objects[action->a2.objIndex]._y = action->a2.y; break; case PROMPT: // act3: Prompt user for key phrase promptAction(action); @@ -1225,21 +1225,21 @@ event_t *Scheduler::doAction(event_t *curEvent) { _vm->_object->setCarry(action->a6.objIndex, action->a6.carriedFl); // carried status break; case INIT_HF_COORD: // act7: Initialize an object to hero's "feet" coords - _vm->_object->_objects[action->a7.objIndex].x = _vm->_hero->x - 1; - _vm->_object->_objects[action->a7.objIndex].y = _vm->_hero->y + _vm->_hero->currImagePtr->y2 - 1; - _vm->_object->_objects[action->a7.objIndex].screenIndex = *_vm->_screen_p; // Don't forget screen! + _vm->_object->_objects[action->a7.objIndex]._x = _vm->_hero->_x - 1; + _vm->_object->_objects[action->a7.objIndex]._y = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2 - 1; + _vm->_object->_objects[action->a7.objIndex]._screenIndex = *_vm->_screen_p; // Don't forget screen! break; case NEW_SCREEN: // act8: Start new screen newScreen(action->a8.screenIndex); break; case INIT_OBJSTATE: // act9: Initialize an object state - _vm->_object->_objects[action->a9.objIndex].state = action->a9.newState; + _vm->_object->_objects[action->a9.objIndex]._state = action->a9.newState; break; case INIT_PATH: // act10: Initialize an object path and velocity _vm->_object->setPath(action->a10.objIndex, (path_t) action->a10.newPathType, action->a10.vxPath, action->a10.vyPath); break; case COND_R: // act11: action lists conditional on object state - if (_vm->_object->_objects[action->a11.objIndex].state == action->a11.stateReq) + if (_vm->_object->_objects[action->a11.objIndex]._state == action->a11.stateReq) insertActionList(action->a11.actPassIndex); else insertActionList(action->a11.actFailIndex); @@ -1251,7 +1251,7 @@ event_t *Scheduler::doAction(event_t *curEvent) { _vm->_object->swapImages(action->a13.objIndex1, action->a13.objIndex2); break; case COND_SCR: // act14: Conditional on current screen - if (_vm->_object->_objects[action->a14.objIndex].screenIndex == action->a14.screenReq) + if (_vm->_object->_objects[action->a14.objIndex]._screenIndex == action->a14.screenReq) insertActionList(action->a14.actPassIndex); else insertActionList(action->a14.actFailIndex); @@ -1262,16 +1262,16 @@ event_t *Scheduler::doAction(event_t *curEvent) { case INIT_OBJ_SEQ: // act16: Set sequence number to use // Note: Don't set a sequence at time 0 of a new screen, it causes // problems clearing the boundary bits of the object! t>0 is safe - _vm->_object->_objects[action->a16.objIndex].currImagePtr = _vm->_object->_objects[action->a16.objIndex].seqList[action->a16.seqIndex].seqPtr; + _vm->_object->_objects[action->a16.objIndex]._currImagePtr = _vm->_object->_objects[action->a16.objIndex]._seqList[action->a16.seqIndex]._seqPtr; break; case SET_STATE_BITS: // act17: OR mask with curr obj state - _vm->_object->_objects[action->a17.objIndex].state |= action->a17.stateMask; + _vm->_object->_objects[action->a17.objIndex]._state |= action->a17.stateMask; break; case CLEAR_STATE_BITS: // act18: AND ~mask with curr obj state - _vm->_object->_objects[action->a18.objIndex].state &= ~action->a18.stateMask; + _vm->_object->_objects[action->a18.objIndex]._state &= ~action->a18.stateMask; break; case TEST_STATE_BITS: // act19: If all bits set, do apass else afail - if ((_vm->_object->_objects[action->a19.objIndex].state & action->a19.stateMask) == action->a19.stateMask) + if ((_vm->_object->_objects[action->a19.objIndex]._state & action->a19.stateMask) == action->a19.stateMask) insertActionList(action->a19.actPassIndex); else insertActionList(action->a19.actFailIndex); @@ -1282,12 +1282,12 @@ event_t *Scheduler::doAction(event_t *curEvent) { case GAMEOVER: // act21: Game over! // NOTE: Must wait at least 1 tick before issuing this action if // any objects are to be made invisible! - gameStatus.gameOverFl = true; + gameStatus._gameOverFl = true; break; case INIT_HH_COORD: // act22: Initialize an object to hero's actual coords - _vm->_object->_objects[action->a22.objIndex].x = _vm->_hero->x; - _vm->_object->_objects[action->a22.objIndex].y = _vm->_hero->y; - _vm->_object->_objects[action->a22.objIndex].screenIndex = *_vm->_screen_p;// Don't forget screen! + _vm->_object->_objects[action->a22.objIndex]._x = _vm->_hero->_x; + _vm->_object->_objects[action->a22.objIndex]._y = _vm->_hero->_y; + _vm->_object->_objects[action->a22.objIndex]._screenIndex = *_vm->_screen_p;// Don't forget screen! break; case EXIT: // act23: Exit game back to DOS _vm->endGame(); @@ -1297,8 +1297,8 @@ event_t *Scheduler::doAction(event_t *curEvent) { break; case COND_BOX: // act25: Conditional on bounding box obj1 = &_vm->_object->_objects[action->a25.objIndex]; - dx = obj1->x + obj1->currImagePtr->x1; - dy = obj1->y + obj1->currImagePtr->y2; + dx = obj1->_x + obj1->_currImagePtr->_x1; + dy = obj1->_y + obj1->_currImagePtr->_y2; if ((dx >= action->a25.x1) && (dx <= action->a25.x2) && (dy >= action->a25.y1) && (dy <= action->a25.y2)) insertActionList(action->a25.actPassIndex); @@ -1312,10 +1312,10 @@ event_t *Scheduler::doAction(event_t *curEvent) { _vm->_sound->playSound(action->a26.soundIndex, kSoundPriorityMedium); break; case ADD_SCORE: // act27: Add object's value to score - _vm->adjustScore(_vm->_object->_objects[action->a27.objIndex].objValue); + _vm->adjustScore(_vm->_object->_objects[action->a27.objIndex]._objValue); break; case SUB_SCORE: // act28: Subtract object's value from score - _vm->adjustScore(-_vm->_object->_objects[action->a28.objIndex].objValue); + _vm->adjustScore(-_vm->_object->_objects[action->a28.objIndex]._objValue); break; case COND_CARRY: // act29: Conditional on object being carried if (_vm->_object->isCarried(action->a29.objIndex)) @@ -1324,24 +1324,24 @@ event_t *Scheduler::doAction(event_t *curEvent) { insertActionList(action->a29.actFailIndex); break; case INIT_MAZE: // act30: Enable and init maze structure - _vm->_maze.enabledFl = true; - _vm->_maze.size = action->a30.mazeSize; - _vm->_maze.x1 = action->a30.x1; - _vm->_maze.y1 = action->a30.y1; - _vm->_maze.x2 = action->a30.x2; - _vm->_maze.y2 = action->a30.y2; - _vm->_maze.x3 = action->a30.x3; - _vm->_maze.x4 = action->a30.x4; - _vm->_maze.firstScreenIndex = action->a30.firstScreenIndex; + _vm->_maze._enabledFl = true; + _vm->_maze._size = action->a30.mazeSize; + _vm->_maze._x1 = action->a30.x1; + _vm->_maze._y1 = action->a30.y1; + _vm->_maze._x2 = action->a30.x2; + _vm->_maze._y2 = action->a30.y2; + _vm->_maze._x3 = action->a30.x3; + _vm->_maze._x4 = action->a30.x4; + _vm->_maze._firstScreenIndex = action->a30.firstScreenIndex; break; case EXIT_MAZE: // act31: Disable maze mode - _vm->_maze.enabledFl = false; + _vm->_maze._enabledFl = false; break; case INIT_PRIORITY: - _vm->_object->_objects[action->a32.objIndex].priority = action->a32.priority; + _vm->_object->_objects[action->a32.objIndex]._priority = action->a32.priority; break; case INIT_SCREEN: - _vm->_object->_objects[action->a33.objIndex].screenIndex = action->a33.screenIndex; + _vm->_object->_objects[action->a33.objIndex]._screenIndex = action->a33.screenIndex; break; case AGSCHEDULE: // act34: Schedule a (global) action list insertActionList(action->a34.actIndex); @@ -1359,15 +1359,15 @@ event_t *Scheduler::doAction(event_t *curEvent) { _vm->_screenStates[action->a37.screenIndex] = action->a37.newState; break; case INIT_LIPS: // act38: Position lips on object - _vm->_object->_objects[action->a38.lipsObjIndex].x = _vm->_object->_objects[action->a38.objIndex].x + action->a38.dxLips; - _vm->_object->_objects[action->a38.lipsObjIndex].y = _vm->_object->_objects[action->a38.objIndex].y + action->a38.dyLips; - _vm->_object->_objects[action->a38.lipsObjIndex].screenIndex = *_vm->_screen_p; // Don't forget screen! - _vm->_object->_objects[action->a38.lipsObjIndex].cycling = kCycleForward; + _vm->_object->_objects[action->a38.lipsObjIndex]._x = _vm->_object->_objects[action->a38.objIndex]._x + action->a38.dxLips; + _vm->_object->_objects[action->a38.lipsObjIndex]._y = _vm->_object->_objects[action->a38.objIndex]._y + action->a38.dyLips; + _vm->_object->_objects[action->a38.lipsObjIndex]._screenIndex = *_vm->_screen_p; // Don't forget screen! + _vm->_object->_objects[action->a38.lipsObjIndex]._cycling = kCycleForward; break; case INIT_STORY_MODE: // act39: Init story_mode flag // This is similar to the QUIET path mode, except that it is // independant of it and it additionally disables the ">" prompt - gameStatus.storyModeFl = action->a39.storyModeFl; + gameStatus._storyModeFl = action->a39.storyModeFl; break; case WARN: // act40: Text box (CF TEXT) Utils::notifyBox(_vm->_file->fetchString(action->a40.stringIndex)); @@ -1379,7 +1379,7 @@ event_t *Scheduler::doAction(event_t *curEvent) { insertActionList(action->a41.actFailIndex); break; case TEXT_TAKE: // act42: Text box with "take" message - Utils::notifyBox(Common::String::format(TAKE_TEXT, _vm->_text->getNoun(_vm->_object->_objects[action->a42.objIndex].nounIndex, TAKE_NAME))); + Utils::notifyBox(Common::String::format(TAKE_TEXT, _vm->_text->getNoun(_vm->_object->_objects[action->a42.objIndex]._nounIndex, TAKE_NAME))); break; case YESNO: // act43: Prompt user for Yes or No if (Utils::yesNoBox(_vm->_file->fetchString(action->a43.promptIndex))) @@ -1403,16 +1403,16 @@ event_t *Scheduler::doAction(event_t *curEvent) { _vm->_mouse->setJumpExitFl(action->a46.jumpExitFl); break; case INIT_VIEW: // act47: Init object.viewx, viewy, dir - _vm->_object->_objects[action->a47.objIndex].viewx = action->a47.viewx; - _vm->_object->_objects[action->a47.objIndex].viewy = action->a47.viewy; - _vm->_object->_objects[action->a47.objIndex].direction = action->a47.direction; + _vm->_object->_objects[action->a47.objIndex]._viewx = action->a47.viewx; + _vm->_object->_objects[action->a47.objIndex]._viewy = action->a47.viewy; + _vm->_object->_objects[action->a47.objIndex]._direction = action->a47.direction; break; case INIT_OBJ_FRAME: // act48: Set seq,frame number to use // Note: Don't set a sequence at time 0 of a new screen, it causes // problems clearing the boundary bits of the object! t>0 is safe - _vm->_object->_objects[action->a48.objIndex].currImagePtr = _vm->_object->_objects[action->a48.objIndex].seqList[action->a48.seqIndex].seqPtr; + _vm->_object->_objects[action->a48.objIndex]._currImagePtr = _vm->_object->_objects[action->a48.objIndex]._seqList[action->a48.seqIndex]._seqPtr; for (dx = 0; dx < action->a48.frameIndex; dx++) - _vm->_object->_objects[action->a48.objIndex].currImagePtr = _vm->_object->_objects[action->a48.objIndex].currImagePtr->nextSeqPtr; + _vm->_object->_objects[action->a48.objIndex]._currImagePtr = _vm->_object->_objects[action->a48.objIndex]._currImagePtr->_nextSeqPtr; break; case OLD_SONG: // Replaces ACT26 for DOS games. @@ -1644,6 +1644,6 @@ void Scheduler_v1w::runScheduler() { while (curEvent && (curEvent->time <= ticker)) // While mature events found curEvent = doAction(curEvent); // Perform the action (returns next_p) - _vm->getGameStatus().tick++; // Accessed elsewhere via getTicks() + _vm->getGameStatus()._tick++; // Accessed elsewhere via getTicks() } } // End of namespace Hugo diff --git a/engines/hugo/sound.cpp b/engines/hugo/sound.cpp index d0b4e3dfe8..eed4164d5e 100644 --- a/engines/hugo/sound.cpp +++ b/engines/hugo/sound.cpp @@ -186,7 +186,7 @@ void SoundHandler::playMusic(int16 tune) { uint16 size; // Size of sequence data if (_vm->_config.musicFl) { - _vm->getGameStatus().song = tune; + _vm->getGameStatus()._song = tune; seqPtr = _vm->_file->getSound(tune, &size); playMIDI(seqPtr, size); free(seqPtr); @@ -245,7 +245,7 @@ void SoundHandler::checkMusic() { return; for (int i = 0; _vm->_defltTunes[i] != -1; i++) { - if (_vm->_defltTunes[i] == _vm->getGameStatus().song) { + if (_vm->_defltTunes[i] == _vm->getGameStatus()._song) { if (_vm->_defltTunes[i + 1] != -1) playMusic(_vm->_defltTunes[i + 1]); else -- cgit v1.2.3 From 998448128c8527427b1b472d17c68b7770ee6f4c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 13 Jun 2012 11:50:49 +0200 Subject: HUGO: Some more renaming --- engines/hugo/display.cpp | 66 ++++++++++++++++++++++---------------------- engines/hugo/display.h | 8 +++--- engines/hugo/file.cpp | 70 +++++++++++++++++++++++------------------------ engines/hugo/file.h | 42 ++++++++++++++-------------- engines/hugo/file_v1w.cpp | 28 +++++++++---------- engines/hugo/file_v2d.cpp | 46 +++++++++++++++---------------- engines/hugo/file_v3d.cpp | 60 ++++++++++++++++++++-------------------- 7 files changed, 160 insertions(+), 160 deletions(-) (limited to 'engines/hugo') diff --git a/engines/hugo/display.cpp b/engines/hugo/display.cpp index 7028195dd4..12a9edfbb7 100644 --- a/engines/hugo/display.cpp +++ b/engines/hugo/display.cpp @@ -85,20 +85,20 @@ Screen::Screen(HugoEngine *vm) : _vm(vm) { fontLoadedFl[i] = false; } for (int i = 0; i < kBlitListSize; i++) { - _dlBlistList[i].x = 0; - _dlBlistList[i].y = 0; - _dlBlistList[i].dx = 0; - _dlBlistList[i].dy = 0; + _dlBlistList[i]._x = 0; + _dlBlistList[i]._y = 0; + _dlBlistList[i]._dx = 0; + _dlBlistList[i]._dy = 0; } for (int i = 0; i < kRectListSize; i++) { - _dlAddList[i].x = 0; - _dlAddList[i].y = 0; - _dlAddList[i].dx = 0; - _dlAddList[i].dy = 0; - _dlRestoreList[i].x = 0; - _dlRestoreList[i].y = 0; - _dlRestoreList[i].dx = 0; - _dlRestoreList[i].dy = 0; + _dlAddList[i]._x = 0; + _dlAddList[i]._y = 0; + _dlAddList[i]._dx = 0; + _dlAddList[i]._dy = 0; + _dlRestoreList[i]._x = 0; + _dlRestoreList[i]._y = 0; + _dlRestoreList[i]._dx = 0; + _dlRestoreList[i]._dy = 0; } } @@ -274,15 +274,15 @@ void Screen::displayFrame(const int sx, const int sy, seq_t *seq, const bool for 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 - int16 xb = rectB->x + rectB->dx; - int16 ya = rectA->y + rectA->dy; - int16 yb = rectB->y + rectB->dy; + int16 xa = rectA->_x + rectA->_dx; // Find x2,y2 for each rectangle + int16 xb = rectB->_x + rectB->_dx; + int16 ya = rectA->_y + rectA->_dy; + int16 yb = rectB->_y + rectB->_dy; - rectB->x = MIN(rectA->x, rectB->x); // Minimum x,y - rectB->y = MIN(rectA->y, rectB->y); - rectB->dx = MAX(xa, xb) - rectB->x; // Maximum dx,dy - rectB->dy = MAX(ya, yb) - rectB->y; + rectB->_x = MIN(rectA->_x, rectB->_x); // Minimum x,y + rectB->_y = MIN(rectA->_y, rectB->_y); + rectB->_dx = MAX(xa, xb) - rectB->_x; // Maximum dx,dy + rectB->_dy = MAX(ya, yb) - rectB->_y; } /** @@ -301,7 +301,7 @@ int16 Screen::mergeLists(rect_t *list, rect_t *blist, const int16 len, int16 ble int16 c = 0; rect_t *bp = blist; for (int16 b = 0; b < blen; b++, bp++) { - if (bp->dx) // blist entry used + if (bp->_dx) // blist entry used if (isOverlapping(list, bp)) coalesce[c++] = b; } @@ -318,7 +318,7 @@ int16 Screen::mergeLists(rect_t *list, rect_t *blist, const int16 len, int16 ble while (--c) { rect_t *cp = &blist[coalesce[c]]; merge(cp, bp); - cp->dx = 0; // Delete entry + cp->_dx = 0; // Delete entry } } } @@ -348,10 +348,10 @@ void Screen::displayList(dupdate_t update, ...) { } va_start(marker, update); // Initialize variable arguments p = &_dlAddList[_dlAddIndex]; - p->x = va_arg(marker, int); // x - p->y = va_arg(marker, int); // y - p->dx = va_arg(marker, int); // dx - p->dy = va_arg(marker, int); // dy + p->_x = va_arg(marker, int); // x + p->_y = va_arg(marker, int); // y + p->_dx = va_arg(marker, int); // dx + p->_dy = va_arg(marker, int); // dy va_end(marker); // Reset variable arguments _dlAddIndex++; break; @@ -370,15 +370,15 @@ void Screen::displayList(dupdate_t update, ...) { // Blit the combined blit-list for (_dlRestoreIndex = 0, p = _dlBlistList; _dlRestoreIndex < blitLength; _dlRestoreIndex++, p++) { - if (p->dx) // Marks a used entry - displayRect(p->x, p->y, p->dx, p->dy); + if (p->_dx) // Marks a used entry + displayRect(p->_x, p->_y, p->_dx, p->_dy); } break; case kDisplayRestore: // Restore each rectangle for (_dlRestoreIndex = 0, p = _dlAddList; _dlRestoreIndex < _dlAddIndex; _dlRestoreIndex++, p++) { // Restoring from _backBuffer to _frontBuffer _dlRestoreList[_dlRestoreIndex] = *p; // Copy add-list to restore-list - moveImage(_backBuffer, p->x, p->y, p->dx, p->dy, kXPix, _frontBuffer, p->x, p->y, kXPix); + moveImage(_backBuffer, p->_x, p->_y, p->_dx, p->_dy, kXPix, _frontBuffer, p->_x, p->_y, kXPix); } _dlAddIndex = 0; // Reset add-list break; @@ -628,19 +628,19 @@ void Screen::hideCursor() { } bool Screen::isInX(const int16 x, const rect_t *rect) const { - return (x >= rect->x) && (x <= rect->x + rect->dx); + return (x >= rect->_x) && (x <= rect->_x + rect->_dx); } bool Screen::isInY(const int16 y, const rect_t *rect) const { - return (y >= rect->y) && (y <= rect->y + rect->dy); + return (y >= rect->_y) && (y <= rect->_y + rect->_dy); } /** * Check if two rectangles are overlapping */ bool Screen::isOverlapping(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)); + 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)); } /** diff --git a/engines/hugo/display.h b/engines/hugo/display.h index 38c63e9fe5..0d8120e916 100644 --- a/engines/hugo/display.h +++ b/engines/hugo/display.h @@ -39,10 +39,10 @@ static const int kCenter = -1; // Used to center text in x class Screen { public: struct rect_t { // Rectangle used in Display list - int16 x; // Position in dib - int16 y; // Position in dib - int16 dx; // width - int16 dy; // height + int16 _x; // Position in dib + int16 _y; // Position in dib + int16 _dx; // width + int16 _dy; // height }; Screen(HugoEngine *vm); diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp index 8b03a9a430..a3fc5dfe49 100644 --- a/engines/hugo/file.cpp +++ b/engines/hugo/file.cpp @@ -53,7 +53,7 @@ static const int s_bootCypherLen = sizeof(s_bootCypher) - 1; FileManager::FileManager(HugoEngine *vm) : _vm(vm) { - has_read_header = false; + _hasReadHeader = false; firstUIFFl = true; } @@ -115,23 +115,23 @@ seq_t *FileManager::readPCX(Common::ReadStream &f, seq_t *seqPtr, byte *imagePtr debugC(1, kDebugFile, "readPCX(..., %s)", name); // Read in the PCC header and check consistency - PCC_header.mfctr = f.readByte(); - PCC_header.vers = f.readByte(); - PCC_header.enc = f.readByte(); - PCC_header.bpx = f.readByte(); - PCC_header.x1 = f.readUint16LE(); - PCC_header.y1 = f.readUint16LE(); - PCC_header.x2 = f.readUint16LE(); - PCC_header.y2 = f.readUint16LE(); - PCC_header.xres = f.readUint16LE(); - PCC_header.yres = f.readUint16LE(); - f.read(PCC_header.palette, sizeof(PCC_header.palette)); - PCC_header.vmode = f.readByte(); - PCC_header.planes = f.readByte(); - PCC_header.bytesPerLine = f.readUint16LE(); - f.read(PCC_header.fill2, sizeof(PCC_header.fill2)); - - if (PCC_header.mfctr != 10) + _PCCHeader._mfctr = f.readByte(); + _PCCHeader._vers = f.readByte(); + _PCCHeader._enc = f.readByte(); + _PCCHeader._bpx = f.readByte(); + _PCCHeader._x1 = f.readUint16LE(); + _PCCHeader._y1 = f.readUint16LE(); + _PCCHeader._x2 = f.readUint16LE(); + _PCCHeader._y2 = f.readUint16LE(); + _PCCHeader._xres = f.readUint16LE(); + _PCCHeader._yres = f.readUint16LE(); + f.read(_PCCHeader._palette, sizeof(_PCCHeader._palette)); + _PCCHeader._vmode = f.readByte(); + _PCCHeader._planes = f.readByte(); + _PCCHeader._bytesPerLine = f.readUint16LE(); + f.read(_PCCHeader._fill2, sizeof(_PCCHeader._fill2)); + + if (_PCCHeader._mfctr != 10) error("Bad data file format: %s", name); // Allocate memory for seq_t if 0 @@ -142,10 +142,10 @@ seq_t *FileManager::readPCX(Common::ReadStream &f, seq_t *seqPtr, byte *imagePtr // Find size of image data in 8-bit DIB format // Note save of x2 - marks end of valid data before garbage - uint16 bytesPerLine4 = PCC_header.bytesPerLine * 4; // 4-bit bpl + uint16 bytesPerLine4 = _PCCHeader._bytesPerLine * 4; // 4-bit bpl seqPtr->_bytesPerLine8 = bytesPerLine4 * 2; // 8-bit bpl - seqPtr->_lines = PCC_header.y2 - PCC_header.y1 + 1; - seqPtr->_x2 = PCC_header.x2 - PCC_header.x1 + 1; + seqPtr->_lines = _PCCHeader._y2 - _PCCHeader._y1 + 1; + seqPtr->_x2 = _PCCHeader._x2 - _PCCHeader._x1 + 1; // Size of the image uint16 size = seqPtr->_lines * seqPtr->_bytesPerLine8; @@ -168,12 +168,12 @@ seq_t *FileManager::readPCX(Common::ReadStream &f, seq_t *seqPtr, byte *imagePtr for (int i = 0; i < (c & kLengthMask); i++) { *p++ = d; if ((uint16)(p - pline) == bytesPerLine4) - p = convertPCC(pline, y++, PCC_header.bytesPerLine, imagePtr); + p = convertPCC(pline, y++, _PCCHeader._bytesPerLine, imagePtr); } } else { *p++ = c; if ((uint16)(p - pline) == bytesPerLine4) - p = convertPCC(pline, y++, PCC_header.bytesPerLine, imagePtr); + p = convertPCC(pline, y++, _PCCHeader._bytesPerLine, imagePtr); } } return seqPtr; @@ -296,27 +296,27 @@ sound_pt FileManager::getSound(const int16 sound, uint16 *size) { return 0; } - if (!has_read_header) { + if (!_hasReadHeader) { for (int i = 0; i < kMaxSounds; i++) { - s_hdr[i]._size = fp.readUint16LE(); - s_hdr[i]._offset = fp.readUint32LE(); + _s_hdr[i]._size = fp.readUint16LE(); + _s_hdr[i]._offset = fp.readUint32LE(); } if (fp.err()) error("Wrong sound file format"); - has_read_header = true; + _hasReadHeader = true; } - *size = s_hdr[sound]._size; + *size = _s_hdr[sound]._size; if (*size == 0) 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 + sound_pt soundPtr = (byte *)malloc(_s_hdr[sound]._size); // Ptr to sound data assert(soundPtr); // 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) + fp.seek(_s_hdr[sound]._offset, SEEK_SET); + if (fp.read(soundPtr, _s_hdr[sound]._size) != _s_hdr[sound]._size) error("Wrong sound file format"); fp.close(); @@ -639,8 +639,8 @@ uif_hdr_t *FileManager::getUIFHeader(const uif_t id) { error("Wrong UIF file format"); for (int i = 0; i < kMaxUifs; ++i) { - UIFHeader[i].size = ip.readUint16LE(); - UIFHeader[i].offset = ip.readUint32LE(); + UIFHeader[i]._size = ip.readUint16LE(); + UIFHeader[i]._offset = ip.readUint32LE(); } ip.close(); @@ -661,7 +661,7 @@ void FileManager::readUIFItem(const int16 id, byte *buf) { // Seek to data uif_hdr_t *UIFHeaderPtr = getUIFHeader((uif_t)id); - ip.seek(UIFHeaderPtr->offset, SEEK_SET); + ip.seek(UIFHeaderPtr->_offset, SEEK_SET); // We support pcx images and straight data seq_t *dummySeq; // Dummy seq_t for image data @@ -671,7 +671,7 @@ void FileManager::readUIFItem(const int16 id, byte *buf) { free(dummySeq); break; default: // Read file data into supplied array - if (ip.read(buf, UIFHeaderPtr->size) != UIFHeaderPtr->size) + if (ip.read(buf, UIFHeaderPtr->_size) != UIFHeaderPtr->_size) error("Wrong UIF file format"); break; } diff --git a/engines/hugo/file.h b/engines/hugo/file.h index 3792c01ab4..81d3c73f5a 100644 --- a/engines/hugo/file.h +++ b/engines/hugo/file.h @@ -37,8 +37,8 @@ namespace Hugo { enum ovl_t {kOvlBoundary, kOvlOverlay, kOvlBase}; struct uif_hdr_t { // UIF font/image look up - uint16 size; // Size of uif item - uint32 offset; // Offset of item in file + uint16 _size; // Size of uif item + uint32 _offset; // Offset of item in file }; @@ -85,24 +85,24 @@ protected: * Structure of scenery file lookup entry */ struct sceneBlock_t { - uint32 scene_off; - uint32 scene_len; - uint32 b_off; - uint32 b_len; - uint32 o_off; - uint32 o_len; - uint32 ob_off; - uint32 ob_len; + uint32 _scene_off; + uint32 _scene_len; + uint32 _b_off; + uint32 _b_len; + uint32 _o_off; + uint32 _o_len; + uint32 _ob_off; + uint32 _ob_len; }; - struct PCC_header_t { // Structure of PCX file header - byte mfctr, vers, enc, bpx; - uint16 x1, y1, x2, y2; // bounding box - uint16 xres, yres; - byte palette[3 * kNumColors]; // EGA color palette - byte vmode, planes; - uint16 bytesPerLine; // Bytes per line - byte fill2[60]; + struct _PCCHeader_t { // Structure of PCX file header + byte _mfctr, _vers, _enc, _bpx; + uint16 _x1, _y1, _x2, _y2; // bounding box + uint16 _xres, _yres; + byte _palette[3 * kNumColors]; // EGA color palette + byte _vmode, _planes; + uint16 _bytesPerLine; // Bytes per line + byte _fill2[60]; }; // Header of a PCC file bool firstUIFFl; @@ -112,13 +112,13 @@ protected: Common::File _sceneryArchive1; // Handle for scenery file Common::File _objectsArchive; // Handle for objects file - PCC_header_t PCC_header; + _PCCHeader_t _PCCHeader; seq_t *readPCX(Common::ReadStream &f, seq_t *seqPtr, byte *imagePtr, const bool firstFl, const char *name); // If this is the first call, read the lookup table - bool has_read_header; - sound_hdr_t s_hdr[kMaxSounds]; // Sound lookup table + bool _hasReadHeader; + sound_hdr_t _s_hdr[kMaxSounds]; // Sound lookup table private: byte *convertPCC(byte *p, const uint16 y, const uint16 bpl, image_pt dataPtr) const; diff --git a/engines/hugo/file_v1w.cpp b/engines/hugo/file_v1w.cpp index 8a06cef939..3bb4b66367 100644 --- a/engines/hugo/file_v1w.cpp +++ b/engines/hugo/file_v1w.cpp @@ -52,28 +52,28 @@ void FileManager_v1w::readOverlay(const int screenNum, image_pt image, ovl_t ove _sceneryArchive1.seek((uint32)screenNum * sizeof(sceneBlock_t), SEEK_SET); sceneBlock_t sceneBlock; // Database header entry - sceneBlock.scene_off = _sceneryArchive1.readUint32LE(); - sceneBlock.scene_len = _sceneryArchive1.readUint32LE(); - sceneBlock.b_off = _sceneryArchive1.readUint32LE(); - sceneBlock.b_len = _sceneryArchive1.readUint32LE(); - sceneBlock.o_off = _sceneryArchive1.readUint32LE(); - sceneBlock.o_len = _sceneryArchive1.readUint32LE(); - sceneBlock.ob_off = _sceneryArchive1.readUint32LE(); - sceneBlock.ob_len = _sceneryArchive1.readUint32LE(); + sceneBlock._scene_off = _sceneryArchive1.readUint32LE(); + sceneBlock._scene_len = _sceneryArchive1.readUint32LE(); + sceneBlock._b_off = _sceneryArchive1.readUint32LE(); + sceneBlock._b_len = _sceneryArchive1.readUint32LE(); + sceneBlock._o_off = _sceneryArchive1.readUint32LE(); + sceneBlock._o_len = _sceneryArchive1.readUint32LE(); + sceneBlock._ob_off = _sceneryArchive1.readUint32LE(); + sceneBlock._ob_len = _sceneryArchive1.readUint32LE(); uint32 i = 0; switch (overlayType) { case kOvlBoundary: - _sceneryArchive1.seek(sceneBlock.b_off, SEEK_SET); - i = sceneBlock.b_len; + _sceneryArchive1.seek(sceneBlock._b_off, SEEK_SET); + i = sceneBlock._b_len; break; case kOvlOverlay: - _sceneryArchive1.seek(sceneBlock.o_off, SEEK_SET); - i = sceneBlock.o_len; + _sceneryArchive1.seek(sceneBlock._o_off, SEEK_SET); + i = sceneBlock._o_len; break; case kOvlBase: - _sceneryArchive1.seek(sceneBlock.ob_off, SEEK_SET); - i = sceneBlock.ob_len; + _sceneryArchive1.seek(sceneBlock._ob_off, SEEK_SET); + i = sceneBlock._ob_len; break; default: error("Bad overlayType: %d", overlayType); diff --git a/engines/hugo/file_v2d.cpp b/engines/hugo/file_v2d.cpp index 520e1b77b6..009b0b0bb8 100644 --- a/engines/hugo/file_v2d.cpp +++ b/engines/hugo/file_v2d.cpp @@ -81,16 +81,16 @@ void FileManager_v2d::readBackground(const int screenIndex) { _sceneryArchive1.seek((uint32) screenIndex * sizeof(sceneBlock_t), SEEK_SET); sceneBlock_t sceneBlock; // Read a database header entry - sceneBlock.scene_off = _sceneryArchive1.readUint32LE(); - sceneBlock.scene_len = _sceneryArchive1.readUint32LE(); - sceneBlock.b_off = _sceneryArchive1.readUint32LE(); - sceneBlock.b_len = _sceneryArchive1.readUint32LE(); - sceneBlock.o_off = _sceneryArchive1.readUint32LE(); - sceneBlock.o_len = _sceneryArchive1.readUint32LE(); - sceneBlock.ob_off = _sceneryArchive1.readUint32LE(); - sceneBlock.ob_len = _sceneryArchive1.readUint32LE(); + sceneBlock._scene_off = _sceneryArchive1.readUint32LE(); + sceneBlock._scene_len = _sceneryArchive1.readUint32LE(); + sceneBlock._b_off = _sceneryArchive1.readUint32LE(); + sceneBlock._b_len = _sceneryArchive1.readUint32LE(); + sceneBlock._o_off = _sceneryArchive1.readUint32LE(); + sceneBlock._o_len = _sceneryArchive1.readUint32LE(); + sceneBlock._ob_off = _sceneryArchive1.readUint32LE(); + sceneBlock._ob_len = _sceneryArchive1.readUint32LE(); - _sceneryArchive1.seek(sceneBlock.scene_off, SEEK_SET); + _sceneryArchive1.seek(sceneBlock._scene_off, SEEK_SET); // Read the image into dummy seq and static dib_a seq_t *dummySeq; // Image sequence structure for Read_pcx @@ -108,28 +108,28 @@ void FileManager_v2d::readOverlay(const int screenNum, image_pt image, ovl_t ove _sceneryArchive1.seek((uint32)screenNum * sizeof(sceneBlock_t), SEEK_SET); sceneBlock_t sceneBlock; // Database header entry - sceneBlock.scene_off = _sceneryArchive1.readUint32LE(); - sceneBlock.scene_len = _sceneryArchive1.readUint32LE(); - sceneBlock.b_off = _sceneryArchive1.readUint32LE(); - sceneBlock.b_len = _sceneryArchive1.readUint32LE(); - sceneBlock.o_off = _sceneryArchive1.readUint32LE(); - sceneBlock.o_len = _sceneryArchive1.readUint32LE(); - sceneBlock.ob_off = _sceneryArchive1.readUint32LE(); - sceneBlock.ob_len = _sceneryArchive1.readUint32LE(); + sceneBlock._scene_off = _sceneryArchive1.readUint32LE(); + sceneBlock._scene_len = _sceneryArchive1.readUint32LE(); + sceneBlock._b_off = _sceneryArchive1.readUint32LE(); + sceneBlock._b_len = _sceneryArchive1.readUint32LE(); + sceneBlock._o_off = _sceneryArchive1.readUint32LE(); + sceneBlock._o_len = _sceneryArchive1.readUint32LE(); + sceneBlock._ob_off = _sceneryArchive1.readUint32LE(); + sceneBlock._ob_len = _sceneryArchive1.readUint32LE(); uint32 i = 0; switch (overlayType) { case kOvlBoundary: - _sceneryArchive1.seek(sceneBlock.b_off, SEEK_SET); - i = sceneBlock.b_len; + _sceneryArchive1.seek(sceneBlock._b_off, SEEK_SET); + i = sceneBlock._b_len; break; case kOvlOverlay: - _sceneryArchive1.seek(sceneBlock.o_off, SEEK_SET); - i = sceneBlock.o_len; + _sceneryArchive1.seek(sceneBlock._o_off, SEEK_SET); + i = sceneBlock._o_len; break; case kOvlBase: - _sceneryArchive1.seek(sceneBlock.ob_off, SEEK_SET); - i = sceneBlock.ob_len; + _sceneryArchive1.seek(sceneBlock._ob_off, SEEK_SET); + i = sceneBlock._ob_len; break; default: error("Bad overlayType: %d", overlayType); diff --git a/engines/hugo/file_v3d.cpp b/engines/hugo/file_v3d.cpp index d86003a040..99a3a68d9e 100644 --- a/engines/hugo/file_v3d.cpp +++ b/engines/hugo/file_v3d.cpp @@ -53,22 +53,22 @@ void FileManager_v3d::readBackground(const int screenIndex) { _sceneryArchive1.seek((uint32) screenIndex * sizeof(sceneBlock_t), SEEK_SET); sceneBlock_t sceneBlock; // Read a database header entry - sceneBlock.scene_off = _sceneryArchive1.readUint32LE(); - sceneBlock.scene_len = _sceneryArchive1.readUint32LE(); - sceneBlock.b_off = _sceneryArchive1.readUint32LE(); - sceneBlock.b_len = _sceneryArchive1.readUint32LE(); - sceneBlock.o_off = _sceneryArchive1.readUint32LE(); - sceneBlock.o_len = _sceneryArchive1.readUint32LE(); - sceneBlock.ob_off = _sceneryArchive1.readUint32LE(); - sceneBlock.ob_len = _sceneryArchive1.readUint32LE(); + sceneBlock._scene_off = _sceneryArchive1.readUint32LE(); + sceneBlock._scene_len = _sceneryArchive1.readUint32LE(); + sceneBlock._b_off = _sceneryArchive1.readUint32LE(); + sceneBlock._b_len = _sceneryArchive1.readUint32LE(); + sceneBlock._o_off = _sceneryArchive1.readUint32LE(); + sceneBlock._o_len = _sceneryArchive1.readUint32LE(); + sceneBlock._ob_off = _sceneryArchive1.readUint32LE(); + sceneBlock._ob_len = _sceneryArchive1.readUint32LE(); seq_t *dummySeq; // Image sequence structure for Read_pcx if (screenIndex < 20) { - _sceneryArchive1.seek(sceneBlock.scene_off, SEEK_SET); + _sceneryArchive1.seek(sceneBlock._scene_off, SEEK_SET); // Read the image into dummy seq and static dib_a dummySeq = readPCX(_sceneryArchive1, 0, _vm->_screen->getFrontBuffer(), true, _vm->_text->getScreenNames(screenIndex)); } else { - _sceneryArchive2.seek(sceneBlock.scene_off, SEEK_SET); + _sceneryArchive2.seek(sceneBlock._scene_off, SEEK_SET); // Read the image into dummy seq and static dib_a dummySeq = readPCX(_sceneryArchive2, 0, _vm->_screen->getFrontBuffer(), true, _vm->_text->getScreenNames(screenIndex)); } @@ -113,30 +113,30 @@ void FileManager_v3d::readOverlay(const int screenNum, image_pt image, ovl_t ove _sceneryArchive1.seek((uint32)screenNum * sizeof(sceneBlock_t), SEEK_SET); sceneBlock_t sceneBlock; // Database header entry - sceneBlock.scene_off = _sceneryArchive1.readUint32LE(); - sceneBlock.scene_len = _sceneryArchive1.readUint32LE(); - sceneBlock.b_off = _sceneryArchive1.readUint32LE(); - sceneBlock.b_len = _sceneryArchive1.readUint32LE(); - sceneBlock.o_off = _sceneryArchive1.readUint32LE(); - sceneBlock.o_len = _sceneryArchive1.readUint32LE(); - sceneBlock.ob_off = _sceneryArchive1.readUint32LE(); - sceneBlock.ob_len = _sceneryArchive1.readUint32LE(); + sceneBlock._scene_off = _sceneryArchive1.readUint32LE(); + sceneBlock._scene_len = _sceneryArchive1.readUint32LE(); + sceneBlock._b_off = _sceneryArchive1.readUint32LE(); + sceneBlock._b_len = _sceneryArchive1.readUint32LE(); + sceneBlock._o_off = _sceneryArchive1.readUint32LE(); + sceneBlock._o_len = _sceneryArchive1.readUint32LE(); + sceneBlock._ob_off = _sceneryArchive1.readUint32LE(); + sceneBlock._ob_len = _sceneryArchive1.readUint32LE(); uint32 i = 0; if (screenNum < 20) { switch (overlayType) { case kOvlBoundary: - _sceneryArchive1.seek(sceneBlock.b_off, SEEK_SET); - i = sceneBlock.b_len; + _sceneryArchive1.seek(sceneBlock._b_off, SEEK_SET); + i = sceneBlock._b_len; break; case kOvlOverlay: - _sceneryArchive1.seek(sceneBlock.o_off, SEEK_SET); - i = sceneBlock.o_len; + _sceneryArchive1.seek(sceneBlock._o_off, SEEK_SET); + i = sceneBlock._o_len; break; case kOvlBase: - _sceneryArchive1.seek(sceneBlock.ob_off, SEEK_SET); - i = sceneBlock.ob_len; + _sceneryArchive1.seek(sceneBlock._ob_off, SEEK_SET); + i = sceneBlock._ob_len; break; default: error("Bad overlayType: %d", overlayType); @@ -166,16 +166,16 @@ void FileManager_v3d::readOverlay(const int screenNum, image_pt image, ovl_t ove } else { switch (overlayType) { case kOvlBoundary: - _sceneryArchive2.seek(sceneBlock.b_off, SEEK_SET); - i = sceneBlock.b_len; + _sceneryArchive2.seek(sceneBlock._b_off, SEEK_SET); + i = sceneBlock._b_len; break; case kOvlOverlay: - _sceneryArchive2.seek(sceneBlock.o_off, SEEK_SET); - i = sceneBlock.o_len; + _sceneryArchive2.seek(sceneBlock._o_off, SEEK_SET); + i = sceneBlock._o_len; break; case kOvlBase: - _sceneryArchive2.seek(sceneBlock.ob_off, SEEK_SET); - i = sceneBlock.ob_len; + _sceneryArchive2.seek(sceneBlock._ob_off, SEEK_SET); + i = sceneBlock._ob_len; break; default: error("Bad overlayType: %d", overlayType); -- cgit v1.2.3 From d3929bd4bc4dbd0f7f2b57000be757e6bc7706e8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 13 Jun 2012 14:50:09 +0200 Subject: HUGO: Some more renaming --- engines/hugo/file.h | 16 +++---- engines/hugo/file_v1w.cpp | 28 ++++++------ engines/hugo/file_v2d.cpp | 46 +++++++++---------- engines/hugo/file_v3d.cpp | 60 ++++++++++++------------- engines/hugo/intro.cpp | 110 +++++++++++++++++++++++----------------------- engines/hugo/intro.h | 6 +-- engines/hugo/route.cpp | 22 +++++----- engines/hugo/route.h | 4 +- 8 files changed, 146 insertions(+), 146 deletions(-) (limited to 'engines/hugo') diff --git a/engines/hugo/file.h b/engines/hugo/file.h index 81d3c73f5a..817bf49daf 100644 --- a/engines/hugo/file.h +++ b/engines/hugo/file.h @@ -85,14 +85,14 @@ protected: * Structure of scenery file lookup entry */ struct sceneBlock_t { - uint32 _scene_off; - uint32 _scene_len; - uint32 _b_off; - uint32 _b_len; - uint32 _o_off; - uint32 _o_len; - uint32 _ob_off; - uint32 _ob_len; + uint32 _sceneOffset; + uint32 _sceneLength; + uint32 _boundaryOffset; + uint32 _boundaryLength; + uint32 _overlayOffset; + uint32 _overlayLength; + uint32 _baseOffset; + uint32 _baseLength; }; struct _PCCHeader_t { // Structure of PCX file header diff --git a/engines/hugo/file_v1w.cpp b/engines/hugo/file_v1w.cpp index 3bb4b66367..fba13d6915 100644 --- a/engines/hugo/file_v1w.cpp +++ b/engines/hugo/file_v1w.cpp @@ -52,28 +52,28 @@ void FileManager_v1w::readOverlay(const int screenNum, image_pt image, ovl_t ove _sceneryArchive1.seek((uint32)screenNum * sizeof(sceneBlock_t), SEEK_SET); sceneBlock_t sceneBlock; // Database header entry - sceneBlock._scene_off = _sceneryArchive1.readUint32LE(); - sceneBlock._scene_len = _sceneryArchive1.readUint32LE(); - sceneBlock._b_off = _sceneryArchive1.readUint32LE(); - sceneBlock._b_len = _sceneryArchive1.readUint32LE(); - sceneBlock._o_off = _sceneryArchive1.readUint32LE(); - sceneBlock._o_len = _sceneryArchive1.readUint32LE(); - sceneBlock._ob_off = _sceneryArchive1.readUint32LE(); - sceneBlock._ob_len = _sceneryArchive1.readUint32LE(); + sceneBlock._sceneOffset = _sceneryArchive1.readUint32LE(); + sceneBlock._sceneLength = _sceneryArchive1.readUint32LE(); + sceneBlock._boundaryOffset = _sceneryArchive1.readUint32LE(); + sceneBlock._boundaryLength = _sceneryArchive1.readUint32LE(); + sceneBlock._overlayOffset = _sceneryArchive1.readUint32LE(); + sceneBlock._overlayLength = _sceneryArchive1.readUint32LE(); + sceneBlock._baseOffset = _sceneryArchive1.readUint32LE(); + sceneBlock._baseLength = _sceneryArchive1.readUint32LE(); uint32 i = 0; switch (overlayType) { case kOvlBoundary: - _sceneryArchive1.seek(sceneBlock._b_off, SEEK_SET); - i = sceneBlock._b_len; + _sceneryArchive1.seek(sceneBlock._boundaryOffset, SEEK_SET); + i = sceneBlock._boundaryLength; break; case kOvlOverlay: - _sceneryArchive1.seek(sceneBlock._o_off, SEEK_SET); - i = sceneBlock._o_len; + _sceneryArchive1.seek(sceneBlock._overlayOffset, SEEK_SET); + i = sceneBlock._overlayLength; break; case kOvlBase: - _sceneryArchive1.seek(sceneBlock._ob_off, SEEK_SET); - i = sceneBlock._ob_len; + _sceneryArchive1.seek(sceneBlock._baseOffset, SEEK_SET); + i = sceneBlock._baseLength; break; default: error("Bad overlayType: %d", overlayType); diff --git a/engines/hugo/file_v2d.cpp b/engines/hugo/file_v2d.cpp index 009b0b0bb8..7239e5174a 100644 --- a/engines/hugo/file_v2d.cpp +++ b/engines/hugo/file_v2d.cpp @@ -81,16 +81,16 @@ void FileManager_v2d::readBackground(const int screenIndex) { _sceneryArchive1.seek((uint32) screenIndex * sizeof(sceneBlock_t), SEEK_SET); sceneBlock_t sceneBlock; // Read a database header entry - sceneBlock._scene_off = _sceneryArchive1.readUint32LE(); - sceneBlock._scene_len = _sceneryArchive1.readUint32LE(); - sceneBlock._b_off = _sceneryArchive1.readUint32LE(); - sceneBlock._b_len = _sceneryArchive1.readUint32LE(); - sceneBlock._o_off = _sceneryArchive1.readUint32LE(); - sceneBlock._o_len = _sceneryArchive1.readUint32LE(); - sceneBlock._ob_off = _sceneryArchive1.readUint32LE(); - sceneBlock._ob_len = _sceneryArchive1.readUint32LE(); + sceneBlock._sceneOffset = _sceneryArchive1.readUint32LE(); + sceneBlock._sceneLength = _sceneryArchive1.readUint32LE(); + sceneBlock._boundaryOffset = _sceneryArchive1.readUint32LE(); + sceneBlock._boundaryLength = _sceneryArchive1.readUint32LE(); + sceneBlock._overlayOffset = _sceneryArchive1.readUint32LE(); + sceneBlock._overlayLength = _sceneryArchive1.readUint32LE(); + sceneBlock._baseOffset = _sceneryArchive1.readUint32LE(); + sceneBlock._baseLength = _sceneryArchive1.readUint32LE(); - _sceneryArchive1.seek(sceneBlock._scene_off, SEEK_SET); + _sceneryArchive1.seek(sceneBlock._sceneOffset, SEEK_SET); // Read the image into dummy seq and static dib_a seq_t *dummySeq; // Image sequence structure for Read_pcx @@ -108,28 +108,28 @@ void FileManager_v2d::readOverlay(const int screenNum, image_pt image, ovl_t ove _sceneryArchive1.seek((uint32)screenNum * sizeof(sceneBlock_t), SEEK_SET); sceneBlock_t sceneBlock; // Database header entry - sceneBlock._scene_off = _sceneryArchive1.readUint32LE(); - sceneBlock._scene_len = _sceneryArchive1.readUint32LE(); - sceneBlock._b_off = _sceneryArchive1.readUint32LE(); - sceneBlock._b_len = _sceneryArchive1.readUint32LE(); - sceneBlock._o_off = _sceneryArchive1.readUint32LE(); - sceneBlock._o_len = _sceneryArchive1.readUint32LE(); - sceneBlock._ob_off = _sceneryArchive1.readUint32LE(); - sceneBlock._ob_len = _sceneryArchive1.readUint32LE(); + sceneBlock._sceneOffset = _sceneryArchive1.readUint32LE(); + sceneBlock._sceneLength = _sceneryArchive1.readUint32LE(); + sceneBlock._boundaryOffset = _sceneryArchive1.readUint32LE(); + sceneBlock._boundaryLength = _sceneryArchive1.readUint32LE(); + sceneBlock._overlayOffset = _sceneryArchive1.readUint32LE(); + sceneBlock._overlayLength = _sceneryArchive1.readUint32LE(); + sceneBlock._baseOffset = _sceneryArchive1.readUint32LE(); + sceneBlock._baseLength = _sceneryArchive1.readUint32LE(); uint32 i = 0; switch (overlayType) { case kOvlBoundary: - _sceneryArchive1.seek(sceneBlock._b_off, SEEK_SET); - i = sceneBlock._b_len; + _sceneryArchive1.seek(sceneBlock._boundaryOffset, SEEK_SET); + i = sceneBlock._boundaryLength; break; case kOvlOverlay: - _sceneryArchive1.seek(sceneBlock._o_off, SEEK_SET); - i = sceneBlock._o_len; + _sceneryArchive1.seek(sceneBlock._overlayOffset, SEEK_SET); + i = sceneBlock._overlayLength; break; case kOvlBase: - _sceneryArchive1.seek(sceneBlock._ob_off, SEEK_SET); - i = sceneBlock._ob_len; + _sceneryArchive1.seek(sceneBlock._baseOffset, SEEK_SET); + i = sceneBlock._baseLength; break; default: error("Bad overlayType: %d", overlayType); diff --git a/engines/hugo/file_v3d.cpp b/engines/hugo/file_v3d.cpp index 99a3a68d9e..34c745efb6 100644 --- a/engines/hugo/file_v3d.cpp +++ b/engines/hugo/file_v3d.cpp @@ -53,22 +53,22 @@ void FileManager_v3d::readBackground(const int screenIndex) { _sceneryArchive1.seek((uint32) screenIndex * sizeof(sceneBlock_t), SEEK_SET); sceneBlock_t sceneBlock; // Read a database header entry - sceneBlock._scene_off = _sceneryArchive1.readUint32LE(); - sceneBlock._scene_len = _sceneryArchive1.readUint32LE(); - sceneBlock._b_off = _sceneryArchive1.readUint32LE(); - sceneBlock._b_len = _sceneryArchive1.readUint32LE(); - sceneBlock._o_off = _sceneryArchive1.readUint32LE(); - sceneBlock._o_len = _sceneryArchive1.readUint32LE(); - sceneBlock._ob_off = _sceneryArchive1.readUint32LE(); - sceneBlock._ob_len = _sceneryArchive1.readUint32LE(); + sceneBlock._sceneOffset = _sceneryArchive1.readUint32LE(); + sceneBlock._sceneLength = _sceneryArchive1.readUint32LE(); + sceneBlock._boundaryOffset = _sceneryArchive1.readUint32LE(); + sceneBlock._boundaryLength = _sceneryArchive1.readUint32LE(); + sceneBlock._overlayOffset = _sceneryArchive1.readUint32LE(); + sceneBlock._overlayLength = _sceneryArchive1.readUint32LE(); + sceneBlock._baseOffset = _sceneryArchive1.readUint32LE(); + sceneBlock._baseLength = _sceneryArchive1.readUint32LE(); seq_t *dummySeq; // Image sequence structure for Read_pcx if (screenIndex < 20) { - _sceneryArchive1.seek(sceneBlock._scene_off, SEEK_SET); + _sceneryArchive1.seek(sceneBlock._sceneOffset, SEEK_SET); // Read the image into dummy seq and static dib_a dummySeq = readPCX(_sceneryArchive1, 0, _vm->_screen->getFrontBuffer(), true, _vm->_text->getScreenNames(screenIndex)); } else { - _sceneryArchive2.seek(sceneBlock._scene_off, SEEK_SET); + _sceneryArchive2.seek(sceneBlock._sceneOffset, SEEK_SET); // Read the image into dummy seq and static dib_a dummySeq = readPCX(_sceneryArchive2, 0, _vm->_screen->getFrontBuffer(), true, _vm->_text->getScreenNames(screenIndex)); } @@ -113,30 +113,30 @@ void FileManager_v3d::readOverlay(const int screenNum, image_pt image, ovl_t ove _sceneryArchive1.seek((uint32)screenNum * sizeof(sceneBlock_t), SEEK_SET); sceneBlock_t sceneBlock; // Database header entry - sceneBlock._scene_off = _sceneryArchive1.readUint32LE(); - sceneBlock._scene_len = _sceneryArchive1.readUint32LE(); - sceneBlock._b_off = _sceneryArchive1.readUint32LE(); - sceneBlock._b_len = _sceneryArchive1.readUint32LE(); - sceneBlock._o_off = _sceneryArchive1.readUint32LE(); - sceneBlock._o_len = _sceneryArchive1.readUint32LE(); - sceneBlock._ob_off = _sceneryArchive1.readUint32LE(); - sceneBlock._ob_len = _sceneryArchive1.readUint32LE(); + sceneBlock._sceneOffset = _sceneryArchive1.readUint32LE(); + sceneBlock._sceneLength = _sceneryArchive1.readUint32LE(); + sceneBlock._boundaryOffset = _sceneryArchive1.readUint32LE(); + sceneBlock._boundaryLength = _sceneryArchive1.readUint32LE(); + sceneBlock._overlayOffset = _sceneryArchive1.readUint32LE(); + sceneBlock._overlayLength = _sceneryArchive1.readUint32LE(); + sceneBlock._baseOffset = _sceneryArchive1.readUint32LE(); + sceneBlock._baseLength = _sceneryArchive1.readUint32LE(); uint32 i = 0; if (screenNum < 20) { switch (overlayType) { case kOvlBoundary: - _sceneryArchive1.seek(sceneBlock._b_off, SEEK_SET); - i = sceneBlock._b_len; + _sceneryArchive1.seek(sceneBlock._boundaryOffset, SEEK_SET); + i = sceneBlock._boundaryLength; break; case kOvlOverlay: - _sceneryArchive1.seek(sceneBlock._o_off, SEEK_SET); - i = sceneBlock._o_len; + _sceneryArchive1.seek(sceneBlock._overlayOffset, SEEK_SET); + i = sceneBlock._overlayLength; break; case kOvlBase: - _sceneryArchive1.seek(sceneBlock._ob_off, SEEK_SET); - i = sceneBlock._ob_len; + _sceneryArchive1.seek(sceneBlock._baseOffset, SEEK_SET); + i = sceneBlock._baseLength; break; default: error("Bad overlayType: %d", overlayType); @@ -166,16 +166,16 @@ void FileManager_v3d::readOverlay(const int screenNum, image_pt image, ovl_t ove } else { switch (overlayType) { case kOvlBoundary: - _sceneryArchive2.seek(sceneBlock._b_off, SEEK_SET); - i = sceneBlock._b_len; + _sceneryArchive2.seek(sceneBlock._boundaryOffset, SEEK_SET); + i = sceneBlock._boundaryLength; break; case kOvlOverlay: - _sceneryArchive2.seek(sceneBlock._o_off, SEEK_SET); - i = sceneBlock._o_len; + _sceneryArchive2.seek(sceneBlock._overlayOffset, SEEK_SET); + i = sceneBlock._overlayLength; break; case kOvlBase: - _sceneryArchive2.seek(sceneBlock._ob_off, SEEK_SET); - i = sceneBlock._ob_len; + _sceneryArchive2.seek(sceneBlock._baseOffset, SEEK_SET); + i = sceneBlock._baseLength; break; default: error("Bad overlayType: %d", overlayType); diff --git a/engines/hugo/intro.cpp b/engines/hugo/intro.cpp index 599d8f21d3..f2ae06eb39 100644 --- a/engines/hugo/intro.cpp +++ b/engines/hugo/intro.cpp @@ -86,12 +86,12 @@ void intro_v1d::preNewGame() { void intro_v1d::introInit() { _introState = 0; - introTicks = 0; - surf.w = 320; - surf.h = 200; - surf.pixels = _vm->_screen->getFrontBuffer(); - surf.pitch = 320; - surf.format = Graphics::PixelFormat::createFormatCLUT8(); + _introTicks = 0; + _surf.w = 320; + _surf.h = 200; + _surf.pixels = _vm->_screen->getFrontBuffer(); + _surf.pitch = 320; + _surf.format = Graphics::PixelFormat::createFormatCLUT8(); _vm->_screen->displayList(kDisplayInit); } @@ -101,7 +101,7 @@ bool intro_v1d::introPlay() { if (_vm->getGameStatus()._skipIntroFl) return true; - if (introTicks < introSize) { + if (_introTicks < introSize) { switch (_introState++) { case 0: _vm->_screen->drawRectangle(true, 0, 0, 319, 199, _TMAGENTA); @@ -113,7 +113,7 @@ bool intro_v1d::introPlay() { _vm->_screen->drawShape(250,92,_TLIGHTMAGENTA,_TMAGENTA); // TROMAN, size 10-5 - if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 8))) + if (!_font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 8))) error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 8"); char buffer[80]; @@ -126,19 +126,19 @@ bool intro_v1d::introPlay() { else error("Unknown registration flag in hugo.bsf: %d", _vm->_boot._registered); - font.drawString(&surf, buffer, 0, 163, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); - font.drawString(&surf, _vm->getCopyrightString(), 0, 176, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); + _font.drawString(&_surf, buffer, 0, 163, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); + _font.drawString(&_surf, _vm->getCopyrightString(), 0, 176, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); if ((*_vm->_boot._distrib != '\0') && (scumm_stricmp(_vm->_boot._distrib, "David P. Gray"))) { sprintf(buffer, "Distributed by %s.", _vm->_boot._distrib); - font.drawString(&surf, buffer, 0, 75, 320, _TMAGENTA, Graphics::kTextAlignCenter); + _font.drawString(&_surf, buffer, 0, 75, 320, _TMAGENTA, Graphics::kTextAlignCenter); } // SCRIPT, size 24-16 strcpy(buffer, "Hugo's"); - if (font.loadFromFON("SCRIPT.FON")) { - font.drawString(&surf, buffer, 0, 20, 320, _TMAGENTA, Graphics::kTextAlignCenter); + if (_font.loadFromFON("SCRIPT.FON")) { + _font.drawString(&_surf, buffer, 0, 20, 320, _TMAGENTA, Graphics::kTextAlignCenter); } else { // Workaround: SCRIPT.FON doesn't load properly at the moment _vm->_screen->loadFont(2); @@ -146,78 +146,78 @@ bool intro_v1d::introPlay() { } // TROMAN, size 30-24 - if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 24))) + if (!_font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 24))) error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 24"); strcpy(buffer, "House of Horrors !"); - font.drawString(&surf, buffer, 0, 50, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); + _font.drawString(&_surf, buffer, 0, 50, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); break; case 2: _vm->_screen->drawRectangle(true, 82, 92, 237, 138, _TBLACK); // TROMAN, size 16-9 - if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 14))) + if (!_font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 14))) error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 14"); strcpy(buffer, "S t a r r i n g :"); - font.drawString(&surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter); + _font.drawString(&_surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter); break; case 3: // TROMAN, size 20-9 - if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 18))) + if (!_font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 18))) error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 18"); strcpy(buffer, "Hugo !"); - font.drawString(&surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); + _font.drawString(&_surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); break; case 4: _vm->_screen->drawRectangle(true, 82, 92, 237, 138, _TBLACK); // TROMAN, size 16-9 - if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 14))) + if (!_font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 14))) error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 14"); strcpy(buffer, "P r o d u c e d b y :"); - font.drawString(&surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter); + _font.drawString(&_surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter); break; case 5: // TROMAN size 16-9 strcpy(buffer, "David P Gray !"); - font.drawString(&surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); + _font.drawString(&_surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); break; case 6: _vm->_screen->drawRectangle(true, 82, 92, 237, 138, _TBLACK); // TROMAN, size 16-9 strcpy(buffer, "D i r e c t e d b y :"); - font.drawString(&surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter); + _font.drawString(&_surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter); break; case 7: // TROMAN, size 16-9 strcpy(buffer, "David P Gray !"); - font.drawString(&surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); + _font.drawString(&_surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); break; case 8: _vm->_screen->drawRectangle(true, 82, 92, 237, 138, _TBLACK); // TROMAN, size 16-9 strcpy(buffer, "M u s i c b y :"); - font.drawString(&surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter); + _font.drawString(&_surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter); break; case 9: // TROMAN, size 16-9 strcpy(buffer, "David P Gray !"); - font.drawString(&surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); + _font.drawString(&_surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); break; case 10: _vm->_screen->drawRectangle(true, 82, 92, 237, 138, _TBLACK); // TROMAN, size 20-14 - if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 18))) + if (!_font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 18))) error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 18"); strcpy(buffer, "E n j o y !"); - font.drawString(&surf, buffer, 0, 100, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); + _font.drawString(&_surf, buffer, 0, 100, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); break; } @@ -226,7 +226,7 @@ bool intro_v1d::introPlay() { g_system->delayMillis(1000); } - return (++introTicks >= introSize); + return (++_introTicks >= introSize); } intro_v2d::intro_v2d(HugoEngine *vm) : IntroHandler(vm) { @@ -241,16 +241,16 @@ void intro_v2d::preNewGame() { void intro_v2d::introInit() { _vm->_screen->displayList(kDisplayInit); _vm->_file->readBackground(_vm->_numScreens - 1); // display splash screen - surf.w = 320; - surf.h = 200; - surf.pixels = _vm->_screen->getFrontBuffer(); - surf.pitch = 320; - surf.format = Graphics::PixelFormat::createFormatCLUT8(); + _surf.w = 320; + _surf.h = 200; + _surf.pixels = _vm->_screen->getFrontBuffer(); + _surf.pitch = 320; + _surf.format = Graphics::PixelFormat::createFormatCLUT8(); char buffer[128]; // TROMAN, size 10-5 - if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 8))) + if (!_font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 8))) error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 8"); if (_vm->_boot._registered) @@ -258,12 +258,12 @@ void intro_v2d::introInit() { else sprintf(buffer, "%s Shareware Version", _vm->getCopyrightString()); - font.drawString(&surf, buffer, 0, 186, 320, _TLIGHTRED, Graphics::kTextAlignCenter); + _font.drawString(&_surf, buffer, 0, 186, 320, _TLIGHTRED, Graphics::kTextAlignCenter); if ((*_vm->_boot._distrib != '\0') && (scumm_stricmp(_vm->_boot._distrib, "David P. Gray"))) { // TROMAN, size 10-5 sprintf(buffer, "Distributed by %s.", _vm->_boot._distrib); - font.drawString(&surf, buffer, 0, 1, 320, _TLIGHTRED, Graphics::kTextAlignCenter); + _font.drawString(&_surf, buffer, 0, 1, 320, _TLIGHTRED, Graphics::kTextAlignCenter); } _vm->_screen->displayBackground(); @@ -287,11 +287,11 @@ void intro_v3d::preNewGame() { void intro_v3d::introInit() { _vm->_screen->displayList(kDisplayInit); _vm->_file->readBackground(_vm->_numScreens - 1); // display splash screen - surf.w = 320; - surf.h = 200; - surf.pixels = _vm->_screen->getFrontBuffer(); - surf.pitch = 320; - surf.format = Graphics::PixelFormat::createFormatCLUT8(); + _surf.w = 320; + _surf.h = 200; + _surf.pixels = _vm->_screen->getFrontBuffer(); + _surf.pitch = 320; + _surf.format = Graphics::PixelFormat::createFormatCLUT8(); char buffer[128]; if (_vm->_boot._registered) @@ -300,14 +300,14 @@ void intro_v3d::introInit() { sprintf(buffer,"%s Shareware Version", _vm->getCopyrightString()); // TROMAN, size 10-5 - if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 8))) + if (!_font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 8))) error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 8"); - font.drawString(&surf, buffer, 0, 190, 320, _TBROWN, Graphics::kTextAlignCenter); + _font.drawString(&_surf, buffer, 0, 190, 320, _TBROWN, Graphics::kTextAlignCenter); if ((*_vm->_boot._distrib != '\0') && (scumm_stricmp(_vm->_boot._distrib, "David P. Gray"))) { sprintf(buffer, "Distributed by %s.", _vm->_boot._distrib); - font.drawString(&surf, buffer, 0, 0, 320, _TBROWN, Graphics::kTextAlignCenter); + _font.drawString(&_surf, buffer, 0, 0, 320, _TBROWN, Graphics::kTextAlignCenter); } _vm->_screen->displayBackground(); @@ -316,7 +316,7 @@ void intro_v3d::introInit() { _vm->_file->readBackground(22); // display screen MAP_3d _vm->_screen->displayBackground(); - introTicks = 0; + _introTicks = 0; _vm->_sound->_DOSSongPtr = _vm->_sound->_DOSIntroSong; } @@ -328,12 +328,12 @@ bool intro_v3d::introPlay() { if (_vm->getGameStatus()._skipIntroFl) return true; - if (introTicks < getIntroSize()) { - font.drawString(&surf, ".", _introX[introTicks], _introY[introTicks] - kDibOffY, 320, _TBRIGHTWHITE); + if (_introTicks < getIntroSize()) { + _font.drawString(&_surf, ".", _introX[_introTicks], _introY[_introTicks] - kDibOffY, 320, _TBRIGHTWHITE); _vm->_screen->displayBackground(); // Text boxes at various times - switch (introTicks) { + switch (_introTicks) { case 4: Utils::notifyBox(_vm->_text->getTextIntro(kIntro1)); break; @@ -346,7 +346,7 @@ bool intro_v3d::introPlay() { } } - return (++introTicks >= getIntroSize()); + return (++_introTicks >= getIntroSize()); } intro_v1w::intro_v1w(HugoEngine *vm) : IntroHandler(vm) { @@ -407,7 +407,7 @@ void intro_v3w::introInit() { g_system->delayMillis(3000); _vm->_file->readBackground(22); // display screen MAP_3w _vm->_screen->displayBackground(); - introTicks = 0; + _introTicks = 0; _vm->_screen->loadFont(0); } @@ -419,13 +419,13 @@ bool intro_v3w::introPlay() { if (_vm->getGameStatus()._skipIntroFl) return true; - if (introTicks < getIntroSize()) { + if (_introTicks < getIntroSize()) { // Scale viewport x_intro,y_intro to screen (offsetting y) - _vm->_screen->writeStr(_introX[introTicks], _introY[introTicks] - kDibOffY, "x", _TBRIGHTWHITE); + _vm->_screen->writeStr(_introX[_introTicks], _introY[_introTicks] - kDibOffY, "x", _TBRIGHTWHITE); _vm->_screen->displayBackground(); // Text boxes at various times - switch (introTicks) { + switch (_introTicks) { case 4: Utils::notifyBox(_vm->_text->getTextIntro(kIntro1)); break; @@ -438,6 +438,6 @@ bool intro_v3w::introPlay() { } } - return (++introTicks >= getIntroSize()); + return (++_introTicks >= getIntroSize()); } } // End of namespace Hugo diff --git a/engines/hugo/intro.h b/engines/hugo/intro.h index 1bb039216a..d5a5a4e4b4 100644 --- a/engines/hugo/intro.h +++ b/engines/hugo/intro.h @@ -42,8 +42,8 @@ enum seqTextIntro { class IntroHandler { public: IntroHandler(HugoEngine *vm); - Graphics::Surface surf; - Graphics::WinFont font; + Graphics::Surface _surf; + Graphics::WinFont _font; virtual ~IntroHandler(); @@ -62,7 +62,7 @@ protected: byte *_introX; byte *_introY; byte _introXSize; - int16 introTicks; // Count calls to introPlay() + int16 _introTicks; // Count calls to introPlay() }; class intro_v1w : public IntroHandler { diff --git a/engines/hugo/route.cpp b/engines/hugo/route.cpp index 552ddaf5c9..7f63ccac3b 100644 --- a/engines/hugo/route.cpp +++ b/engines/hugo/route.cpp @@ -286,9 +286,9 @@ void Route::segment(int16 x, int16 y) { } else { // Create segment seg_p = &_segment[_segmentNumb]; - seg_p->y = y; - seg_p->x1 = x1; - seg_p->x2 = x2; + seg_p->_y = y; + seg_p->_x1 = x1; + seg_p->_x2 = x2; _segmentNumb++; } } @@ -368,9 +368,9 @@ bool Route::findRoute(const int16 cx, const int16 cy) { _route[0].y = _destY; // Make a final segment for hero's base (we left a spare) - _segment[_segmentNumb].y = heroy; - _segment[_segmentNumb].x1 = herox1; - _segment[_segmentNumb].x2 = herox2; + _segment[_segmentNumb]._y = heroy; + _segment[_segmentNumb]._x1 = herox1; + _segment[_segmentNumb]._x2 = herox2; _segmentNumb++; Point *routeNode; // Ptr to route node @@ -378,22 +378,22 @@ bool Route::findRoute(const int16 cx, const int16 cy) { for (i = 0, _routeListIndex = 0; i < _segmentNumb - 1; i++) { if ((routeNode = newNode()) == 0) // New node for new segment return false; // Too many nodes - routeNode->y = _segment[i].y; + routeNode->y = _segment[i]._y; // Look ahead for furthest straight line for (int16 j = i + 1; j < _segmentNumb; j++) { segment_t *seg_p = &_segment[j]; // Can we get to this segment from previous node? - if (seg_p->x1 <= routeNode->x && seg_p->x2 >= routeNode->x + _heroWidth - 1) { - routeNode->y = seg_p->y; // Yes, keep updating node + if (seg_p->_x1 <= routeNode->x && seg_p->_x2 >= routeNode->x + _heroWidth - 1) { + routeNode->y = seg_p->_y; // Yes, keep updating node } else { // No, create another node on previous segment to reach it if ((routeNode = newNode()) == 0) // Add new route node return false; // Too many nodes // Find overlap between old and new segments - int16 x1 = MAX(_segment[j - 1].x1, seg_p->x1); - int16 x2 = MIN(_segment[j - 1].x2, seg_p->x2); + int16 x1 = MAX(_segment[j - 1]._x1, seg_p->_x1); + int16 x2 = MIN(_segment[j - 1]._x2, seg_p->_x2); // If room, add a little offset to reduce staircase effect int16 dx = kHeroMaxWidth >> 1; diff --git a/engines/hugo/route.h b/engines/hugo/route.h index a95dd2151b..b20ac771d7 100644 --- a/engines/hugo/route.h +++ b/engines/hugo/route.h @@ -43,8 +43,8 @@ struct Point { }; struct segment_t { // Search segment - int16 y; // y position - int16 x1, x2; // Range of segment + int16 _y; // y position + int16 _x1, _x2; // Range of segment }; class Route { -- cgit v1.2.3 From 0c7fcff8a3fa10fc9bedcf0ac299809f9a140632 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 13 Jun 2012 16:28:47 +0200 Subject: HUGO: Use Common::Point in pathfinding --- engines/hugo/route.cpp | 6 +++--- engines/hugo/route.h | 11 ++++------- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'engines/hugo') diff --git a/engines/hugo/route.cpp b/engines/hugo/route.cpp index 7f63ccac3b..873cb587af 100644 --- a/engines/hugo/route.cpp +++ b/engines/hugo/route.cpp @@ -298,7 +298,7 @@ void Route::segment(int16 x, int16 y) { * Create and return ptr to new node. Initialize with previous node. * Returns 0 if MAX_NODES exceeded */ -Point *Route::newNode() { +Common::Point *Route::newNode() { debugC(1, kDebugRoute, "newNode"); _routeListIndex++; @@ -373,7 +373,7 @@ bool Route::findRoute(const int16 cx, const int16 cy) { _segment[_segmentNumb]._x2 = herox2; _segmentNumb++; - Point *routeNode; // Ptr to route node + Common::Point *routeNode; // Ptr to route node // Look in segments[] for straight lines from destination to hero for (i = 0, _routeListIndex = 0; i < _segmentNumb - 1; i++) { if ((routeNode = newNode()) == 0) // New node for new segment @@ -435,7 +435,7 @@ void Route::processRoute() { // Current hero position int16 herox = _vm->_hero->_x + _vm->_hero->_currImagePtr->_x1; int16 heroy = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2; - Point *routeNode = &_route[_routeIndex]; + Common::Point *routeNode = &_route[_routeIndex]; // Arrived at node? if (abs(herox - routeNode->x) < kStepDx + 1 && abs(heroy - routeNode->y) < kStepDy) { diff --git a/engines/hugo/route.h b/engines/hugo/route.h index b20ac771d7..53b0dd0f88 100644 --- a/engines/hugo/route.h +++ b/engines/hugo/route.h @@ -30,6 +30,8 @@ #ifndef HUGO_ROUTE_H #define HUGO_ROUTE_H +#include "common/rect.h" + namespace Hugo { /** @@ -37,11 +39,6 @@ namespace Hugo { */ enum go_t {kRouteSpace, kRouteExit, kRouteLook, kRouteGet}; -struct Point { - int x; - int y; -}; - struct segment_t { // Search segment int16 _y; // y position int16 _x1, _x2; // Range of segment @@ -75,7 +72,7 @@ private: byte _boundaryMap[kYPix][kXPix]; // Boundary byte map segment_t _segment[kMaxSeg]; // List of points in fill-path - Point _route[kMaxNodes]; // List of nodes in route (global) + Common::Point _route[kMaxNodes]; // List of nodes in route (global) int16 _segmentNumb; // Count number of segments int16 _routeListIndex; // Index into route list int16 _destX; @@ -87,7 +84,7 @@ private: void segment(int16 x, int16 y); bool findRoute(const int16 cx, const int16 cy); - Point *newNode(); + Common::Point *newNode(); }; } // End of namespace Hugo -- cgit v1.2.3 From fbc2c6d08ac96c92e2424118dc9b0548628287e5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 13 Jun 2012 17:44:09 +0200 Subject: HUGO: More renaming --- engines/hugo/dialogs.cpp | 8 +- engines/hugo/file.cpp | 24 +- engines/hugo/file.h | 6 +- engines/hugo/hugo.cpp | 12 +- engines/hugo/hugo.h | 32 +- engines/hugo/mouse.cpp | 46 +- engines/hugo/parser.cpp | 4 +- engines/hugo/schedule.cpp | 1032 ++++++++++++++++++++++----------------------- engines/hugo/schedule.h | 519 +++++++++++------------ engines/hugo/sound.cpp | 12 +- 10 files changed, 840 insertions(+), 855 deletions(-) (limited to 'engines/hugo') diff --git a/engines/hugo/dialogs.cpp b/engines/hugo/dialogs.cpp index 0efd47a3bd..0f07d52aee 100644 --- a/engines/hugo/dialogs.cpp +++ b/engines/hugo/dialogs.cpp @@ -109,12 +109,12 @@ void TopMenu::reflowLayout() { // Set the graphics to the 'on' buttons, except for the variable ones _whatButton->setGfx(_arrayBmp[4 * kMenuWhat + scale - 1]); - _musicButton->setGfx(_arrayBmp[4 * kMenuMusic + scale - 1 + ((_vm->_config.musicFl) ? 0 : 2)]); - _soundFXButton->setGfx(_arrayBmp[4 * kMenuSoundFX + scale - 1 + ((_vm->_config.soundFl) ? 0 : 2)]); + _musicButton->setGfx(_arrayBmp[4 * kMenuMusic + scale - 1 + ((_vm->_config._musicFl) ? 0 : 2)]); + _soundFXButton->setGfx(_arrayBmp[4 * kMenuSoundFX + scale - 1 + ((_vm->_config._soundFl) ? 0 : 2)]); _saveButton->setGfx(_arrayBmp[4 * kMenuSave + scale - 1]); _loadButton->setGfx(_arrayBmp[4 * kMenuLoad + scale - 1]); _recallButton->setGfx(_arrayBmp[4 * kMenuRecall + scale - 1]); - _turboButton->setGfx(_arrayBmp[4 * kMenuTurbo + scale - 1 + ((_vm->_config.turboFl) ? 0 : 2)]); + _turboButton->setGfx(_arrayBmp[4 * kMenuTurbo + scale - 1 + ((_vm->_config._turboFl) ? 0 : 2)]); _lookButton->setGfx(_arrayBmp[4 * kMenuLook + scale - 1]); _inventButton->setGfx(_arrayBmp[4 * kMenuInventory + scale - 1]); } @@ -176,7 +176,7 @@ void TopMenu::handleCommand(GUI::CommandSender *sender, uint32 command, uint32 d break; case kCmdMusic: _vm->_sound->toggleMusic(); - _musicButton->setGfx(_arrayBmp[4 * kMenuMusic + (g_system->getOverlayWidth() > 320 ? 2 : 1) - 1 + ((_vm->_config.musicFl) ? 0 : 2)]); + _musicButton->setGfx(_arrayBmp[4 * kMenuMusic + (g_system->getOverlayWidth() > 320 ? 2 : 1) - 1 + ((_vm->_config._musicFl) ? 0 : 2)]); _musicButton->draw(); g_gui.theme()->updateScreen(); g_system->updateScreen(); diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp index a3fc5dfe49..219e29a25a 100644 --- a/engines/hugo/file.cpp +++ b/engines/hugo/file.cpp @@ -54,7 +54,7 @@ static const int s_bootCypherLen = sizeof(s_bootCypher) - 1; FileManager::FileManager(HugoEngine *vm) : _vm(vm) { _hasReadHeader = false; - firstUIFFl = true; + _firstUIFFl = true; } FileManager::~FileManager() { @@ -624,28 +624,28 @@ 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(const uif_t id) { - debugC(1, kDebugFile, "getUIFHeader(%d)", id); +uif_hdr_t *FileManager::get_UIFHeader(const uif_t id) { + debugC(1, kDebugFile, "get_UIFHeader(%d)", id); // Initialize offset lookup if not read yet - if (firstUIFFl) { - firstUIFFl = false; + if (_firstUIFFl) { + _firstUIFFl = false; // Open unbuffered to do far read Common::File ip; // Image data file if (!ip.open(getUifFilename())) error("File not found: %s", getUifFilename()); - if (ip.size() < (int32)sizeof(UIFHeader)) + if (ip.size() < (int32)sizeof(_UIFHeader)) error("Wrong UIF file format"); for (int i = 0; i < kMaxUifs; ++i) { - UIFHeader[i]._size = ip.readUint16LE(); - UIFHeader[i]._offset = ip.readUint32LE(); + _UIFHeader[i]._size = ip.readUint16LE(); + _UIFHeader[i]._offset = ip.readUint32LE(); } ip.close(); } - return &UIFHeader[id]; + return &_UIFHeader[id]; } /** @@ -660,8 +660,8 @@ void FileManager::readUIFItem(const int16 id, byte *buf) { error("File not found: %s", getUifFilename()); // Seek to data - uif_hdr_t *UIFHeaderPtr = getUIFHeader((uif_t)id); - ip.seek(UIFHeaderPtr->_offset, SEEK_SET); + uif_hdr_t *_UIFHeaderPtr = get_UIFHeader((uif_t)id); + ip.seek(_UIFHeaderPtr->_offset, SEEK_SET); // We support pcx images and straight data seq_t *dummySeq; // Dummy seq_t for image data @@ -671,7 +671,7 @@ void FileManager::readUIFItem(const int16 id, byte *buf) { free(dummySeq); break; default: // Read file data into supplied array - if (ip.read(buf, UIFHeaderPtr->_size) != UIFHeaderPtr->_size) + if (ip.read(buf, _UIFHeaderPtr->_size) != _UIFHeaderPtr->_size) error("Wrong UIF file format"); break; } diff --git a/engines/hugo/file.h b/engines/hugo/file.h index 817bf49daf..e7c467a315 100644 --- a/engines/hugo/file.h +++ b/engines/hugo/file.h @@ -105,8 +105,8 @@ protected: byte _fill2[60]; }; // Header of a PCC file - bool firstUIFFl; - uif_hdr_t UIFHeader[kMaxUifs]; // Lookup for uif fonts/images + bool _firstUIFFl; + uif_hdr_t _UIFHeader[kMaxUifs]; // Lookup for uif fonts/images Common::File _stringArchive; // Handle for string file Common::File _sceneryArchive1; // Handle for scenery file @@ -122,7 +122,7 @@ protected: private: byte *convertPCC(byte *p, const uint16 y, const uint16 bpl, image_pt dataPtr) const; - uif_hdr_t *getUIFHeader(const uif_t id); + uif_hdr_t *get_UIFHeader(const uif_t id); //Strangerke : Not used? void printBootText(); diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp index 450f4ff837..7462da0df8 100644 --- a/engines/hugo/hugo.cpp +++ b/engines/hugo/hugo.cpp @@ -562,10 +562,10 @@ void HugoEngine::initStatus() { void HugoEngine::initConfig() { debugC(1, kDebugEngine, "initConfig()"); - _config.musicFl = true; // Music state initially on - _config.soundFl = true; // Sound state initially on - _config.turboFl = false; // Turbo state initially off - initPlaylist(_config.playlist); // Initialize default tune playlist + _config._musicFl = true; // Music state initially on + _config._soundFl = true; // Sound state initially on + _config._turboFl = false; // Turbo state initially off + initPlaylist(_config._playlist); // Initialize default tune playlist _file->readBootFile(); // Read startup structure } @@ -577,7 +577,7 @@ void HugoEngine::resetConfig() { // Find first tune and play it for (int16 i = 0; i < kMaxTunes; i++) { - if (_config.playlist[i]) { + if (_config._playlist[i]) { _sound->playMusic(i); break; } @@ -694,7 +694,7 @@ bool HugoEngine::canSaveGameStateCurrently() { } int8 HugoEngine::getTPS() const { - return ((_config.turboFl) ? kTurboTps : _normalTPS); + return ((_config._turboFl) ? kTurboTps : _normalTPS); } void HugoEngine::syncSoundSettings() { diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h index 3ad6fced24..68b771faa4 100644 --- a/engines/hugo/hugo.h +++ b/engines/hugo/hugo.h @@ -83,10 +83,10 @@ static const int kHeroMinWidth = 16; // Minimum width of hero typedef char command_t[kMaxLineSize + 8]; // Command line (+spare for prompt,cursor) struct config_t { // User's config (saved) - bool musicFl; // State of Music button/menu item - bool soundFl; // State of Sound button/menu item - bool turboFl; // State of Turbo button/menu item - bool playlist[kMaxTunes]; // Tune playlist + bool _musicFl; // State of Music button/menu item + bool _soundFl; // State of Sound button/menu item + bool _turboFl; // State of Turbo button/menu item + bool _playlist[kMaxTunes]; // Tune playlist }; typedef byte icondib_t[kXPix * kInvDy]; // Icon bar dib @@ -185,32 +185,16 @@ struct status_t { // Game status (not saved) uint32 _tick; // Current time in ticks vstate_t _viewState; // View state machine int16 _song; // Current song - -// Strangerke - Suppress as related to playback -// bool playbackFl; // Game is in playback mode -// bool recordFl; // Game is in record mode -// Strangerke - Not used ? -// bool helpFl; // Calling WinHelp (don't disable music) -// bool mmtimeFl; // Multimedia timer supported -// bool demoFl; // Game is in demo mode -// bool textBoxFl; // Game is (halted) in text box -// int16 screenWidth; // Desktop screen width -// int16 saveSlot; // Current slot to save/restore game -// int16 cx, cy; // Cursor position (dib coords) -// uint32 saveTick; // Time of last save in ticks -// -// typedef char fpath_t[kMaxPath]; // File path -// fpath_t path; // Alternate path for saved files }; /** * Structure to define an EXIT or other collision-activated hotspot */ struct hotspot_t { - int screenIndex; // Screen in which hotspot appears - int x1, y1, x2, y2; // Bounding box of hotspot - uint16 actIndex; // Actions to carry out if a 'hit' - int16 viewx, viewy, direction; // Used in auto-route mode + int _screenIndex; // Screen in which hotspot appears + int _x1, _y1, _x2, _y2; // Bounding box of hotspot + uint16 _actIndex; // Actions to carry out if a 'hit' + int16 _viewx, _viewy, _direction; // Used in auto-route mode }; class FileManager; diff --git a/engines/hugo/mouse.cpp b/engines/hugo/mouse.cpp index 323f362b10..864934a0d3 100644 --- a/engines/hugo/mouse.cpp +++ b/engines/hugo/mouse.cpp @@ -98,11 +98,11 @@ int MouseHandler::getMouseY() const { } int16 MouseHandler::getDirection(const int16 hotspotId) const { - return _hotspots[hotspotId].direction; + return _hotspots[hotspotId]._direction; } int16 MouseHandler::getHotspotActIndex(const int16 hotspotId) const { - return _hotspots[hotspotId].actIndex; + return _hotspots[hotspotId]._actIndex; } /** @@ -137,9 +137,9 @@ void MouseHandler::cursorText(const char *buffer, const int16 cx, const int16 cy int16 MouseHandler::findExit(const int16 cx, const int16 cy, byte screenId) { debugC(2, kDebugMouse, "findExit(%d, %d, %d)", cx, cy, screenId); - for (int i = 0; _hotspots[i].screenIndex >= 0; i++) { - if (_hotspots[i].screenIndex == screenId) { - if (cx >= _hotspots[i].x1 && cx <= _hotspots[i].x2 && cy >= _hotspots[i].y1 && cy <= _hotspots[i].y2) + for (int i = 0; _hotspots[i]._screenIndex >= 0; i++) { + if (_hotspots[i]._screenIndex == screenId) { + if (cx >= _hotspots[i]._x1 && cx <= _hotspots[i]._x2 && cy >= _hotspots[i]._y1 && cy <= _hotspots[i]._y2) return i; } } @@ -224,19 +224,19 @@ void MouseHandler::processLeftClick(const int16 objId, const int16 cx, const int break; case kExitHotspot: // Walk to exit hotspot i = findExit(cx, cy, *_vm->_screen_p); - x = _hotspots[i].viewx; - y = _hotspots[i].viewy; + x = _hotspots[i]._viewx; + y = _hotspots[i]._viewy; if (x >= 0) { // Hotspot refers to an exit // Special case of immediate exit if (_jumpExitFl) { // Get rid of iconbar if necessary if (_vm->_inventory->getInventoryState() != kInventoryOff) _vm->_inventory->setInventoryState(kInventoryUp); - _vm->_scheduler->insertActionList(_hotspots[i].actIndex); + _vm->_scheduler->insertActionList(_hotspots[i]._actIndex); } else { // Set up route to exit spot - if (_hotspots[i].direction == Common::KEYCODE_RIGHT) + if (_hotspots[i]._direction == Common::KEYCODE_RIGHT) x -= kHeroMaxWidth; - else if (_hotspots[i].direction == Common::KEYCODE_LEFT) + else if (_hotspots[i]._direction == Common::KEYCODE_LEFT) x += kHeroMaxWidth; if (!_vm->_route->startRoute(kRouteExit, i, x, y)) Utils::notifyBox(_vm->_text->getTextMouse(kMsNoWayText)); // Can't get there @@ -328,7 +328,7 @@ void MouseHandler::mouseHandler() { // Process cursor over an exit hotspot if (objId == -1) { int i = findExit(cx, cy, *_vm->_screen_p); - if (i != -1 && _hotspots[i].viewx >= 0) { + if (i != -1 && _hotspots[i]._viewx >= 0) { objId = kExitHotspot; cursorText(_vm->_text->getTextMouse(kMsExit), cx, cy, U_FONT8, _TBRIGHTWHITE); } @@ -344,15 +344,15 @@ void MouseHandler::mouseHandler() { } void MouseHandler::readHotspot(Common::ReadStream &in, hotspot_t &hotspot) { - hotspot.screenIndex = in.readSint16BE(); - hotspot.x1 = in.readSint16BE(); - hotspot.y1 = in.readSint16BE(); - hotspot.x2 = in.readSint16BE(); - hotspot.y2 = in.readSint16BE(); - hotspot.actIndex = in.readUint16BE(); - hotspot.viewx = in.readSint16BE(); - hotspot.viewy = in.readSint16BE(); - hotspot.direction = in.readSint16BE(); + hotspot._screenIndex = in.readSint16BE(); + hotspot._x1 = in.readSint16BE(); + hotspot._y1 = in.readSint16BE(); + hotspot._x2 = in.readSint16BE(); + hotspot._y2 = in.readSint16BE(); + hotspot._actIndex = in.readUint16BE(); + hotspot._viewx = in.readSint16BE(); + hotspot._viewy = in.readSint16BE(); + hotspot._direction = in.readSint16BE(); } /** @@ -376,10 +376,10 @@ void MouseHandler::loadHotspots(Common::ReadStream &in) { * Display hotspot boundaries for the current screen */ void MouseHandler::drawHotspots() const { - for (int i = 0; _hotspots[i].screenIndex >= 0; i++) { + for (int i = 0; _hotspots[i]._screenIndex >= 0; i++) { hotspot_t *hotspot = &_hotspots[i]; - if (hotspot->screenIndex == _vm->_hero->_screenIndex) - _vm->_screen->drawRectangle(false, hotspot->x1, hotspot->y1, hotspot->x2, hotspot->y2, _TLIGHTRED); + if (hotspot->_screenIndex == _vm->_hero->_screenIndex) + _vm->_screen->drawRectangle(false, hotspot->_x1, hotspot->_y1, hotspot->_x2, hotspot->_y2, _TLIGHTRED); } } } // End of namespace Hugo diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp index b4255e607b..3b0eb1d979 100644 --- a/engines/hugo/parser.cpp +++ b/engines/hugo/parser.cpp @@ -198,7 +198,7 @@ void Parser::freeParser() { } void Parser::switchTurbo() { - _vm->_config.turboFl = !_vm->_config.turboFl; + _vm->_config._turboFl = !_vm->_config._turboFl; } /** @@ -256,7 +256,7 @@ void Parser::charHandler() { } sprintf(_vm->_statusLine, ">%s%c", _cmdLine, _cmdLineCursor); - sprintf(_vm->_scoreLine, "F1-Help %s Score: %d of %d Sound %s", (_vm->_config.turboFl) ? "T" : " ", _vm->getScore(), _vm->getMaxScore(), (_vm->_config.soundFl) ? "On" : "Off"); + sprintf(_vm->_scoreLine, "F1-Help %s Score: %d of %d Sound %s", (_vm->_config._turboFl) ? "T" : " ", _vm->getScore(), _vm->getMaxScore(), (_vm->_config._soundFl) ? "On" : "Off"); // See if "look" button pressed if (gameStatus._lookFl) { diff --git a/engines/hugo/schedule.cpp b/engines/hugo/schedule.cpp index 18e414420a..0e57b08f19 100644 --- a/engines/hugo/schedule.cpp +++ b/engines/hugo/schedule.cpp @@ -68,13 +68,13 @@ void Scheduler::initEventQueue() { // Chain next_p from first to last for (int i = kMaxEvents; --i;) - _events[i - 1].nextEvent = &_events[i]; - _events[kMaxEvents - 1].nextEvent = 0; + _events[i - 1]._nextEvent = &_events[i]; + _events[kMaxEvents - 1]._nextEvent = 0; // Chain prev_p from last to first for (int i = 1; i < kMaxEvents; i++) - _events[i].prevEvent = &_events[i - 1]; - _events[0].prevEvent = 0; + _events[i]._prevEvent = &_events[i - 1]; + _events[0]._prevEvent = 0; _headEvent = _tailEvent = 0; // Event list is empty _freeEvent = _events; // Free list is full @@ -89,8 +89,8 @@ event_t *Scheduler::getQueue() { if (!_freeEvent) // Error: no more events available error("An error has occurred: %s", "getQueue"); event_t *resEvent = _freeEvent; - _freeEvent = _freeEvent->nextEvent; - resEvent->nextEvent = 0; + _freeEvent = _freeEvent->_nextEvent; + resEvent->_nextEvent = 0; return resEvent; } @@ -101,7 +101,7 @@ void Scheduler::insertActionList(const uint16 actIndex) { debugC(1, kDebugSchedule, "insertActionList(%d)", actIndex); if (_actListArr[actIndex]) { - for (int i = 0; _actListArr[actIndex][i].a0.actType != ANULL; i++) + for (int i = 0; _actListArr[actIndex][i]._a0._actType != ANULL; i++) insertAction(&_actListArr[actIndex][i]); } } @@ -147,9 +147,9 @@ uint32 Scheduler::getDosTicks(const bool updateFl) { void Scheduler::processBonus(const int bonusIndex) { debugC(1, kDebugSchedule, "processBonus(%d)", bonusIndex); - if (!_points[bonusIndex].scoredFl) { - _vm->adjustScore(_points[bonusIndex].score); - _points[bonusIndex].scoredFl = true; + if (!_points[bonusIndex]._scoredFl) { + _vm->adjustScore(_points[bonusIndex]._score); + _points[bonusIndex]._scoredFl = true; } } @@ -178,8 +178,8 @@ void Scheduler::newScreen(const int screenIndex) { event_t *curEvent = _headEvent; // The earliest event event_t *wrkEvent; // Event ptr while (curEvent) { // While mature events found - wrkEvent = curEvent->nextEvent; // Save p (becomes undefined after Del) - if (curEvent->localActionFl) + wrkEvent = curEvent->_nextEvent; // Save p (becomes undefined after Del) + if (curEvent->_localActionFl) delQueue(curEvent); // Return event to free list curEvent = wrkEvent; } @@ -261,8 +261,8 @@ void Scheduler::loadPoints(Common::SeekableReadStream &in) { _numBonuses = numElem; _points = (point_t *)malloc(sizeof(point_t) * _numBonuses); for (int i = 0; i < _numBonuses; i++) { - _points[i].score = in.readByte(); - _points[i].scoredFl = false; + _points[i]._score = in.readByte(); + _points[i]._scoredFl = false; } } else { in.skip(numElem); @@ -273,277 +273,277 @@ void Scheduler::loadPoints(Common::SeekableReadStream &in) { void Scheduler::readAct(Common::ReadStream &in, act &curAct) { uint16 numSubAct; - curAct.a0.actType = (action_t) in.readByte(); - switch (curAct.a0.actType) { + curAct._a0._actType = (action_t) in.readByte(); + switch (curAct._a0._actType) { case ANULL: // -1 break; case ASCHEDULE: // 0 - curAct.a0.timer = in.readSint16BE(); - curAct.a0.actIndex = in.readUint16BE(); + curAct._a0._timer = in.readSint16BE(); + curAct._a0._actIndex = in.readUint16BE(); break; case START_OBJ: // 1 - curAct.a1.timer = in.readSint16BE(); - curAct.a1.objIndex = in.readSint16BE(); - curAct.a1.cycleNumb = in.readSint16BE(); - curAct.a1.cycle = (cycle_t) in.readByte(); + curAct._a1._timer = in.readSint16BE(); + curAct._a1._objIndex = in.readSint16BE(); + curAct._a1._cycleNumb = in.readSint16BE(); + curAct._a1._cycle = (cycle_t) in.readByte(); break; case INIT_OBJXY: // 2 - curAct.a2.timer = in.readSint16BE(); - curAct.a2.objIndex = in.readSint16BE(); - curAct.a2.x = in.readSint16BE(); - curAct.a2.y = in.readSint16BE(); + curAct._a2._timer = in.readSint16BE(); + curAct._a2._objIndex = in.readSint16BE(); + curAct._a2._x = in.readSint16BE(); + curAct._a2._y = in.readSint16BE(); break; case PROMPT: // 3 - curAct.a3.timer = in.readSint16BE(); - curAct.a3.promptIndex = in.readSint16BE(); + curAct._a3._timer = in.readSint16BE(); + curAct._a3._promptIndex = in.readSint16BE(); numSubAct = in.readUint16BE(); - curAct.a3.responsePtr = (int *)malloc(sizeof(int) * numSubAct); + curAct._a3._responsePtr = (int *)malloc(sizeof(int) * numSubAct); for (int k = 0; k < numSubAct; k++) - curAct.a3.responsePtr[k] = in.readSint16BE(); - curAct.a3.actPassIndex = in.readUint16BE(); - curAct.a3.actFailIndex = in.readUint16BE(); - curAct.a3.encodedFl = (in.readByte() == 1) ? true : false; + curAct._a3._responsePtr[k] = in.readSint16BE(); + curAct._a3._actPassIndex = in.readUint16BE(); + curAct._a3._actFailIndex = in.readUint16BE(); + curAct._a3._encodedFl = (in.readByte() == 1) ? true : false; break; case BKGD_COLOR: // 4 - curAct.a4.timer = in.readSint16BE(); - curAct.a4.newBackgroundColor = in.readUint32BE(); + curAct._a4._timer = in.readSint16BE(); + curAct._a4._newBackgroundColor = in.readUint32BE(); break; case INIT_OBJVXY: // 5 - curAct.a5.timer = in.readSint16BE(); - curAct.a5.objIndex = in.readSint16BE(); - curAct.a5.vx = in.readSint16BE(); - curAct.a5.vy = in.readSint16BE(); + curAct._a5._timer = in.readSint16BE(); + curAct._a5._objIndex = in.readSint16BE(); + curAct._a5._vx = in.readSint16BE(); + curAct._a5._vy = in.readSint16BE(); break; case INIT_CARRY: // 6 - curAct.a6.timer = in.readSint16BE(); - curAct.a6.objIndex = in.readSint16BE(); - curAct.a6.carriedFl = (in.readByte() == 1) ? true : false; + curAct._a6._timer = in.readSint16BE(); + curAct._a6._objIndex = in.readSint16BE(); + curAct._a6._carriedFl = (in.readByte() == 1) ? true : false; break; case INIT_HF_COORD: // 7 - curAct.a7.timer = in.readSint16BE(); - curAct.a7.objIndex = in.readSint16BE(); + curAct._a7._timer = in.readSint16BE(); + curAct._a7._objIndex = in.readSint16BE(); break; case NEW_SCREEN: // 8 - curAct.a8.timer = in.readSint16BE(); - curAct.a8.screenIndex = in.readSint16BE(); + curAct._a8._timer = in.readSint16BE(); + curAct._a8._screenIndex = in.readSint16BE(); break; case INIT_OBJSTATE: // 9 - curAct.a9.timer = in.readSint16BE(); - curAct.a9.objIndex = in.readSint16BE(); - curAct.a9.newState = in.readByte(); + curAct._a9._timer = in.readSint16BE(); + curAct._a9._objIndex = in.readSint16BE(); + curAct._a9._newState = in.readByte(); break; case INIT_PATH: // 10 - curAct.a10.timer = in.readSint16BE(); - curAct.a10.objIndex = in.readSint16BE(); - curAct.a10.newPathType = in.readSint16BE(); - curAct.a10.vxPath = in.readByte(); - curAct.a10.vyPath = in.readByte(); + curAct._a10._timer = in.readSint16BE(); + curAct._a10._objIndex = in.readSint16BE(); + curAct._a10._newPathType = in.readSint16BE(); + curAct._a10._vxPath = in.readByte(); + curAct._a10._vyPath = in.readByte(); break; case COND_R: // 11 - curAct.a11.timer = in.readSint16BE(); - curAct.a11.objIndex = in.readSint16BE(); - curAct.a11.stateReq = in.readByte(); - curAct.a11.actPassIndex = in.readUint16BE(); - curAct.a11.actFailIndex = in.readUint16BE(); + curAct._a11._timer = in.readSint16BE(); + curAct._a11._objIndex = in.readSint16BE(); + curAct._a11._stateReq = in.readByte(); + curAct._a11._actPassIndex = in.readUint16BE(); + curAct._a11._actFailIndex = in.readUint16BE(); break; case TEXT: // 12 - curAct.a12.timer = in.readSint16BE(); - curAct.a12.stringIndex = in.readSint16BE(); + curAct._a12._timer = in.readSint16BE(); + curAct._a12._stringIndex = in.readSint16BE(); break; case SWAP_IMAGES: // 13 - curAct.a13.timer = in.readSint16BE(); - curAct.a13.objIndex1 = in.readSint16BE(); - curAct.a13.objIndex2 = in.readSint16BE(); + curAct._a13._timer = in.readSint16BE(); + curAct._a13._objIndex1 = in.readSint16BE(); + curAct._a13._objIndex2 = in.readSint16BE(); break; case COND_SCR: // 14 - curAct.a14.timer = in.readSint16BE(); - curAct.a14.objIndex = in.readSint16BE(); - curAct.a14.screenReq = in.readSint16BE(); - curAct.a14.actPassIndex = in.readUint16BE(); - curAct.a14.actFailIndex = in.readUint16BE(); + curAct._a14._timer = in.readSint16BE(); + curAct._a14._objIndex = in.readSint16BE(); + curAct._a14._screenReq = in.readSint16BE(); + curAct._a14._actPassIndex = in.readUint16BE(); + curAct._a14._actFailIndex = in.readUint16BE(); break; case AUTOPILOT: // 15 - curAct.a15.timer = in.readSint16BE(); - curAct.a15.objIndex1 = in.readSint16BE(); - curAct.a15.objIndex2 = in.readSint16BE(); - curAct.a15.dx = in.readByte(); - curAct.a15.dy = in.readByte(); + curAct._a15._timer = in.readSint16BE(); + curAct._a15._objIndex1 = in.readSint16BE(); + curAct._a15._objIndex2 = in.readSint16BE(); + curAct._a15._dx = in.readByte(); + curAct._a15._dy = in.readByte(); break; case INIT_OBJ_SEQ: // 16 - curAct.a16.timer = in.readSint16BE(); - curAct.a16.objIndex = in.readSint16BE(); - curAct.a16.seqIndex = in.readSint16BE(); + curAct._a16._timer = in.readSint16BE(); + curAct._a16._objIndex = in.readSint16BE(); + curAct._a16._seqIndex = in.readSint16BE(); break; case SET_STATE_BITS: // 17 - curAct.a17.timer = in.readSint16BE(); - curAct.a17.objIndex = in.readSint16BE(); - curAct.a17.stateMask = in.readSint16BE(); + curAct._a17._timer = in.readSint16BE(); + curAct._a17._objIndex = in.readSint16BE(); + curAct._a17._stateMask = in.readSint16BE(); break; case CLEAR_STATE_BITS: // 18 - curAct.a18.timer = in.readSint16BE(); - curAct.a18.objIndex = in.readSint16BE(); - curAct.a18.stateMask = in.readSint16BE(); + curAct._a18._timer = in.readSint16BE(); + curAct._a18._objIndex = in.readSint16BE(); + curAct._a18._stateMask = in.readSint16BE(); break; case TEST_STATE_BITS: // 19 - curAct.a19.timer = in.readSint16BE(); - curAct.a19.objIndex = in.readSint16BE(); - curAct.a19.stateMask = in.readSint16BE(); - curAct.a19.actPassIndex = in.readUint16BE(); - curAct.a19.actFailIndex = in.readUint16BE(); + curAct._a19._timer = in.readSint16BE(); + curAct._a19._objIndex = in.readSint16BE(); + curAct._a19._stateMask = in.readSint16BE(); + curAct._a19._actPassIndex = in.readUint16BE(); + curAct._a19._actFailIndex = in.readUint16BE(); break; case DEL_EVENTS: // 20 - curAct.a20.timer = in.readSint16BE(); - curAct.a20.actTypeDel = (action_t) in.readByte(); + curAct._a20._timer = in.readSint16BE(); + curAct._a20._actTypeDel = (action_t) in.readByte(); break; case GAMEOVER: // 21 - curAct.a21.timer = in.readSint16BE(); + curAct._a21._timer = in.readSint16BE(); break; case INIT_HH_COORD: // 22 - curAct.a22.timer = in.readSint16BE(); - curAct.a22.objIndex = in.readSint16BE(); + curAct._a22._timer = in.readSint16BE(); + curAct._a22._objIndex = in.readSint16BE(); break; case EXIT: // 23 - curAct.a23.timer = in.readSint16BE(); + curAct._a23._timer = in.readSint16BE(); break; case BONUS: // 24 - curAct.a24.timer = in.readSint16BE(); - curAct.a24.pointIndex = in.readSint16BE(); + curAct._a24._timer = in.readSint16BE(); + curAct._a24._pointIndex = in.readSint16BE(); break; case COND_BOX: // 25 - curAct.a25.timer = in.readSint16BE(); - curAct.a25.objIndex = in.readSint16BE(); - curAct.a25.x1 = in.readSint16BE(); - curAct.a25.y1 = in.readSint16BE(); - curAct.a25.x2 = in.readSint16BE(); - curAct.a25.y2 = in.readSint16BE(); - curAct.a25.actPassIndex = in.readUint16BE(); - curAct.a25.actFailIndex = in.readUint16BE(); + curAct._a25._timer = in.readSint16BE(); + curAct._a25._objIndex = in.readSint16BE(); + curAct._a25._x1 = in.readSint16BE(); + curAct._a25._y1 = in.readSint16BE(); + curAct._a25._x2 = in.readSint16BE(); + curAct._a25._y2 = in.readSint16BE(); + curAct._a25._actPassIndex = in.readUint16BE(); + curAct._a25._actFailIndex = in.readUint16BE(); break; case SOUND: // 26 - curAct.a26.timer = in.readSint16BE(); - curAct.a26.soundIndex = in.readSint16BE(); + curAct._a26._timer = in.readSint16BE(); + curAct._a26._soundIndex = in.readSint16BE(); break; case ADD_SCORE: // 27 - curAct.a27.timer = in.readSint16BE(); - curAct.a27.objIndex = in.readSint16BE(); + curAct._a27._timer = in.readSint16BE(); + curAct._a27._objIndex = in.readSint16BE(); break; case SUB_SCORE: // 28 - curAct.a28.timer = in.readSint16BE(); - curAct.a28.objIndex = in.readSint16BE(); + curAct._a28._timer = in.readSint16BE(); + curAct._a28._objIndex = in.readSint16BE(); break; case COND_CARRY: // 29 - curAct.a29.timer = in.readSint16BE(); - curAct.a29.objIndex = in.readSint16BE(); - curAct.a29.actPassIndex = in.readUint16BE(); - curAct.a29.actFailIndex = in.readUint16BE(); + curAct._a29._timer = in.readSint16BE(); + curAct._a29._objIndex = in.readSint16BE(); + curAct._a29._actPassIndex = in.readUint16BE(); + curAct._a29._actFailIndex = in.readUint16BE(); break; case INIT_MAZE: // 30 - curAct.a30.timer = in.readSint16BE(); - curAct.a30.mazeSize = in.readByte(); - curAct.a30.x1 = in.readSint16BE(); - curAct.a30.y1 = in.readSint16BE(); - curAct.a30.x2 = in.readSint16BE(); - curAct.a30.y2 = in.readSint16BE(); - curAct.a30.x3 = in.readSint16BE(); - curAct.a30.x4 = in.readSint16BE(); - curAct.a30.firstScreenIndex = in.readByte(); + curAct._a30._timer = in.readSint16BE(); + curAct._a30._mazeSize = in.readByte(); + curAct._a30._x1 = in.readSint16BE(); + curAct._a30._y1 = in.readSint16BE(); + curAct._a30._x2 = in.readSint16BE(); + curAct._a30._y2 = in.readSint16BE(); + curAct._a30._x3 = in.readSint16BE(); + curAct._a30._x4 = in.readSint16BE(); + curAct._a30._firstScreenIndex = in.readByte(); break; case EXIT_MAZE: // 31 - curAct.a31.timer = in.readSint16BE(); + curAct._a31._timer = in.readSint16BE(); break; case INIT_PRIORITY: // 32 - curAct.a32.timer = in.readSint16BE(); - curAct.a32.objIndex = in.readSint16BE(); - curAct.a32.priority = in.readByte(); + curAct._a32._timer = in.readSint16BE(); + curAct._a32._objIndex = in.readSint16BE(); + curAct._a32._priority = in.readByte(); break; case INIT_SCREEN: // 33 - curAct.a33.timer = in.readSint16BE(); - curAct.a33.objIndex = in.readSint16BE(); - curAct.a33.screenIndex = in.readSint16BE(); + curAct._a33._timer = in.readSint16BE(); + curAct._a33._objIndex = in.readSint16BE(); + curAct._a33._screenIndex = in.readSint16BE(); break; case AGSCHEDULE: // 34 - curAct.a34.timer = in.readSint16BE(); - curAct.a34.actIndex = in.readUint16BE(); + curAct._a34._timer = in.readSint16BE(); + curAct._a34._actIndex = in.readUint16BE(); break; case REMAPPAL: // 35 - curAct.a35.timer = in.readSint16BE(); - curAct.a35.oldColorIndex = in.readSint16BE(); - curAct.a35.newColorIndex = in.readSint16BE(); + curAct._a35._timer = in.readSint16BE(); + curAct._a35._oldColorIndex = in.readSint16BE(); + curAct._a35._newColorIndex = in.readSint16BE(); break; case COND_NOUN: // 36 - curAct.a36.timer = in.readSint16BE(); - curAct.a36.nounIndex = in.readUint16BE(); - curAct.a36.actPassIndex = in.readUint16BE(); - curAct.a36.actFailIndex = in.readUint16BE(); + curAct._a36._timer = in.readSint16BE(); + curAct._a36._nounIndex = in.readUint16BE(); + curAct._a36._actPassIndex = in.readUint16BE(); + curAct._a36._actFailIndex = in.readUint16BE(); break; case SCREEN_STATE: // 37 - curAct.a37.timer = in.readSint16BE(); - curAct.a37.screenIndex = in.readSint16BE(); - curAct.a37.newState = in.readByte(); + curAct._a37._timer = in.readSint16BE(); + curAct._a37._screenIndex = in.readSint16BE(); + curAct._a37._newState = in.readByte(); break; case INIT_LIPS: // 38 - curAct.a38.timer = in.readSint16BE(); - curAct.a38.lipsObjIndex = in.readSint16BE(); - curAct.a38.objIndex = in.readSint16BE(); - curAct.a38.dxLips = in.readByte(); - curAct.a38.dyLips = in.readByte(); + curAct._a38._timer = in.readSint16BE(); + curAct._a38._lipsObjIndex = in.readSint16BE(); + curAct._a38._objIndex = in.readSint16BE(); + curAct._a38._dxLips = in.readByte(); + curAct._a38._dyLips = in.readByte(); break; case INIT_STORY_MODE: // 39 - curAct.a39.timer = in.readSint16BE(); - curAct.a39.storyModeFl = (in.readByte() == 1); + curAct._a39._timer = in.readSint16BE(); + curAct._a39._storyModeFl = (in.readByte() == 1); break; case WARN: // 40 - curAct.a40.timer = in.readSint16BE(); - curAct.a40.stringIndex = in.readSint16BE(); + curAct._a40._timer = in.readSint16BE(); + curAct._a40._stringIndex = in.readSint16BE(); break; case COND_BONUS: // 41 - curAct.a41.timer = in.readSint16BE(); - curAct.a41.BonusIndex = in.readSint16BE(); - curAct.a41.actPassIndex = in.readUint16BE(); - curAct.a41.actFailIndex = in.readUint16BE(); + curAct._a41._timer = in.readSint16BE(); + curAct._a41._bonusIndex = in.readSint16BE(); + curAct._a41._actPassIndex = in.readUint16BE(); + curAct._a41._actFailIndex = in.readUint16BE(); break; case TEXT_TAKE: // 42 - curAct.a42.timer = in.readSint16BE(); - curAct.a42.objIndex = in.readSint16BE(); + curAct._a42._timer = in.readSint16BE(); + curAct._a42._objIndex = in.readSint16BE(); break; case YESNO: // 43 - curAct.a43.timer = in.readSint16BE(); - curAct.a43.promptIndex = in.readSint16BE(); - curAct.a43.actYesIndex = in.readUint16BE(); - curAct.a43.actNoIndex = in.readUint16BE(); + curAct._a43._timer = in.readSint16BE(); + curAct._a43._promptIndex = in.readSint16BE(); + curAct._a43._actYesIndex = in.readUint16BE(); + curAct._a43._actNoIndex = in.readUint16BE(); break; case STOP_ROUTE: // 44 - curAct.a44.timer = in.readSint16BE(); + curAct._a44._timer = in.readSint16BE(); break; case COND_ROUTE: // 45 - curAct.a45.timer = in.readSint16BE(); - curAct.a45.routeIndex = in.readSint16BE(); - curAct.a45.actPassIndex = in.readUint16BE(); - curAct.a45.actFailIndex = in.readUint16BE(); + curAct._a45._timer = in.readSint16BE(); + curAct._a45._routeIndex = in.readSint16BE(); + curAct._a45._actPassIndex = in.readUint16BE(); + curAct._a45._actFailIndex = in.readUint16BE(); break; case INIT_JUMPEXIT: // 46 - curAct.a46.timer = in.readSint16BE(); - curAct.a46.jumpExitFl = (in.readByte() == 1); + curAct._a46._timer = in.readSint16BE(); + curAct._a46._jumpExitFl = (in.readByte() == 1); break; case INIT_VIEW: // 47 - curAct.a47.timer = in.readSint16BE(); - curAct.a47.objIndex = in.readSint16BE(); - curAct.a47.viewx = in.readSint16BE(); - curAct.a47.viewy = in.readSint16BE(); - curAct.a47.direction = in.readSint16BE(); + curAct._a47._timer = in.readSint16BE(); + curAct._a47._objIndex = in.readSint16BE(); + curAct._a47._viewx = in.readSint16BE(); + curAct._a47._viewy = in.readSint16BE(); + curAct._a47._direction = in.readSint16BE(); break; case INIT_OBJ_FRAME: // 48 - curAct.a48.timer = in.readSint16BE(); - curAct.a48.objIndex = in.readSint16BE(); - curAct.a48.seqIndex = in.readSint16BE(); - curAct.a48.frameIndex = in.readSint16BE(); + curAct._a48._timer = in.readSint16BE(); + curAct._a48._objIndex = in.readSint16BE(); + curAct._a48._seqIndex = in.readSint16BE(); + curAct._a48._frameIndex = in.readSint16BE(); break; case OLD_SONG: //49 - curAct.a49.timer = in.readSint16BE(); - curAct.a49.songIndex = in.readUint16BE(); + curAct._a49._timer = in.readSint16BE(); + curAct._a49._songIndex = in.readUint16BE(); break; default: - error("Engine - Unknown action type encountered: %d", curAct.a0.actType); + error("Engine - Unknown action type encountered: %d", curAct._a0._actType); } } @@ -572,13 +572,13 @@ void Scheduler::loadActListArr(Common::ReadStream &in) { readAct(in, _actListArr[i][j]); } else { readAct(in, tmpAct); - if (tmpAct.a0.actType == PROMPT) - free(tmpAct.a3.responsePtr); + if (tmpAct._a0._actType == PROMPT) + free(tmpAct._a3._responsePtr); } } if (varnt == _vm->_gameVariant) - _actListArr[i][numSubElem].a0.actType = ANULL; + _actListArr[i][numSubElem]._a0._actType = ANULL; } } } @@ -626,9 +626,9 @@ void Scheduler::freeScheduler() { if (_actListArr) { for (int i = 0; i < _actListArrSize; i++) { - for (int j = 0; _actListArr[i][j].a0.actType != ANULL; j++) { - if (_actListArr[i][j].a0.actType == PROMPT) - free(_actListArr[i][j].a3.responsePtr); + for (int j = 0; _actListArr[i][j]._a0._actType != ANULL; j++) { + if (_actListArr[i][j]._a0._actType == PROMPT) + free(_actListArr[i][j]._a3._responsePtr); } free(_actListArr[i]); } @@ -658,30 +658,30 @@ void Scheduler::processMaze(const int x1, const int x2, const int y1, const int if (x1 < _vm->_maze._x1) { // Exit west - _actListArr[_alNewscrIndex][3].a8.screenIndex = *_vm->_screen_p - 1; - _actListArr[_alNewscrIndex][0].a2.x = _vm->_maze._x2 - kShiftSize - (x2 - x1); - _actListArr[_alNewscrIndex][0].a2.y = _vm->_hero->_y; + _actListArr[_alNewscrIndex][3]._a8._screenIndex = *_vm->_screen_p - 1; + _actListArr[_alNewscrIndex][0]._a2._x = _vm->_maze._x2 - kShiftSize - (x2 - x1); + _actListArr[_alNewscrIndex][0]._a2._y = _vm->_hero->_y; _vm->_route->resetRoute(); insertActionList(_alNewscrIndex); } else if (x2 > _vm->_maze._x2) { // Exit east - _actListArr[_alNewscrIndex][3].a8.screenIndex = *_vm->_screen_p + 1; - _actListArr[_alNewscrIndex][0].a2.x = _vm->_maze._x1 + kShiftSize; - _actListArr[_alNewscrIndex][0].a2.y = _vm->_hero->_y; + _actListArr[_alNewscrIndex][3]._a8._screenIndex = *_vm->_screen_p + 1; + _actListArr[_alNewscrIndex][0]._a2._x = _vm->_maze._x1 + kShiftSize; + _actListArr[_alNewscrIndex][0]._a2._y = _vm->_hero->_y; _vm->_route->resetRoute(); insertActionList(_alNewscrIndex); } else if (y1 < _vm->_maze._y1 - kShiftSize) { // Exit north - _actListArr[_alNewscrIndex][3].a8.screenIndex = *_vm->_screen_p - _vm->_maze._size; - _actListArr[_alNewscrIndex][0].a2.x = _vm->_maze._x3; - _actListArr[_alNewscrIndex][0].a2.y = _vm->_maze._y2 - kShiftSize - (y2 - y1); + _actListArr[_alNewscrIndex][3]._a8._screenIndex = *_vm->_screen_p - _vm->_maze._size; + _actListArr[_alNewscrIndex][0]._a2._x = _vm->_maze._x3; + _actListArr[_alNewscrIndex][0]._a2._y = _vm->_maze._y2 - kShiftSize - (y2 - y1); _vm->_route->resetRoute(); insertActionList(_alNewscrIndex); } else if (y2 > _vm->_maze._y2 - kShiftSize / 2) { // Exit south - _actListArr[_alNewscrIndex][3].a8.screenIndex = *_vm->_screen_p + _vm->_maze._size; - _actListArr[_alNewscrIndex][0].a2.x = _vm->_maze._x4; - _actListArr[_alNewscrIndex][0].a2.y = _vm->_maze._y1 + kShiftSize; + _actListArr[_alNewscrIndex][3]._a8._screenIndex = *_vm->_screen_p + _vm->_maze._size; + _actListArr[_alNewscrIndex][0]._a2._x = _vm->_maze._x4; + _actListArr[_alNewscrIndex][0]._a2._y = _vm->_maze._y1 + kShiftSize; _vm->_route->resetRoute(); insertActionList(_alNewscrIndex); } @@ -712,13 +712,13 @@ void Scheduler::saveEvents(Common::WriteStream *f) { // fix up action pointer (to do better) int16 index, subElem; - findAction(wrkEvent->action, &index, &subElem); + findAction(wrkEvent->_action, &index, &subElem); f->writeSint16BE(index); f->writeSint16BE(subElem); - f->writeByte((wrkEvent->localActionFl) ? 1 : 0); - f->writeUint32BE(wrkEvent->time); - f->writeSint16BE((wrkEvent->prevEvent == 0) ? -1 : (wrkEvent->prevEvent - _events)); - f->writeSint16BE((wrkEvent->nextEvent == 0) ? -1 : (wrkEvent->nextEvent - _events)); + f->writeByte((wrkEvent->_localActionFl) ? 1 : 0); + f->writeUint32BE(wrkEvent->_time); + f->writeSint16BE((wrkEvent->_prevEvent == 0) ? -1 : (wrkEvent->_prevEvent - _events)); + f->writeSint16BE((wrkEvent->_nextEvent == 0) ? -1 : (wrkEvent->_nextEvent - _events)); } } @@ -738,7 +738,7 @@ void Scheduler::restoreActions(Common::ReadStream *f) { int16 Scheduler::calcMaxPoints() const { int16 tmpScore = 0; for (int i = 0; i < _numBonuses; i++) - tmpScore += _points[i].score; + tmpScore += _points[i]._score; return tmpScore; } @@ -752,282 +752,282 @@ void Scheduler::saveActions(Common::WriteStream *f) const { for (int i = 0; i < _actListArrSize; i++) { // write all the sub elems data - for (nbrSubElem = 1; _actListArr[i][nbrSubElem - 1].a0.actType != ANULL; nbrSubElem++) + for (nbrSubElem = 1; _actListArr[i][nbrSubElem - 1]._a0._actType != ANULL; nbrSubElem++) ; f->writeUint16BE(nbrSubElem); for (int j = 0; j < nbrSubElem; j++) { - subElemType = _actListArr[i][j].a0.actType; + subElemType = _actListArr[i][j]._a0._actType; f->writeByte(subElemType); switch (subElemType) { case ANULL: // -1 break; case ASCHEDULE: // 0 - f->writeSint16BE(_actListArr[i][j].a0.timer); - f->writeUint16BE(_actListArr[i][j].a0.actIndex); + f->writeSint16BE(_actListArr[i][j]._a0._timer); + f->writeUint16BE(_actListArr[i][j]._a0._actIndex); break; case START_OBJ: // 1 - f->writeSint16BE(_actListArr[i][j].a1.timer); - f->writeSint16BE(_actListArr[i][j].a1.objIndex); - f->writeSint16BE(_actListArr[i][j].a1.cycleNumb); - f->writeByte(_actListArr[i][j].a1.cycle); + f->writeSint16BE(_actListArr[i][j]._a1._timer); + f->writeSint16BE(_actListArr[i][j]._a1._objIndex); + f->writeSint16BE(_actListArr[i][j]._a1._cycleNumb); + f->writeByte(_actListArr[i][j]._a1._cycle); break; case INIT_OBJXY: // 2 - f->writeSint16BE(_actListArr[i][j].a2.timer); - f->writeSint16BE(_actListArr[i][j].a2.objIndex); - f->writeSint16BE(_actListArr[i][j].a2.x); - f->writeSint16BE(_actListArr[i][j].a2.y); + f->writeSint16BE(_actListArr[i][j]._a2._timer); + f->writeSint16BE(_actListArr[i][j]._a2._objIndex); + f->writeSint16BE(_actListArr[i][j]._a2._x); + f->writeSint16BE(_actListArr[i][j]._a2._y); break; case PROMPT: // 3 - f->writeSint16BE(_actListArr[i][j].a3.timer); - f->writeSint16BE(_actListArr[i][j].a3.promptIndex); - for (nbrCpt = 0; _actListArr[i][j].a3.responsePtr[nbrCpt] != -1; nbrCpt++) + f->writeSint16BE(_actListArr[i][j]._a3._timer); + f->writeSint16BE(_actListArr[i][j]._a3._promptIndex); + for (nbrCpt = 0; _actListArr[i][j]._a3._responsePtr[nbrCpt] != -1; nbrCpt++) ; nbrCpt++; f->writeUint16BE(nbrCpt); for (int k = 0; k < nbrCpt; k++) - f->writeSint16BE(_actListArr[i][j].a3.responsePtr[k]); - f->writeUint16BE(_actListArr[i][j].a3.actPassIndex); - f->writeUint16BE(_actListArr[i][j].a3.actFailIndex); - f->writeByte((_actListArr[i][j].a3.encodedFl) ? 1 : 0); + f->writeSint16BE(_actListArr[i][j]._a3._responsePtr[k]); + f->writeUint16BE(_actListArr[i][j]._a3._actPassIndex); + f->writeUint16BE(_actListArr[i][j]._a3._actFailIndex); + f->writeByte((_actListArr[i][j]._a3._encodedFl) ? 1 : 0); break; case BKGD_COLOR: // 4 - f->writeSint16BE(_actListArr[i][j].a4.timer); - f->writeUint32BE(_actListArr[i][j].a4.newBackgroundColor); + f->writeSint16BE(_actListArr[i][j]._a4._timer); + f->writeUint32BE(_actListArr[i][j]._a4._newBackgroundColor); break; case INIT_OBJVXY: // 5 - f->writeSint16BE(_actListArr[i][j].a5.timer); - f->writeSint16BE(_actListArr[i][j].a5.objIndex); - f->writeSint16BE(_actListArr[i][j].a5.vx); - f->writeSint16BE(_actListArr[i][j].a5.vy); + f->writeSint16BE(_actListArr[i][j]._a5._timer); + f->writeSint16BE(_actListArr[i][j]._a5._objIndex); + f->writeSint16BE(_actListArr[i][j]._a5._vx); + f->writeSint16BE(_actListArr[i][j]._a5._vy); break; case INIT_CARRY: // 6 - f->writeSint16BE(_actListArr[i][j].a6.timer); - f->writeSint16BE(_actListArr[i][j].a6.objIndex); - f->writeByte((_actListArr[i][j].a6.carriedFl) ? 1 : 0); + f->writeSint16BE(_actListArr[i][j]._a6._timer); + f->writeSint16BE(_actListArr[i][j]._a6._objIndex); + f->writeByte((_actListArr[i][j]._a6._carriedFl) ? 1 : 0); break; case INIT_HF_COORD: // 7 - f->writeSint16BE(_actListArr[i][j].a7.timer); - f->writeSint16BE(_actListArr[i][j].a7.objIndex); + f->writeSint16BE(_actListArr[i][j]._a7._timer); + f->writeSint16BE(_actListArr[i][j]._a7._objIndex); break; case NEW_SCREEN: // 8 - f->writeSint16BE(_actListArr[i][j].a8.timer); - f->writeSint16BE(_actListArr[i][j].a8.screenIndex); + f->writeSint16BE(_actListArr[i][j]._a8._timer); + f->writeSint16BE(_actListArr[i][j]._a8._screenIndex); break; case INIT_OBJSTATE: // 9 - f->writeSint16BE(_actListArr[i][j].a9.timer); - f->writeSint16BE(_actListArr[i][j].a9.objIndex); - f->writeByte(_actListArr[i][j].a9.newState); + f->writeSint16BE(_actListArr[i][j]._a9._timer); + f->writeSint16BE(_actListArr[i][j]._a9._objIndex); + f->writeByte(_actListArr[i][j]._a9._newState); break; case INIT_PATH: // 10 - f->writeSint16BE(_actListArr[i][j].a10.timer); - f->writeSint16BE(_actListArr[i][j].a10.objIndex); - f->writeSint16BE(_actListArr[i][j].a10.newPathType); - f->writeByte(_actListArr[i][j].a10.vxPath); - f->writeByte(_actListArr[i][j].a10.vyPath); + f->writeSint16BE(_actListArr[i][j]._a10._timer); + f->writeSint16BE(_actListArr[i][j]._a10._objIndex); + f->writeSint16BE(_actListArr[i][j]._a10._newPathType); + f->writeByte(_actListArr[i][j]._a10._vxPath); + f->writeByte(_actListArr[i][j]._a10._vyPath); break; case COND_R: // 11 - f->writeSint16BE(_actListArr[i][j].a11.timer); - f->writeSint16BE(_actListArr[i][j].a11.objIndex); - f->writeByte(_actListArr[i][j].a11.stateReq); - f->writeUint16BE(_actListArr[i][j].a11.actPassIndex); - f->writeUint16BE(_actListArr[i][j].a11.actFailIndex); + f->writeSint16BE(_actListArr[i][j]._a11._timer); + f->writeSint16BE(_actListArr[i][j]._a11._objIndex); + f->writeByte(_actListArr[i][j]._a11._stateReq); + f->writeUint16BE(_actListArr[i][j]._a11._actPassIndex); + f->writeUint16BE(_actListArr[i][j]._a11._actFailIndex); break; case TEXT: // 12 - f->writeSint16BE(_actListArr[i][j].a12.timer); - f->writeSint16BE(_actListArr[i][j].a12.stringIndex); + f->writeSint16BE(_actListArr[i][j]._a12._timer); + f->writeSint16BE(_actListArr[i][j]._a12._stringIndex); break; case SWAP_IMAGES: // 13 - f->writeSint16BE(_actListArr[i][j].a13.timer); - f->writeSint16BE(_actListArr[i][j].a13.objIndex1); - f->writeSint16BE(_actListArr[i][j].a13.objIndex2); + f->writeSint16BE(_actListArr[i][j]._a13._timer); + f->writeSint16BE(_actListArr[i][j]._a13._objIndex1); + f->writeSint16BE(_actListArr[i][j]._a13._objIndex2); break; case COND_SCR: // 14 - f->writeSint16BE(_actListArr[i][j].a14.timer); - f->writeSint16BE(_actListArr[i][j].a14.objIndex); - f->writeSint16BE(_actListArr[i][j].a14.screenReq); - f->writeUint16BE(_actListArr[i][j].a14.actPassIndex); - f->writeUint16BE(_actListArr[i][j].a14.actFailIndex); + f->writeSint16BE(_actListArr[i][j]._a14._timer); + f->writeSint16BE(_actListArr[i][j]._a14._objIndex); + f->writeSint16BE(_actListArr[i][j]._a14._screenReq); + f->writeUint16BE(_actListArr[i][j]._a14._actPassIndex); + f->writeUint16BE(_actListArr[i][j]._a14._actFailIndex); break; case AUTOPILOT: // 15 - f->writeSint16BE(_actListArr[i][j].a15.timer); - f->writeSint16BE(_actListArr[i][j].a15.objIndex1); - f->writeSint16BE(_actListArr[i][j].a15.objIndex2); - f->writeByte(_actListArr[i][j].a15.dx); - f->writeByte(_actListArr[i][j].a15.dy); + f->writeSint16BE(_actListArr[i][j]._a15._timer); + f->writeSint16BE(_actListArr[i][j]._a15._objIndex1); + f->writeSint16BE(_actListArr[i][j]._a15._objIndex2); + f->writeByte(_actListArr[i][j]._a15._dx); + f->writeByte(_actListArr[i][j]._a15._dy); break; case INIT_OBJ_SEQ: // 16 - f->writeSint16BE(_actListArr[i][j].a16.timer); - f->writeSint16BE(_actListArr[i][j].a16.objIndex); - f->writeSint16BE(_actListArr[i][j].a16.seqIndex); + f->writeSint16BE(_actListArr[i][j]._a16._timer); + f->writeSint16BE(_actListArr[i][j]._a16._objIndex); + f->writeSint16BE(_actListArr[i][j]._a16._seqIndex); break; case SET_STATE_BITS: // 17 - f->writeSint16BE(_actListArr[i][j].a17.timer); - f->writeSint16BE(_actListArr[i][j].a17.objIndex); - f->writeSint16BE(_actListArr[i][j].a17.stateMask); + f->writeSint16BE(_actListArr[i][j]._a17._timer); + f->writeSint16BE(_actListArr[i][j]._a17._objIndex); + f->writeSint16BE(_actListArr[i][j]._a17._stateMask); break; case CLEAR_STATE_BITS: // 18 - f->writeSint16BE(_actListArr[i][j].a18.timer); - f->writeSint16BE(_actListArr[i][j].a18.objIndex); - f->writeSint16BE(_actListArr[i][j].a18.stateMask); + f->writeSint16BE(_actListArr[i][j]._a18._timer); + f->writeSint16BE(_actListArr[i][j]._a18._objIndex); + f->writeSint16BE(_actListArr[i][j]._a18._stateMask); break; case TEST_STATE_BITS: // 19 - f->writeSint16BE(_actListArr[i][j].a19.timer); - f->writeSint16BE(_actListArr[i][j].a19.objIndex); - f->writeSint16BE(_actListArr[i][j].a19.stateMask); - f->writeUint16BE(_actListArr[i][j].a19.actPassIndex); - f->writeUint16BE(_actListArr[i][j].a19.actFailIndex); + f->writeSint16BE(_actListArr[i][j]._a19._timer); + f->writeSint16BE(_actListArr[i][j]._a19._objIndex); + f->writeSint16BE(_actListArr[i][j]._a19._stateMask); + f->writeUint16BE(_actListArr[i][j]._a19._actPassIndex); + f->writeUint16BE(_actListArr[i][j]._a19._actFailIndex); break; case DEL_EVENTS: // 20 - f->writeSint16BE(_actListArr[i][j].a20.timer); - f->writeByte(_actListArr[i][j].a20.actTypeDel); + f->writeSint16BE(_actListArr[i][j]._a20._timer); + f->writeByte(_actListArr[i][j]._a20._actTypeDel); break; case GAMEOVER: // 21 - f->writeSint16BE(_actListArr[i][j].a21.timer); + f->writeSint16BE(_actListArr[i][j]._a21._timer); break; case INIT_HH_COORD: // 22 - f->writeSint16BE(_actListArr[i][j].a22.timer); - f->writeSint16BE(_actListArr[i][j].a22.objIndex); + f->writeSint16BE(_actListArr[i][j]._a22._timer); + f->writeSint16BE(_actListArr[i][j]._a22._objIndex); break; case EXIT: // 23 - f->writeSint16BE(_actListArr[i][j].a23.timer); + f->writeSint16BE(_actListArr[i][j]._a23._timer); break; case BONUS: // 24 - f->writeSint16BE(_actListArr[i][j].a24.timer); - f->writeSint16BE(_actListArr[i][j].a24.pointIndex); + f->writeSint16BE(_actListArr[i][j]._a24._timer); + f->writeSint16BE(_actListArr[i][j]._a24._pointIndex); break; case COND_BOX: // 25 - f->writeSint16BE(_actListArr[i][j].a25.timer); - f->writeSint16BE(_actListArr[i][j].a25.objIndex); - f->writeSint16BE(_actListArr[i][j].a25.x1); - f->writeSint16BE(_actListArr[i][j].a25.y1); - f->writeSint16BE(_actListArr[i][j].a25.x2); - f->writeSint16BE(_actListArr[i][j].a25.y2); - f->writeUint16BE(_actListArr[i][j].a25.actPassIndex); - f->writeUint16BE(_actListArr[i][j].a25.actFailIndex); + f->writeSint16BE(_actListArr[i][j]._a25._timer); + f->writeSint16BE(_actListArr[i][j]._a25._objIndex); + f->writeSint16BE(_actListArr[i][j]._a25._x1); + f->writeSint16BE(_actListArr[i][j]._a25._y1); + f->writeSint16BE(_actListArr[i][j]._a25._x2); + f->writeSint16BE(_actListArr[i][j]._a25._y2); + f->writeUint16BE(_actListArr[i][j]._a25._actPassIndex); + f->writeUint16BE(_actListArr[i][j]._a25._actFailIndex); break; case SOUND: // 26 - f->writeSint16BE(_actListArr[i][j].a26.timer); - f->writeSint16BE(_actListArr[i][j].a26.soundIndex); + f->writeSint16BE(_actListArr[i][j]._a26._timer); + f->writeSint16BE(_actListArr[i][j]._a26._soundIndex); break; case ADD_SCORE: // 27 - f->writeSint16BE(_actListArr[i][j].a27.timer); - f->writeSint16BE(_actListArr[i][j].a27.objIndex); + f->writeSint16BE(_actListArr[i][j]._a27._timer); + f->writeSint16BE(_actListArr[i][j]._a27._objIndex); break; case SUB_SCORE: // 28 - f->writeSint16BE(_actListArr[i][j].a28.timer); - f->writeSint16BE(_actListArr[i][j].a28.objIndex); + f->writeSint16BE(_actListArr[i][j]._a28._timer); + f->writeSint16BE(_actListArr[i][j]._a28._objIndex); break; case COND_CARRY: // 29 - f->writeSint16BE(_actListArr[i][j].a29.timer); - f->writeSint16BE(_actListArr[i][j].a29.objIndex); - f->writeUint16BE(_actListArr[i][j].a29.actPassIndex); - f->writeUint16BE(_actListArr[i][j].a29.actFailIndex); + f->writeSint16BE(_actListArr[i][j]._a29._timer); + f->writeSint16BE(_actListArr[i][j]._a29._objIndex); + f->writeUint16BE(_actListArr[i][j]._a29._actPassIndex); + f->writeUint16BE(_actListArr[i][j]._a29._actFailIndex); break; case INIT_MAZE: // 30 - f->writeSint16BE(_actListArr[i][j].a30.timer); - f->writeByte(_actListArr[i][j].a30.mazeSize); - f->writeSint16BE(_actListArr[i][j].a30.x1); - f->writeSint16BE(_actListArr[i][j].a30.y1); - f->writeSint16BE(_actListArr[i][j].a30.x2); - f->writeSint16BE(_actListArr[i][j].a30.y2); - f->writeSint16BE(_actListArr[i][j].a30.x3); - f->writeSint16BE(_actListArr[i][j].a30.x4); - f->writeByte(_actListArr[i][j].a30.firstScreenIndex); + f->writeSint16BE(_actListArr[i][j]._a30._timer); + f->writeByte(_actListArr[i][j]._a30._mazeSize); + f->writeSint16BE(_actListArr[i][j]._a30._x1); + f->writeSint16BE(_actListArr[i][j]._a30._y1); + f->writeSint16BE(_actListArr[i][j]._a30._x2); + f->writeSint16BE(_actListArr[i][j]._a30._y2); + f->writeSint16BE(_actListArr[i][j]._a30._x3); + f->writeSint16BE(_actListArr[i][j]._a30._x4); + f->writeByte(_actListArr[i][j]._a30._firstScreenIndex); break; case EXIT_MAZE: // 31 - f->writeSint16BE(_actListArr[i][j].a31.timer); + f->writeSint16BE(_actListArr[i][j]._a31._timer); break; case INIT_PRIORITY: // 32 - f->writeSint16BE(_actListArr[i][j].a32.timer); - f->writeSint16BE(_actListArr[i][j].a32.objIndex); - f->writeByte(_actListArr[i][j].a32.priority); + f->writeSint16BE(_actListArr[i][j]._a32._timer); + f->writeSint16BE(_actListArr[i][j]._a32._objIndex); + f->writeByte(_actListArr[i][j]._a32._priority); break; case INIT_SCREEN: // 33 - f->writeSint16BE(_actListArr[i][j].a33.timer); - f->writeSint16BE(_actListArr[i][j].a33.objIndex); - f->writeSint16BE(_actListArr[i][j].a33.screenIndex); + f->writeSint16BE(_actListArr[i][j]._a33._timer); + f->writeSint16BE(_actListArr[i][j]._a33._objIndex); + f->writeSint16BE(_actListArr[i][j]._a33._screenIndex); break; case AGSCHEDULE: // 34 - f->writeSint16BE(_actListArr[i][j].a34.timer); - f->writeUint16BE(_actListArr[i][j].a34.actIndex); + f->writeSint16BE(_actListArr[i][j]._a34._timer); + f->writeUint16BE(_actListArr[i][j]._a34._actIndex); break; case REMAPPAL: // 35 - f->writeSint16BE(_actListArr[i][j].a35.timer); - f->writeSint16BE(_actListArr[i][j].a35.oldColorIndex); - f->writeSint16BE(_actListArr[i][j].a35.newColorIndex); + f->writeSint16BE(_actListArr[i][j]._a35._timer); + f->writeSint16BE(_actListArr[i][j]._a35._oldColorIndex); + f->writeSint16BE(_actListArr[i][j]._a35._newColorIndex); break; case COND_NOUN: // 36 - f->writeSint16BE(_actListArr[i][j].a36.timer); - f->writeUint16BE(_actListArr[i][j].a36.nounIndex); - f->writeUint16BE(_actListArr[i][j].a36.actPassIndex); - f->writeUint16BE(_actListArr[i][j].a36.actFailIndex); + f->writeSint16BE(_actListArr[i][j]._a36._timer); + f->writeUint16BE(_actListArr[i][j]._a36._nounIndex); + f->writeUint16BE(_actListArr[i][j]._a36._actPassIndex); + f->writeUint16BE(_actListArr[i][j]._a36._actFailIndex); break; case SCREEN_STATE: // 37 - f->writeSint16BE(_actListArr[i][j].a37.timer); - f->writeSint16BE(_actListArr[i][j].a37.screenIndex); - f->writeByte(_actListArr[i][j].a37.newState); + f->writeSint16BE(_actListArr[i][j]._a37._timer); + f->writeSint16BE(_actListArr[i][j]._a37._screenIndex); + f->writeByte(_actListArr[i][j]._a37._newState); break; case INIT_LIPS: // 38 - f->writeSint16BE(_actListArr[i][j].a38.timer); - f->writeSint16BE(_actListArr[i][j].a38.lipsObjIndex); - f->writeSint16BE(_actListArr[i][j].a38.objIndex); - f->writeByte(_actListArr[i][j].a38.dxLips); - f->writeByte(_actListArr[i][j].a38.dyLips); + f->writeSint16BE(_actListArr[i][j]._a38._timer); + f->writeSint16BE(_actListArr[i][j]._a38._lipsObjIndex); + f->writeSint16BE(_actListArr[i][j]._a38._objIndex); + f->writeByte(_actListArr[i][j]._a38._dxLips); + f->writeByte(_actListArr[i][j]._a38._dyLips); break; case INIT_STORY_MODE: // 39 - f->writeSint16BE(_actListArr[i][j].a39.timer); - f->writeByte((_actListArr[i][j].a39.storyModeFl) ? 1 : 0); + f->writeSint16BE(_actListArr[i][j]._a39._timer); + f->writeByte((_actListArr[i][j]._a39._storyModeFl) ? 1 : 0); break; case WARN: // 40 - f->writeSint16BE(_actListArr[i][j].a40.timer); - f->writeSint16BE(_actListArr[i][j].a40.stringIndex); + f->writeSint16BE(_actListArr[i][j]._a40._timer); + f->writeSint16BE(_actListArr[i][j]._a40._stringIndex); break; case COND_BONUS: // 41 - f->writeSint16BE(_actListArr[i][j].a41.timer); - f->writeSint16BE(_actListArr[i][j].a41.BonusIndex); - f->writeUint16BE(_actListArr[i][j].a41.actPassIndex); - f->writeUint16BE(_actListArr[i][j].a41.actFailIndex); + f->writeSint16BE(_actListArr[i][j]._a41._timer); + f->writeSint16BE(_actListArr[i][j]._a41._bonusIndex); + f->writeUint16BE(_actListArr[i][j]._a41._actPassIndex); + f->writeUint16BE(_actListArr[i][j]._a41._actFailIndex); break; case TEXT_TAKE: // 42 - f->writeSint16BE(_actListArr[i][j].a42.timer); - f->writeSint16BE(_actListArr[i][j].a42.objIndex); + f->writeSint16BE(_actListArr[i][j]._a42._timer); + f->writeSint16BE(_actListArr[i][j]._a42._objIndex); break; case YESNO: // 43 - f->writeSint16BE(_actListArr[i][j].a43.timer); - f->writeSint16BE(_actListArr[i][j].a43.promptIndex); - f->writeUint16BE(_actListArr[i][j].a43.actYesIndex); - f->writeUint16BE(_actListArr[i][j].a43.actNoIndex); + f->writeSint16BE(_actListArr[i][j]._a43._timer); + f->writeSint16BE(_actListArr[i][j]._a43._promptIndex); + f->writeUint16BE(_actListArr[i][j]._a43._actYesIndex); + f->writeUint16BE(_actListArr[i][j]._a43._actNoIndex); break; case STOP_ROUTE: // 44 - f->writeSint16BE(_actListArr[i][j].a44.timer); + f->writeSint16BE(_actListArr[i][j]._a44._timer); break; case COND_ROUTE: // 45 - f->writeSint16BE(_actListArr[i][j].a45.timer); - f->writeSint16BE(_actListArr[i][j].a45.routeIndex); - f->writeUint16BE(_actListArr[i][j].a45.actPassIndex); - f->writeUint16BE(_actListArr[i][j].a45.actFailIndex); + f->writeSint16BE(_actListArr[i][j]._a45._timer); + f->writeSint16BE(_actListArr[i][j]._a45._routeIndex); + f->writeUint16BE(_actListArr[i][j]._a45._actPassIndex); + f->writeUint16BE(_actListArr[i][j]._a45._actFailIndex); break; case INIT_JUMPEXIT: // 46 - f->writeSint16BE(_actListArr[i][j].a46.timer); - f->writeByte((_actListArr[i][j].a46.jumpExitFl) ? 1 : 0); + f->writeSint16BE(_actListArr[i][j]._a46._timer); + f->writeByte((_actListArr[i][j]._a46._jumpExitFl) ? 1 : 0); break; case INIT_VIEW: // 47 - f->writeSint16BE(_actListArr[i][j].a47.timer); - f->writeSint16BE(_actListArr[i][j].a47.objIndex); - f->writeSint16BE(_actListArr[i][j].a47.viewx); - f->writeSint16BE(_actListArr[i][j].a47.viewy); - f->writeSint16BE(_actListArr[i][j].a47.direction); + f->writeSint16BE(_actListArr[i][j]._a47._timer); + f->writeSint16BE(_actListArr[i][j]._a47._objIndex); + f->writeSint16BE(_actListArr[i][j]._a47._viewx); + f->writeSint16BE(_actListArr[i][j]._a47._viewy); + f->writeSint16BE(_actListArr[i][j]._a47._direction); break; case INIT_OBJ_FRAME: // 48 - f->writeSint16BE(_actListArr[i][j].a48.timer); - f->writeSint16BE(_actListArr[i][j].a48.objIndex); - f->writeSint16BE(_actListArr[i][j].a48.seqIndex); - f->writeSint16BE(_actListArr[i][j].a48.frameIndex); + f->writeSint16BE(_actListArr[i][j]._a48._timer); + f->writeSint16BE(_actListArr[i][j]._a48._objIndex); + f->writeSint16BE(_actListArr[i][j]._a48._seqIndex); + f->writeSint16BE(_actListArr[i][j]._a48._frameIndex); break; case OLD_SONG: // 49, Added by Strangerke for DOS versions - f->writeSint16BE(_actListArr[i][j].a49.timer); - f->writeUint16BE(_actListArr[i][j].a49.songIndex); + f->writeSint16BE(_actListArr[i][j]._a49._timer); + f->writeUint16BE(_actListArr[i][j]._a49._songIndex); break; default: error("Unknown action %d", subElemType); @@ -1057,7 +1057,7 @@ void Scheduler::findAction(const act* action, int16* index, int16* subElem) { return; } j++; - } while (_actListArr[i][j-1].a0.actType != ANULL); + } while (_actListArr[i][j-1]._a0._actType != ANULL); } // action not found ?? assert(0); @@ -1102,18 +1102,18 @@ void Scheduler::restoreEvents(Common::ReadStream *f) { // fix up action pointer (to do better) if ((index == -1) && (subElem == -1)) - _events[i].action = 0; + _events[i]._action = 0; else - _events[i].action = (act *)&_actListArr[index][subElem]; + _events[i]._action = (act *)&_actListArr[index][subElem]; - _events[i].localActionFl = (f->readByte() == 1) ? true : false; - _events[i].time = f->readUint32BE(); + _events[i]._localActionFl = (f->readByte() == 1) ? true : false; + _events[i]._time = f->readUint32BE(); int16 prevIndex = f->readSint16BE(); int16 nextIndex = f->readSint16BE(); - _events[i].prevEvent = (prevIndex == -1) ? (event_t *)0 : &_events[prevIndex]; - _events[i].nextEvent = (nextIndex == -1) ? (event_t *)0 : &_events[nextIndex]; + _events[i]._prevEvent = (prevIndex == -1) ? (event_t *)0 : &_events[prevIndex]; + _events[i]._nextEvent = (nextIndex == -1) ? (event_t *)0 : &_events[nextIndex]; } _freeEvent = (freeIndex == -1) ? 0 : &_events[freeIndex]; _headEvent = (headIndex == -1) ? 0 : &_events[headIndex]; @@ -1123,8 +1123,8 @@ void Scheduler::restoreEvents(Common::ReadStream *f) { uint32 curTime = getTicks(); event_t *wrkEvent = _headEvent; // The earliest event while (wrkEvent) { // While mature events found - wrkEvent->time = wrkEvent->time - saveTime + curTime; - wrkEvent = wrkEvent->nextEvent; + wrkEvent->_time = wrkEvent->_time - saveTime + curTime; + wrkEvent = wrkEvent->_nextEvent; } } @@ -1133,52 +1133,52 @@ void Scheduler::restoreEvents(Common::ReadStream *f) { * The queue goes from head (earliest) to tail (latest) timewise */ void Scheduler::insertAction(act *action) { - debugC(1, kDebugSchedule, "insertAction() - Action type A%d", action->a0.actType); + debugC(1, kDebugSchedule, "insertAction() - Action type A%d", action->_a0._actType); // First, get and initialize the event structure event_t *curEvent = getQueue(); - curEvent->action = action; - switch (action->a0.actType) { // Assign whether local or global + curEvent->_action = action; + switch (action->_a0._actType) { // Assign whether local or global case AGSCHEDULE: - curEvent->localActionFl = false; // Lasts over a new screen + curEvent->_localActionFl = false; // Lasts over a new screen break; // Workaround: When dying, switch to storyMode in order to block the keyboard. case GAMEOVER: _vm->getGameStatus()._storyModeFl = true; // No break on purpose default: - curEvent->localActionFl = true; // Rest are for current screen only + curEvent->_localActionFl = true; // Rest are for current screen only break; } - curEvent->time = action->a0.timer + getTicks(); // Convert rel to abs time + curEvent->_time = action->_a0._timer + getTicks(); // Convert rel to abs time // Now find the place to insert the event if (!_tailEvent) { // Empty queue _tailEvent = _headEvent = curEvent; - curEvent->nextEvent = curEvent->prevEvent = 0; + curEvent->_nextEvent = curEvent->_prevEvent = 0; } else { event_t *wrkEvent = _tailEvent; // Search from latest time back bool found = false; while (wrkEvent && !found) { - if (wrkEvent->time <= curEvent->time) { // Found if new event later + if (wrkEvent->_time <= curEvent->_time) { // Found if new event later found = true; if (wrkEvent == _tailEvent) // New latest in list _tailEvent = curEvent; else - wrkEvent->nextEvent->prevEvent = curEvent; - curEvent->nextEvent = wrkEvent->nextEvent; - wrkEvent->nextEvent = curEvent; - curEvent->prevEvent = wrkEvent; + wrkEvent->_nextEvent->_prevEvent = curEvent; + curEvent->_nextEvent = wrkEvent->_nextEvent; + wrkEvent->_nextEvent = curEvent; + curEvent->_prevEvent = wrkEvent; } - wrkEvent = wrkEvent->prevEvent; + wrkEvent = wrkEvent->_prevEvent; } if (!found) { // Must be earliest in list - _headEvent->prevEvent = curEvent; // So insert as new head - curEvent->nextEvent = _headEvent; - curEvent->prevEvent = 0; + _headEvent->_prevEvent = curEvent; // So insert as new head + curEvent->_nextEvent = _headEvent; + curEvent->_prevEvent = 0; _headEvent = curEvent; } } @@ -1190,94 +1190,94 @@ void Scheduler::insertAction(act *action) { * to the next action in the list, except special case of NEW_SCREEN */ event_t *Scheduler::doAction(event_t *curEvent) { - debugC(1, kDebugSchedule, "doAction - Event action type : %d", curEvent->action->a0.actType); + debugC(1, kDebugSchedule, "doAction - Event action type : %d", curEvent->_action->_a0._actType); status_t &gameStatus = _vm->getGameStatus(); - act *action = curEvent->action; + act *action = curEvent->_action; object_t *obj1; int dx, dy; event_t *wrkEvent; // Save ev_p->next_p for return - switch (action->a0.actType) { + switch (action->_a0._actType) { case ANULL: // Big NOP from DEL_EVENTS break; case ASCHEDULE: // act0: Schedule an action list - insertActionList(action->a0.actIndex); + insertActionList(action->_a0._actIndex); break; case START_OBJ: // act1: Start an object cycling - _vm->_object->_objects[action->a1.objIndex]._cycleNumb = action->a1.cycleNumb; - _vm->_object->_objects[action->a1.objIndex]._cycling = action->a1.cycle; + _vm->_object->_objects[action->_a1._objIndex]._cycleNumb = action->_a1._cycleNumb; + _vm->_object->_objects[action->_a1._objIndex]._cycling = action->_a1._cycle; break; case INIT_OBJXY: // act2: Initialize an object - _vm->_object->_objects[action->a2.objIndex]._x = action->a2.x; // Coordinates - _vm->_object->_objects[action->a2.objIndex]._y = action->a2.y; + _vm->_object->_objects[action->_a2._objIndex]._x = action->_a2._x; // Coordinates + _vm->_object->_objects[action->_a2._objIndex]._y = action->_a2._y; break; case PROMPT: // act3: Prompt user for key phrase promptAction(action); break; case BKGD_COLOR: // act4: Set new background color - _vm->_screen->setBackgroundColor(action->a4.newBackgroundColor); + _vm->_screen->setBackgroundColor(action->_a4._newBackgroundColor); break; case INIT_OBJVXY: // act5: Initialize an object velocity - _vm->_object->setVelocity(action->a5.objIndex, action->a5.vx, action->a5.vy); + _vm->_object->setVelocity(action->_a5._objIndex, action->_a5._vx, action->_a5._vy); break; case INIT_CARRY: // act6: Initialize an object - _vm->_object->setCarry(action->a6.objIndex, action->a6.carriedFl); // carried status + _vm->_object->setCarry(action->_a6._objIndex, action->_a6._carriedFl); // carried status break; case INIT_HF_COORD: // act7: Initialize an object to hero's "feet" coords - _vm->_object->_objects[action->a7.objIndex]._x = _vm->_hero->_x - 1; - _vm->_object->_objects[action->a7.objIndex]._y = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2 - 1; - _vm->_object->_objects[action->a7.objIndex]._screenIndex = *_vm->_screen_p; // Don't forget screen! + _vm->_object->_objects[action->_a7._objIndex]._x = _vm->_hero->_x - 1; + _vm->_object->_objects[action->_a7._objIndex]._y = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2 - 1; + _vm->_object->_objects[action->_a7._objIndex]._screenIndex = *_vm->_screen_p; // Don't forget screen! break; case NEW_SCREEN: // act8: Start new screen - newScreen(action->a8.screenIndex); + newScreen(action->_a8._screenIndex); break; case INIT_OBJSTATE: // act9: Initialize an object state - _vm->_object->_objects[action->a9.objIndex]._state = action->a9.newState; + _vm->_object->_objects[action->_a9._objIndex]._state = action->_a9._newState; break; case INIT_PATH: // act10: Initialize an object path and velocity - _vm->_object->setPath(action->a10.objIndex, (path_t) action->a10.newPathType, action->a10.vxPath, action->a10.vyPath); + _vm->_object->setPath(action->_a10._objIndex, (path_t) action->_a10._newPathType, action->_a10._vxPath, action->_a10._vyPath); break; case COND_R: // act11: action lists conditional on object state - if (_vm->_object->_objects[action->a11.objIndex]._state == action->a11.stateReq) - insertActionList(action->a11.actPassIndex); + if (_vm->_object->_objects[action->_a11._objIndex]._state == action->_a11._stateReq) + insertActionList(action->_a11._actPassIndex); else - insertActionList(action->a11.actFailIndex); + insertActionList(action->_a11._actFailIndex); break; case TEXT: // act12: Text box (CF WARN) - Utils::notifyBox(_vm->_file->fetchString(action->a12.stringIndex)); // Fetch string from file + Utils::notifyBox(_vm->_file->fetchString(action->_a12._stringIndex)); // Fetch string from file break; case SWAP_IMAGES: // act13: Swap 2 object images - _vm->_object->swapImages(action->a13.objIndex1, action->a13.objIndex2); + _vm->_object->swapImages(action->_a13._objIndex1, action->_a13._objIndex2); break; case COND_SCR: // act14: Conditional on current screen - if (_vm->_object->_objects[action->a14.objIndex]._screenIndex == action->a14.screenReq) - insertActionList(action->a14.actPassIndex); + if (_vm->_object->_objects[action->_a14._objIndex]._screenIndex == action->_a14._screenReq) + insertActionList(action->_a14._actPassIndex); else - insertActionList(action->a14.actFailIndex); + insertActionList(action->_a14._actFailIndex); break; case AUTOPILOT: // act15: Home in on a (stationary) object - _vm->_object->homeIn(action->a15.objIndex1, action->a15.objIndex2, action->a15.dx, action->a15.dy); + _vm->_object->homeIn(action->_a15._objIndex1, action->_a15._objIndex2, action->_a15._dx, action->_a15._dy); break; case INIT_OBJ_SEQ: // act16: Set sequence number to use // Note: Don't set a sequence at time 0 of a new screen, it causes // problems clearing the boundary bits of the object! t>0 is safe - _vm->_object->_objects[action->a16.objIndex]._currImagePtr = _vm->_object->_objects[action->a16.objIndex]._seqList[action->a16.seqIndex]._seqPtr; + _vm->_object->_objects[action->_a16._objIndex]._currImagePtr = _vm->_object->_objects[action->_a16._objIndex]._seqList[action->_a16._seqIndex]._seqPtr; break; case SET_STATE_BITS: // act17: OR mask with curr obj state - _vm->_object->_objects[action->a17.objIndex]._state |= action->a17.stateMask; + _vm->_object->_objects[action->_a17._objIndex]._state |= action->_a17._stateMask; break; case CLEAR_STATE_BITS: // act18: AND ~mask with curr obj state - _vm->_object->_objects[action->a18.objIndex]._state &= ~action->a18.stateMask; + _vm->_object->_objects[action->_a18._objIndex]._state &= ~action->_a18._stateMask; break; case TEST_STATE_BITS: // act19: If all bits set, do apass else afail - if ((_vm->_object->_objects[action->a19.objIndex]._state & action->a19.stateMask) == action->a19.stateMask) - insertActionList(action->a19.actPassIndex); + if ((_vm->_object->_objects[action->_a19._objIndex]._state & action->_a19._stateMask) == action->_a19._stateMask) + insertActionList(action->_a19._actPassIndex); else - insertActionList(action->a19.actFailIndex); + insertActionList(action->_a19._actFailIndex); break; case DEL_EVENTS: // act20: Remove all events of this action type - delEventType(action->a20.actTypeDel); + delEventType(action->_a20._actTypeDel); break; case GAMEOVER: // act21: Game over! // NOTE: Must wait at least 1 tick before issuing this action if @@ -1285,148 +1285,148 @@ event_t *Scheduler::doAction(event_t *curEvent) { gameStatus._gameOverFl = true; break; case INIT_HH_COORD: // act22: Initialize an object to hero's actual coords - _vm->_object->_objects[action->a22.objIndex]._x = _vm->_hero->_x; - _vm->_object->_objects[action->a22.objIndex]._y = _vm->_hero->_y; - _vm->_object->_objects[action->a22.objIndex]._screenIndex = *_vm->_screen_p;// Don't forget screen! + _vm->_object->_objects[action->_a22._objIndex]._x = _vm->_hero->_x; + _vm->_object->_objects[action->_a22._objIndex]._y = _vm->_hero->_y; + _vm->_object->_objects[action->_a22._objIndex]._screenIndex = *_vm->_screen_p;// Don't forget screen! break; case EXIT: // act23: Exit game back to DOS _vm->endGame(); break; case BONUS: // act24: Get bonus score for action - processBonus(action->a24.pointIndex); + processBonus(action->_a24._pointIndex); break; case COND_BOX: // act25: Conditional on bounding box - obj1 = &_vm->_object->_objects[action->a25.objIndex]; + obj1 = &_vm->_object->_objects[action->_a25._objIndex]; dx = obj1->_x + obj1->_currImagePtr->_x1; dy = obj1->_y + obj1->_currImagePtr->_y2; - if ((dx >= action->a25.x1) && (dx <= action->a25.x2) && - (dy >= action->a25.y1) && (dy <= action->a25.y2)) - insertActionList(action->a25.actPassIndex); + if ((dx >= action->_a25._x1) && (dx <= action->_a25._x2) && + (dy >= action->_a25._y1) && (dy <= action->_a25._y2)) + insertActionList(action->_a25._actPassIndex); else - insertActionList(action->a25.actFailIndex); + insertActionList(action->_a25._actFailIndex); break; case SOUND: // act26: Play a sound (or tune) - if (action->a26.soundIndex < _vm->_tunesNbr) - _vm->_sound->playMusic(action->a26.soundIndex); + if (action->_a26._soundIndex < _vm->_tunesNbr) + _vm->_sound->playMusic(action->_a26._soundIndex); else - _vm->_sound->playSound(action->a26.soundIndex, kSoundPriorityMedium); + _vm->_sound->playSound(action->_a26._soundIndex, kSoundPriorityMedium); break; case ADD_SCORE: // act27: Add object's value to score - _vm->adjustScore(_vm->_object->_objects[action->a27.objIndex]._objValue); + _vm->adjustScore(_vm->_object->_objects[action->_a27._objIndex]._objValue); break; case SUB_SCORE: // act28: Subtract object's value from score - _vm->adjustScore(-_vm->_object->_objects[action->a28.objIndex]._objValue); + _vm->adjustScore(-_vm->_object->_objects[action->_a28._objIndex]._objValue); break; case COND_CARRY: // act29: Conditional on object being carried - if (_vm->_object->isCarried(action->a29.objIndex)) - insertActionList(action->a29.actPassIndex); + if (_vm->_object->isCarried(action->_a29._objIndex)) + insertActionList(action->_a29._actPassIndex); else - insertActionList(action->a29.actFailIndex); + insertActionList(action->_a29._actFailIndex); break; case INIT_MAZE: // act30: Enable and init maze structure _vm->_maze._enabledFl = true; - _vm->_maze._size = action->a30.mazeSize; - _vm->_maze._x1 = action->a30.x1; - _vm->_maze._y1 = action->a30.y1; - _vm->_maze._x2 = action->a30.x2; - _vm->_maze._y2 = action->a30.y2; - _vm->_maze._x3 = action->a30.x3; - _vm->_maze._x4 = action->a30.x4; - _vm->_maze._firstScreenIndex = action->a30.firstScreenIndex; + _vm->_maze._size = action->_a30._mazeSize; + _vm->_maze._x1 = action->_a30._x1; + _vm->_maze._y1 = action->_a30._y1; + _vm->_maze._x2 = action->_a30._x2; + _vm->_maze._y2 = action->_a30._y2; + _vm->_maze._x3 = action->_a30._x3; + _vm->_maze._x4 = action->_a30._x4; + _vm->_maze._firstScreenIndex = action->_a30._firstScreenIndex; break; case EXIT_MAZE: // act31: Disable maze mode _vm->_maze._enabledFl = false; break; case INIT_PRIORITY: - _vm->_object->_objects[action->a32.objIndex]._priority = action->a32.priority; + _vm->_object->_objects[action->_a32._objIndex]._priority = action->_a32._priority; break; case INIT_SCREEN: - _vm->_object->_objects[action->a33.objIndex]._screenIndex = action->a33.screenIndex; + _vm->_object->_objects[action->_a33._objIndex]._screenIndex = action->_a33._screenIndex; break; case AGSCHEDULE: // act34: Schedule a (global) action list - insertActionList(action->a34.actIndex); + insertActionList(action->_a34._actIndex); break; case REMAPPAL: // act35: Remap a palette color - _vm->_screen->remapPal(action->a35.oldColorIndex, action->a35.newColorIndex); + _vm->_screen->remapPal(action->_a35._oldColorIndex, action->_a35._newColorIndex); break; case COND_NOUN: // act36: Conditional on noun mentioned - if (_vm->_parser->isWordPresent(_vm->_text->getNounArray(action->a36.nounIndex))) - insertActionList(action->a36.actPassIndex); + if (_vm->_parser->isWordPresent(_vm->_text->getNounArray(action->_a36._nounIndex))) + insertActionList(action->_a36._actPassIndex); else - insertActionList(action->a36.actFailIndex); + insertActionList(action->_a36._actFailIndex); break; case SCREEN_STATE: // act37: Set new screen state - _vm->_screenStates[action->a37.screenIndex] = action->a37.newState; + _vm->_screenStates[action->_a37._screenIndex] = action->_a37._newState; break; case INIT_LIPS: // act38: Position lips on object - _vm->_object->_objects[action->a38.lipsObjIndex]._x = _vm->_object->_objects[action->a38.objIndex]._x + action->a38.dxLips; - _vm->_object->_objects[action->a38.lipsObjIndex]._y = _vm->_object->_objects[action->a38.objIndex]._y + action->a38.dyLips; - _vm->_object->_objects[action->a38.lipsObjIndex]._screenIndex = *_vm->_screen_p; // Don't forget screen! - _vm->_object->_objects[action->a38.lipsObjIndex]._cycling = kCycleForward; + _vm->_object->_objects[action->_a38._lipsObjIndex]._x = _vm->_object->_objects[action->_a38._objIndex]._x + action->_a38._dxLips; + _vm->_object->_objects[action->_a38._lipsObjIndex]._y = _vm->_object->_objects[action->_a38._objIndex]._y + action->_a38._dyLips; + _vm->_object->_objects[action->_a38._lipsObjIndex]._screenIndex = *_vm->_screen_p; // Don't forget screen! + _vm->_object->_objects[action->_a38._lipsObjIndex]._cycling = kCycleForward; break; case INIT_STORY_MODE: // act39: Init story_mode flag // This is similar to the QUIET path mode, except that it is // independant of it and it additionally disables the ">" prompt - gameStatus._storyModeFl = action->a39.storyModeFl; + gameStatus._storyModeFl = action->_a39._storyModeFl; break; case WARN: // act40: Text box (CF TEXT) - Utils::notifyBox(_vm->_file->fetchString(action->a40.stringIndex)); + Utils::notifyBox(_vm->_file->fetchString(action->_a40._stringIndex)); break; case COND_BONUS: // act41: Perform action if got bonus - if (_points[action->a41.BonusIndex].scoredFl) - insertActionList(action->a41.actPassIndex); + if (_points[action->_a41._bonusIndex]._scoredFl) + insertActionList(action->_a41._actPassIndex); else - insertActionList(action->a41.actFailIndex); + insertActionList(action->_a41._actFailIndex); break; case TEXT_TAKE: // act42: Text box with "take" message - Utils::notifyBox(Common::String::format(TAKE_TEXT, _vm->_text->getNoun(_vm->_object->_objects[action->a42.objIndex]._nounIndex, TAKE_NAME))); + Utils::notifyBox(Common::String::format(TAKE_TEXT, _vm->_text->getNoun(_vm->_object->_objects[action->_a42._objIndex]._nounIndex, TAKE_NAME))); break; case YESNO: // act43: Prompt user for Yes or No - if (Utils::yesNoBox(_vm->_file->fetchString(action->a43.promptIndex))) - insertActionList(action->a43.actYesIndex); + if (Utils::yesNoBox(_vm->_file->fetchString(action->_a43._promptIndex))) + insertActionList(action->_a43._actYesIndex); else - insertActionList(action->a43.actNoIndex); + insertActionList(action->_a43._actNoIndex); break; case STOP_ROUTE: // act44: Stop any route in progress _vm->_route->resetRoute(); break; case COND_ROUTE: // act45: Conditional on route in progress - if (_vm->_route->getRouteIndex() >= action->a45.routeIndex) - insertActionList(action->a45.actPassIndex); + if (_vm->_route->getRouteIndex() >= action->_a45._routeIndex) + insertActionList(action->_a45._actPassIndex); else - insertActionList(action->a45.actFailIndex); + insertActionList(action->_a45._actFailIndex); break; case INIT_JUMPEXIT: // act46: Init status.jumpexit flag // This is to allow left click on exit to get there immediately // For example the plane crash in Hugo2 where hero is invisible // Couldn't use INVISIBLE flag since conflicts with boat in Hugo1 - _vm->_mouse->setJumpExitFl(action->a46.jumpExitFl); + _vm->_mouse->setJumpExitFl(action->_a46._jumpExitFl); break; - case INIT_VIEW: // act47: Init object.viewx, viewy, dir - _vm->_object->_objects[action->a47.objIndex]._viewx = action->a47.viewx; - _vm->_object->_objects[action->a47.objIndex]._viewy = action->a47.viewy; - _vm->_object->_objects[action->a47.objIndex]._direction = action->a47.direction; + case INIT_VIEW: // act47: Init object._viewx, viewy, dir + _vm->_object->_objects[action->_a47._objIndex]._viewx = action->_a47._viewx; + _vm->_object->_objects[action->_a47._objIndex]._viewy = action->_a47._viewy; + _vm->_object->_objects[action->_a47._objIndex]._direction = action->_a47._direction; break; case INIT_OBJ_FRAME: // act48: Set seq,frame number to use // Note: Don't set a sequence at time 0 of a new screen, it causes // problems clearing the boundary bits of the object! t>0 is safe - _vm->_object->_objects[action->a48.objIndex]._currImagePtr = _vm->_object->_objects[action->a48.objIndex]._seqList[action->a48.seqIndex]._seqPtr; - for (dx = 0; dx < action->a48.frameIndex; dx++) - _vm->_object->_objects[action->a48.objIndex]._currImagePtr = _vm->_object->_objects[action->a48.objIndex]._currImagePtr->_nextSeqPtr; + _vm->_object->_objects[action->_a48._objIndex]._currImagePtr = _vm->_object->_objects[action->_a48._objIndex]._seqList[action->_a48._seqIndex]._seqPtr; + for (dx = 0; dx < action->_a48._frameIndex; dx++) + _vm->_object->_objects[action->_a48._objIndex]._currImagePtr = _vm->_object->_objects[action->_a48._objIndex]._currImagePtr->_nextSeqPtr; break; case OLD_SONG: // Replaces ACT26 for DOS games. - _vm->_sound->_DOSSongPtr = _vm->_text->getTextData(action->a49.songIndex); + _vm->_sound->_DOSSongPtr = _vm->_text->getTextData(action->_a49._songIndex); break; default: error("An error has occurred: %s", "doAction"); break; } - if (action->a0.actType == NEW_SCREEN) { // New_screen() deletes entire list + if (action->_a0._actType == NEW_SCREEN) { // New_screen() deletes entire list return 0; // next_p = 0 since list now empty } else { - wrkEvent = curEvent->nextEvent; + wrkEvent = curEvent->_nextEvent; delQueue(curEvent); // Return event to free list return wrkEvent; // Return next event ptr } @@ -1445,37 +1445,37 @@ void Scheduler::delQueue(event_t *curEvent) { debugC(4, kDebugSchedule, "delQueue()"); if (curEvent == _headEvent) { // If p was the head ptr - _headEvent = curEvent->nextEvent; // then make new head_p + _headEvent = curEvent->_nextEvent; // then make new head_p } else { // Unlink p - curEvent->prevEvent->nextEvent = curEvent->nextEvent; - if (curEvent->nextEvent) - curEvent->nextEvent->prevEvent = curEvent->prevEvent; + curEvent->_prevEvent->_nextEvent = curEvent->_nextEvent; + if (curEvent->_nextEvent) + curEvent->_nextEvent->_prevEvent = curEvent->_prevEvent; else - _tailEvent = curEvent->prevEvent; + _tailEvent = curEvent->_prevEvent; } if (_headEvent) - _headEvent->prevEvent = 0; // Mark end of list + _headEvent->_prevEvent = 0; // Mark end of list else _tailEvent = 0; // Empty queue - curEvent->nextEvent = _freeEvent; // Return p to free list + curEvent->_nextEvent = _freeEvent; // Return p to free list if (_freeEvent) // Special case, if free list was empty - _freeEvent->prevEvent = curEvent; + _freeEvent->_prevEvent = curEvent; _freeEvent = curEvent; } /** * Delete all the active events of a given type */ -void Scheduler::delEventType(const 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; while (wrkEvent) { // While events found in list - saveEvent = wrkEvent->nextEvent; - if (wrkEvent->action->a20.actType == actTypeDel) + saveEvent = wrkEvent->_nextEvent; + if (wrkEvent->_action->_a20._actType == _actTypeDel) delQueue(wrkEvent); wrkEvent = saveEvent; } @@ -1486,8 +1486,8 @@ void Scheduler::delEventType(const action_t actTypeDel) { */ void Scheduler::savePoints(Common::WriteStream *out) const { for (int i = 0; i < _numBonuses; i++) { - out->writeByte(_points[i].score); - out->writeByte((_points[i].scoredFl) ? 1 : 0); + out->writeByte(_points[i]._score); + out->writeByte((_points[i]._scoredFl) ? 1 : 0); } } @@ -1497,8 +1497,8 @@ void Scheduler::savePoints(Common::WriteStream *out) const { void Scheduler::restorePoints(Common::ReadStream *in) { // Restore points table for (int i = 0; i < _numBonuses; i++) { - _points[i].score = in->readByte(); - _points[i].scoredFl = (in->readByte() == 1); + _points[i]._score = in->readByte(); + _points[i]._scoredFl = (in->readByte() == 1); } } @@ -1527,27 +1527,27 @@ void Scheduler_v1d::runScheduler() { uint32 ticker = getTicks(); // The time now, in ticks event_t *curEvent = _headEvent; // The earliest event - while (curEvent && (curEvent->time <= ticker)) // While mature events found + while (curEvent && (curEvent->_time <= ticker)) // While mature events found curEvent = doAction(curEvent); // Perform the action (returns next_p) } void Scheduler_v1d::promptAction(act *action) { Common::String response; - response = Utils::promptBox(_vm->_file->fetchString(action->a3.promptIndex)); + response = Utils::promptBox(_vm->_file->fetchString(action->_a3._promptIndex)); response.toLowercase(); char resp[256]; Common::strlcpy(resp, response.c_str(), 256); - if (action->a3.encodedFl) + if (action->_a3._encodedFl) decodeString(resp); - if (strstr(resp, _vm->_file->fetchString(action->a3.responsePtr[0]))) - insertActionList(action->a3.actPassIndex); + if (strstr(resp, _vm->_file->fetchString(action->_a3._responsePtr[0]))) + insertActionList(action->_a3._actPassIndex); else - insertActionList(action->a3.actFailIndex); + insertActionList(action->_a3._actFailIndex); } /** @@ -1577,24 +1577,24 @@ const char *Scheduler_v2d::getCypher() const { void Scheduler_v2d::promptAction(act *action) { Common::String response; - response = Utils::promptBox(_vm->_file->fetchString(action->a3.promptIndex)); + response = Utils::promptBox(_vm->_file->fetchString(action->_a3._promptIndex)); response.toLowercase(); - debug(1, "doAction(act3), expecting answer %s", _vm->_file->fetchString(action->a3.responsePtr[0])); + debug(1, "doAction(act3), expecting answer %s", _vm->_file->fetchString(action->_a3._responsePtr[0])); bool found = false; const char *tmpStr; // General purpose string ptr - for (int dx = 0; !found && (action->a3.responsePtr[dx] != -1); dx++) { - tmpStr = _vm->_file->fetchString(action->a3.responsePtr[dx]); + for (int dx = 0; !found && (action->_a3._responsePtr[dx] != -1); dx++) { + tmpStr = _vm->_file->fetchString(action->_a3._responsePtr[dx]); if (response.contains(tmpStr)) found = true; } if (found) - insertActionList(action->a3.actPassIndex); + insertActionList(action->_a3._actPassIndex); else - insertActionList(action->a3.actFailIndex); + insertActionList(action->_a3._actFailIndex); } /** @@ -1641,9 +1641,9 @@ void Scheduler_v1w::runScheduler() { uint32 ticker = getTicks(); // The time now, in ticks event_t *curEvent = _headEvent; // The earliest event - while (curEvent && (curEvent->time <= ticker)) // While mature events found + while (curEvent && (curEvent->_time <= ticker)) // While mature events found curEvent = doAction(curEvent); // Perform the action (returns next_p) - _vm->getGameStatus()._tick++; // Accessed elsewhere via getTicks() + _vm->getGameStatus()._tick++; // Accessed elsewhere via getTicks() } } // End of namespace Hugo diff --git a/engines/hugo/schedule.h b/engines/hugo/schedule.h index 60d51f0673..74a65a5c64 100644 --- a/engines/hugo/schedule.h +++ b/engines/hugo/schedule.h @@ -93,424 +93,425 @@ enum action_t { // Parameters: }; struct act0 { // Type 0 - Schedule - action_t actType; // The type of action - int timer; // Time to set off the action - uint16 actIndex; // Ptr to an action list + action_t _actType; // The type of action + int _timer; // Time to set off the action + uint16 _actIndex; // Ptr to an action list }; struct act1 { // Type 1 - Start an object - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex; // The object number - int cycleNumb; // Number of times to cycle - cycle_t cycle; // Direction to start cycling + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex; // The object number + int _cycleNumb; // Number of times to cycle + cycle_t _cycle; // Direction to start cycling }; struct act2 { // Type 2 - Initialize an object coords - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex; // The object number - int x, y; // Coordinates + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex; // The object number + int _x, _y; // Coordinates }; struct act3 { // Type 3 - Prompt user for text - action_t actType; // The type of action - int timer; // Time to set off the action - uint16 promptIndex; // Index of prompt string - int *responsePtr; // Array of indexes to valid response string(s) (terminate list with -1) - uint16 actPassIndex; // Ptr to action list if success - uint16 actFailIndex; // Ptr to action list if failure - bool encodedFl; // (HUGO 1 DOS ONLY) Whether response is encoded or not + action_t _actType; // The type of action + int _timer; // Time to set off the action + uint16 _promptIndex; // Index of prompt string + int *_responsePtr; // Array of indexes to valid response string(s) (terminate list with -1) + uint16 _actPassIndex; // Ptr to action list if success + uint16 _actFailIndex; // Ptr to action list if failure + bool _encodedFl; // (HUGO 1 DOS ONLY) Whether response is encoded or not }; struct act4 { // Type 4 - Set new background color - action_t actType; // The type of action - int timer; // Time to set off the action - long newBackgroundColor; // New color + action_t _actType; // The type of action + int _timer; // Time to set off the action + long _newBackgroundColor; // New color }; struct act5 { // Type 5 - Initialize an object velocity - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex; // The object number - int vx, vy; // velocity + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex; // The object number + int _vx, _vy; // velocity }; struct act6 { // Type 6 - Initialize an object carrying - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex; // The object number - bool carriedFl; // carrying + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex; // The object number + bool _carriedFl; // carrying }; struct act7 { // Type 7 - Initialize an object to hero's coords - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex; // The object number + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex; // The object number }; struct act8 { // Type 8 - switch to new screen - action_t actType; // The type of action - int timer; // Time to set off the action - int screenIndex; // The new screen number + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _screenIndex; // The new screen number }; struct act9 { // Type 9 - Initialize an object state - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex; // The object number - byte newState; // New state + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex; // The object number + byte _newState; // New state }; struct act10 { // Type 10 - Initialize an object path type - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex; // The object number - int newPathType; // New path type - int8 vxPath, vyPath; // Max delta velocities e.g. for CHASE + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex; // The object number + int _newPathType; // New path type + int8 _vxPath, _vyPath; // Max delta velocities e.g. for CHASE }; struct act11 { // Type 11 - Conditional on object's state - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex; // The object number - byte stateReq; // Required state - uint16 actPassIndex; // Ptr to action list if success - uint16 actFailIndex; // Ptr to action list if failure + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex; // The object number + byte _stateReq; // Required state + uint16 _actPassIndex; // Ptr to action list if success + uint16 _actFailIndex; // Ptr to action list if failure }; struct act12 { // Type 12 - Simple text box - action_t actType; // The type of action - int timer; // Time to set off the action - int stringIndex; // Index (enum) of string in strings.dat + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _stringIndex; // Index (enum) of string in strings.dat }; struct act13 { // Type 13 - Swap first object image with second - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex1; // Index of first object - int objIndex2; // 2nd + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex1; // Index of first object + int _objIndex2; // 2nd }; struct act14 { // Type 14 - Conditional on current screen - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex; // The required object - int screenReq; // The required screen number - uint16 actPassIndex; // Ptr to action list if success - uint16 actFailIndex; // Ptr to action list if failure + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex; // The required object + int _screenReq; // The required screen number + uint16 _actPassIndex; // Ptr to action list if success + uint16 _actFailIndex; // Ptr to action list if failure }; struct act15 { // Type 15 - Home in on an object - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex1; // The object number homing in - int objIndex2; // The object number to home in on - int8 dx, dy; // Max delta velocities + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex1; // The object number homing in + int _objIndex2; // The object number to home in on + int8 _dx, _dy; // Max delta velocities }; + // Note: Don't set a sequence at time 0 of a new screen, it causes // problems clearing the boundary bits of the object! timer > 0 is safe struct act16 { // Type 16 - Set curr_seq_p to seq - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex; // The object number - int seqIndex; // The index of seq array to set to + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex; // The object number + int _seqIndex; // The index of seq array to set to }; struct act17 { // Type 17 - SET obj individual state bits - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex; // The object number - int stateMask; // The mask to OR with current obj state + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex; // The object number + int _stateMask; // The mask to OR with current obj state }; struct act18 { // Type 18 - CLEAR obj individual state bits - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex; // The object number - int stateMask; // The mask to ~AND with current obj state + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex; // The object number + int _stateMask; // The mask to ~AND with current obj state }; struct act19 { // Type 19 - TEST obj individual state bits - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex; // The object number - int stateMask; // The mask to AND with current obj state - uint16 actPassIndex; // Ptr to action list (all bits set) - uint16 actFailIndex; // Ptr to action list (not all set) + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex; // The object number + int _stateMask; // The mask to AND with current obj state + uint16 _actPassIndex; // Ptr to action list (all bits set) + uint16 _actFailIndex; // Ptr to action list (not all set) }; struct act20 { // Type 20 - Remove all events with this type of action - action_t actType; // The type of action - int timer; // Time to set off the action - action_t actTypeDel; // The action type to remove + action_t _actType; // The type of action + int _timer; // Time to set off the action + action_t _actTypeDel; // The action type to remove }; struct act21 { // Type 21 - Gameover. Disable hero & commands - action_t actType; // The type of action - int timer; // Time to set off the action + action_t _actType; // The type of action + int _timer; // Time to set off the action }; struct act22 { // Type 22 - Initialize an object to hero's coords - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex; // The object number + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex; // The object number }; struct act23 { // Type 23 - Exit game back to DOS - action_t actType; // The type of action - int timer; // Time to set off the action + action_t _actType; // The type of action + int _timer; // Time to set off the action }; struct act24 { // Type 24 - Get bonus score - action_t actType; // The type of action - int timer; // Time to set off the action - int pointIndex; // Index into points array + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _pointIndex; // Index into points array }; struct act25 { // Type 25 - Conditional on bounding box - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex; // The required object number - int x1, y1, x2, y2; // The bounding box - uint16 actPassIndex; // Ptr to action list if success - uint16 actFailIndex; // Ptr to action list if failure + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex; // The required object number + int _x1, _y1, _x2, _y2; // The bounding box + uint16 _actPassIndex; // Ptr to action list if success + uint16 _actFailIndex; // Ptr to action list if failure }; struct act26 { // Type 26 - Play a sound - action_t actType; // The type of action - int timer; // Time to set off the action - int16 soundIndex; // Sound index in data file + action_t _actType; // The type of action + int _timer; // Time to set off the action + int16 _soundIndex; // Sound index in data file }; struct act27 { // Type 27 - Add object's value to score - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex; // object number + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex; // object number }; struct act28 { // Type 28 - Subtract object's value from score - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex; // object number + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex; // object number }; struct act29 { // Type 29 - Conditional on object carried - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex; // The required object number - uint16 actPassIndex; // Ptr to action list if success - uint16 actFailIndex; // Ptr to action list if failure + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex; // The required object number + uint16 _actPassIndex; // Ptr to action list if success + uint16 _actFailIndex; // Ptr to action list if failure }; struct act30 { // Type 30 - Start special maze processing - action_t actType; // The type of action - int timer; // Time to set off the action - byte mazeSize; // Size of (square) maze - int x1, y1, x2, y2; // Bounding box of maze - int x3, x4; // Extra x points for perspective correction - byte firstScreenIndex; // First (top left) screen of maze + action_t _actType; // The type of action + int _timer; // Time to set off the action + byte _mazeSize; // Size of (square) maze + int _x1, _y1, _x2, _y2; // Bounding box of maze + int _x3, _x4; // Extra x points for perspective correction + byte _firstScreenIndex; // First (top left) screen of maze }; struct act31 { // Type 31 - Exit special maze processing - action_t actType; // The type of action - int timer; // Time to set off the action + action_t _actType; // The type of action + int _timer; // Time to set off the action }; struct act32 { // Type 32 - Init fbg field of object - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex; // The object number - byte priority; // Value of foreground/background field + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex; // The object number + byte _priority; // Value of foreground/background field }; struct act33 { // Type 33 - Init screen field of object - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex; // The object number - int screenIndex; // Screen number + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex; // The object number + int _screenIndex; // Screen number }; struct act34 { // Type 34 - Global Schedule - action_t actType; // The type of action - int timer; // Time to set off the action - uint16 actIndex; // Ptr to an action list + action_t _actType; // The type of action + int _timer; // Time to set off the action + uint16 _actIndex; // Ptr to an action list }; struct act35 { // Type 35 - Remappe palette - action_t actType; // The type of action - int timer; // Time to set off the action - int16 oldColorIndex; // Old color index, 0..15 - int16 newColorIndex; // New color index, 0..15 + action_t _actType; // The type of action + int _timer; // Time to set off the action + int16 _oldColorIndex; // Old color index, 0..15 + int16 _newColorIndex; // New color index, 0..15 }; struct act36 { // Type 36 - Conditional on noun mentioned - action_t actType; // The type of action - int timer; // Time to set off the action - uint16 nounIndex; // The required noun (list) - uint16 actPassIndex; // Ptr to action list if success - uint16 actFailIndex; // Ptr to action list if failure + action_t _actType; // The type of action + int _timer; // Time to set off the action + uint16 _nounIndex; // The required noun (list) + uint16 _actPassIndex; // Ptr to action list if success + uint16 _actFailIndex; // Ptr to action list if failure }; struct act37 { // Type 37 - Set new screen state - action_t actType; // The type of action - int timer; // Time to set off the action - int screenIndex; // The screen number - byte newState; // The new state + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _screenIndex; // The screen number + byte _newState; // The new state }; struct act38 { // Type 38 - Position lips - action_t actType; // The type of action - int timer; // Time to set off the action - int lipsObjIndex; // The LIPS object - int objIndex; // The object to speak - byte dxLips; // Relative offset of x - byte dyLips; // Relative offset of y + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _lipsObjIndex; // The LIPS object + int _objIndex; // The object to speak + byte _dxLips; // Relative offset of x + byte _dyLips; // Relative offset of y }; struct act39 { // Type 39 - Init story mode - action_t actType; // The type of action - int timer; // Time to set off the action - bool storyModeFl; // New state of story_mode flag + action_t _actType; // The type of action + int _timer; // Time to set off the action + bool _storyModeFl; // New state of story_mode flag }; struct act40 { // Type 40 - Unsolicited text box - action_t actType; // The type of action - int timer; // Time to set off the action - int stringIndex; // Index (enum) of string in strings.dat + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _stringIndex; // Index (enum) of string in strings.dat }; struct act41 { // Type 41 - Conditional on bonus scored - action_t actType; // The type of action - int timer; // Time to set off the action - int BonusIndex; // Index into bonus list - uint16 actPassIndex; // Index of the action list if scored for the first time - uint16 actFailIndex; // Index of the action list if already scored + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _bonusIndex; // Index into bonus list + uint16 _actPassIndex; // Index of the action list if scored for the first time + uint16 _actFailIndex; // Index of the action list if already scored }; struct act42 { // Type 42 - Text box with "take" string - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex; // The object taken + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex; // The object taken }; struct act43 { // Type 43 - Prompt user for Yes or No - action_t actType; // The type of action - int timer; // Time to set off the action - int promptIndex; // index of prompt string - uint16 actYesIndex; // Ptr to action list if YES - uint16 actNoIndex; // Ptr to action list if NO + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _promptIndex; // index of prompt string + uint16 _actYesIndex; // Ptr to action list if YES + uint16 _actNoIndex; // Ptr to action list if NO }; struct act44 { // Type 44 - Stop any route in progress - action_t actType; // The type of action - int timer; // Time to set off the action + action_t _actType; // The type of action + int _timer; // Time to set off the action }; struct act45 { // Type 45 - Conditional on route in progress - action_t actType; // The type of action - int timer; // Time to set off the action - int routeIndex; // Must be >= current status.rindex - uint16 actPassIndex; // Ptr to action list if en-route - uint16 actFailIndex; // Ptr to action list if not + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _routeIndex; // Must be >= current status.rindex + uint16 _actPassIndex; // Ptr to action list if en-route + uint16 _actFailIndex; // Ptr to action list if not }; struct act46 { // Type 46 - Init status.jumpexit - action_t actType; // The type of action - int timer; // Time to set off the action - bool jumpExitFl; // New state of jumpexit flag + action_t _actType; // The type of action + int _timer; // Time to set off the action + bool _jumpExitFl; // New state of jumpexit flag }; struct act47 { // Type 47 - Init viewx,viewy,dir - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex; // The object - int16 viewx; // object.viewx - int16 viewy; // object.viewy - int16 direction; // object.dir + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex; // The object + int16 _viewx; // object.viewx + int16 _viewy; // object.viewy + int16 _direction; // object.dir }; struct act48 { // Type 48 - Set curr_seq_p to frame n - action_t actType; // The type of action - int timer; // Time to set off the action - int objIndex; // The object number - int seqIndex; // The index of seq array to set to - int frameIndex; // The index of frame to set to + action_t _actType; // The type of action + int _timer; // Time to set off the action + int _objIndex; // The object number + int _seqIndex; // The index of seq array to set to + int _frameIndex; // The index of frame to set to }; -struct act49 { // Added by Strangerke - Type 79 - Play a song (DOS way) - action_t actType; // The type of action - int timer; // Time to set off the action - uint16 songIndex; // Song index in string array +struct act49 { // Added by Strangerke - Type 49 - Play a song (DOS way) + action_t _actType; // The type of action + int _timer; // Time to set off the action + uint16 _songIndex; // Song index in string array }; union act { - act0 a0; - act1 a1; - act2 a2; - act3 a3; - act4 a4; - act5 a5; - act6 a6; - act7 a7; - act8 a8; - act9 a9; - act10 a10; - act11 a11; - act12 a12; - act13 a13; - act14 a14; - act15 a15; - act16 a16; - act17 a17; - act18 a18; - act19 a19; - act20 a20; - act21 a21; - act22 a22; - act23 a23; - act24 a24; - act25 a25; - act26 a26; - act27 a27; - act28 a28; - act29 a29; - act30 a30; - act31 a31; - act32 a32; - act33 a33; - act34 a34; - act35 a35; - act36 a36; - act37 a37; - act38 a38; - act39 a39; - act40 a40; - act41 a41; - act42 a42; - act43 a43; - act44 a44; - act45 a45; - act46 a46; - act47 a47; - act48 a48; - act49 a49; + act0 _a0; + act1 _a1; + act2 _a2; + act3 _a3; + act4 _a4; + act5 _a5; + act6 _a6; + act7 _a7; + act8 _a8; + act9 _a9; + act10 _a10; + act11 _a11; + act12 _a12; + act13 _a13; + act14 _a14; + act15 _a15; + act16 _a16; + act17 _a17; + act18 _a18; + act19 _a19; + act20 _a20; + act21 _a21; + act22 _a22; + act23 _a23; + act24 _a24; + act25 _a25; + act26 _a26; + act27 _a27; + act28 _a28; + act29 _a29; + act30 _a30; + act31 _a31; + act32 _a32; + act33 _a33; + act34 _a34; + act35 _a35; + act36 _a36; + act37 _a37; + act38 _a38; + act39 _a39; + act40 _a40; + act41 _a41; + act42 _a42; + act43 _a43; + act44 _a44; + act45 _a45; + act46 _a46; + act47 _a47; + act48 _a48; + act49 _a49; }; struct event_t { - act *action; // Ptr to action to perform - bool localActionFl; // true if action is only for this screen - uint32 time; // (absolute) time to perform action - struct event_t *prevEvent; // Chain to previous event - struct event_t *nextEvent; // Chain to next event + act *_action; // Ptr to action to perform + bool _localActionFl; // true if action is only for this screen + uint32 _time; // (absolute) time to perform action + struct event_t *_prevEvent; // Chain to previous event + struct event_t *_nextEvent; // Chain to next event }; /** * Following are points for achieving certain actions. */ struct point_t { - byte score; // The value of the point - bool scoredFl; // Whether scored yet + byte _score; // The value of the point + bool _scoredFl; // Whether scored yet }; class Scheduler { diff --git a/engines/hugo/sound.cpp b/engines/hugo/sound.cpp index eed4164d5e..463a19ae8c 100644 --- a/engines/hugo/sound.cpp +++ b/engines/hugo/sound.cpp @@ -162,16 +162,16 @@ void SoundHandler::stopMusic() { * Turn music on and off */ void SoundHandler::toggleMusic() { - _vm->_config.musicFl = !_vm->_config.musicFl; + _vm->_config._musicFl = !_vm->_config._musicFl; - _midiPlayer->pause(!_vm->_config.musicFl); + _midiPlayer->pause(!_vm->_config._musicFl); } /** * Turn digitized sound on and off */ void SoundHandler::toggleSound() { - _vm->_config.soundFl = !_vm->_config.soundFl; + _vm->_config._soundFl = !_vm->_config._soundFl; } void SoundHandler::playMIDI(sound_pt seq_p, uint16 size) { @@ -185,7 +185,7 @@ void SoundHandler::playMusic(int16 tune) { sound_pt seqPtr; // Sequence data from file uint16 size; // Size of sequence data - if (_vm->_config.musicFl) { + if (_vm->_config._musicFl) { _vm->getGameStatus()._song = tune; seqPtr = _vm->_file->getSound(tune, &size); playMIDI(seqPtr, size); @@ -203,7 +203,7 @@ void SoundHandler::playSound(int16 sound, const byte priority) { uint16 size; // Size of data // Sound disabled - if (!_vm->_config.soundFl || !_vm->_mixer->isReady()) + if (!_vm->_config._soundFl || !_vm->_mixer->isReady()) return; syncVolume(); @@ -270,7 +270,7 @@ void SoundHandler::pcspkr_player() { static const uint16 pcspkrFlats[8] = {1435, 1279, 2342, 2150, 1916, 1755, 1611}; // The flats, Ab to Bb // Does the user not want any sound? - if (!_vm->_config.soundFl || !_vm->_mixer->isReady()) + if (!_vm->_config._soundFl || !_vm->_mixer->isReady()) return; // Is there no song? -- cgit v1.2.3 From 999ae29de43444118b5990a272a98031c4707ee0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 13 Jun 2012 20:58:01 +0200 Subject: HUGO: Rename structs and enums --- engines/hugo/display.cpp | 48 ++++++------- engines/hugo/display.h | 52 +++++++------- engines/hugo/file.cpp | 36 +++++----- engines/hugo/file.h | 32 ++++----- engines/hugo/file_v1d.cpp | 10 +-- engines/hugo/file_v1w.cpp | 8 +-- engines/hugo/file_v2d.cpp | 14 ++-- engines/hugo/file_v3d.cpp | 14 ++-- engines/hugo/game.h | 38 +++++----- engines/hugo/hugo.cpp | 12 ++-- engines/hugo/hugo.h | 68 +++++++++--------- engines/hugo/inventory.cpp | 10 +-- engines/hugo/inventory.h | 10 +-- engines/hugo/mouse.cpp | 24 +++---- engines/hugo/mouse.h | 6 +- engines/hugo/object.cpp | 74 ++++++++++---------- engines/hugo/object.h | 38 +++++----- engines/hugo/object_v1d.cpp | 42 +++++------ engines/hugo/object_v1w.cpp | 38 +++++----- engines/hugo/object_v2d.cpp | 38 +++++----- engines/hugo/object_v3d.cpp | 18 ++--- engines/hugo/parser.cpp | 20 +++--- engines/hugo/parser.h | 42 +++++------ engines/hugo/parser_v1d.cpp | 28 ++++---- engines/hugo/parser_v1w.cpp | 10 +-- engines/hugo/parser_v2d.cpp | 4 +- engines/hugo/parser_v3d.cpp | 30 ++++---- engines/hugo/route.cpp | 30 ++++---- engines/hugo/route.h | 18 ++--- engines/hugo/schedule.cpp | 72 +++++++++---------- engines/hugo/schedule.h | 166 ++++++++++++++++++++++---------------------- engines/hugo/sound.cpp | 4 +- 32 files changed, 527 insertions(+), 527 deletions(-) (limited to 'engines/hugo') diff --git a/engines/hugo/display.cpp b/engines/hugo/display.cpp index 12a9edfbb7..34b0303eee 100644 --- a/engines/hugo/display.cpp +++ b/engines/hugo/display.cpp @@ -105,23 +105,23 @@ Screen::Screen(HugoEngine *vm) : _vm(vm) { Screen::~Screen() { } -icondib_t &Screen::getIconBuffer() { +Icondib &Screen::getIconBuffer() { return _iconBuffer; } -viewdib_t &Screen::getBackBuffer() { +Viewdib &Screen::getBackBuffer() { return _backBuffer; } -viewdib_t &Screen::getBackBufferBackup() { +Viewdib &Screen::getBackBufferBackup() { return _backBufferBackup; } -viewdib_t &Screen::getFrontBuffer() { +Viewdib &Screen::getFrontBuffer() { return _frontBuffer; } -viewdib_t &Screen::getGUIBuffer() { +Viewdib &Screen::getGUIBuffer() { return _GUIBuffer; } @@ -149,7 +149,7 @@ void Screen::initDisplay() { /** * Move an image from source to destination */ -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) { +void Screen::moveImage(ImagePtr srcImage, const int16 x1, const int16 y1, const int16 dx, int16 dy, const int16 width1, ImagePtr 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 @@ -236,14 +236,14 @@ void Screen::setBackgroundColor(const uint16 color) { * Merge an object frame into _frontBuffer at sx, sy and update rectangle list. * If fore TRUE, force object above any overlay */ -void Screen::displayFrame(const int sx, const int sy, seq_t *seq, const bool foreFl) { +void Screen::displayFrame(const int sx, const int sy, Seq *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 - image_pt subFrontBuffer = &_frontBuffer[sy * kXPix + sx]; // Ptr to offset in _frontBuffer + ImagePtr image = seq->_imagePtr; // Ptr to object image data + ImagePtr subFrontBuffer = &_frontBuffer[sy * kXPix + sx]; // Ptr to offset in _frontBuffer int16 frontBufferwrap = kXPix - seq->_x2 - 1; // Wraps dest_p after each line int16 imageWrap = seq->_bytesPerLine8 - seq->_x2 - 1; - overlayState_t overlayState = (foreFl) ? kOvlForeground : kOvlUndef; // Overlay state of object + OverlayState overlayState = (foreFl) ? kOvlForeground : kOvlUndef; // Overlay state of object for (uint16 y = 0; y < seq->_lines; y++) { // Each line in object for (uint16 x = 0; x <= seq->_x2; x++) { if (*image) { // Non-transparent @@ -271,7 +271,7 @@ void Screen::displayFrame(const int sx, const int sy, seq_t *seq, const bool for /** * Merge rectangles A,B leaving result in B */ -void Screen::merge(const rect_t *rectA, rect_t *rectB) { +void Screen::merge(const Rect *rectA, Rect *rectB) { debugC(6, kDebugDisplay, "merge()"); int16 xa = rectA->_x + rectA->_dx; // Find x2,y2 for each rectangle @@ -291,7 +291,7 @@ void Screen::merge(const 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, const int16 len, int16 blen) { +int16 Screen::mergeLists(Rect *list, Rect *blist, const int16 len, int16 blen) { debugC(4, kDebugDisplay, "mergeLists()"); int16 coalesce[kBlitListSize]; // List of overlapping rects @@ -299,7 +299,7 @@ int16 Screen::mergeLists(rect_t *list, rect_t *blist, const int16 len, int16 ble for (int16 a = 0; a < len; a++, list++) { // Compile list of overlapping rectangles in blit list int16 c = 0; - rect_t *bp = blist; + Rect *bp = blist; for (int16 b = 0; b < blen; b++, bp++) { if (bp->_dx) // blist entry used if (isOverlapping(list, bp)) @@ -316,7 +316,7 @@ int16 Screen::mergeLists(rect_t *list, rect_t *blist, const int16 len, int16 ble // Merge any more blist entries while (--c) { - rect_t *cp = &blist[coalesce[c]]; + Rect *cp = &blist[coalesce[c]]; merge(cp, bp); cp->_dx = 0; // Delete entry } @@ -329,12 +329,12 @@ int16 Screen::mergeLists(rect_t *list, rect_t *blist, const int16 len, int16 ble * Process the display list * Trailing args are int16 x,y,dx,dy for the D_ADD operation */ -void Screen::displayList(dupdate_t update, ...) { +void Screen::displayList(Dupdate update, ...) { debugC(6, kDebugDisplay, "displayList()"); int16 blitLength = 0; // Length of blit list va_list marker; // Args used for D_ADD operation - rect_t *p; // Ptr to dlist entry + Rect *p; // Ptr to dlist entry switch (update) { case kDisplayInit: // Init lists, restore whole screen @@ -627,18 +627,18 @@ void Screen::hideCursor() { CursorMan.showMouse(false); } -bool Screen::isInX(const int16 x, const rect_t *rect) const { +bool Screen::isInX(const int16 x, const Rect *rect) const { return (x >= rect->_x) && (x <= rect->_x + rect->_dx); } -bool Screen::isInY(const int16 y, const rect_t *rect) const { +bool Screen::isInY(const int16 y, const Rect *rect) const { return (y >= rect->_y) && (y <= rect->_y + rect->_dy); } /** * Check if two rectangles are overlapping */ -bool Screen::isOverlapping(const rect_t *rectA, const rect_t *rectB) const { +bool Screen::isOverlapping(const Rect *rectA, const Rect *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)); } @@ -656,7 +656,7 @@ void Screen::drawBoundaries() { _vm->_mouse->drawHotspots(); for (int i = 0; i < _vm->_object->_numObj; i++) { - object_t *obj = &_vm->_object->_objects[i]; // Get pointer to object + Object *obj = &_vm->_object->_objects[i]; // Get pointer to object if (obj->_screenIndex == *_vm->_screen_p) { if ((obj->_currImagePtr != 0) && (obj->_cycling != kCycleInvisible)) drawRectangle(false, obj->_x + obj->_currImagePtr->_x1, obj->_y + obj->_currImagePtr->_y1, @@ -730,12 +730,12 @@ void Screen_v1d::loadFontArr(Common::ReadStream &in) { * processed object by looking down the current column for an overlay * base byte set (in which case the object is foreground). */ -overlayState_t Screen_v1d::findOvl(seq_t *seq_p, image_pt dst_p, uint16 y) { +OverlayState Screen_v1d::findOvl(Seq *seqPtr, ImagePtr dst_p, uint16 y) { debugC(4, kDebugDisplay, "findOvl()"); uint16 index = (uint16)(dst_p - _frontBuffer) >> 3; - for (int i = 0; i < seq_p->_lines-y; i++) { // Each line in object + for (int i = 0; i < seqPtr->_lines-y; i++) { // Each line in object if (_vm->_object->getBaseBoundary(index)) // If any overlay base byte is non-zero then the object is foreground, else back. return kOvlForeground; index += kCompLineSize; @@ -799,10 +799,10 @@ void Screen_v1w::loadFontArr(Common::ReadStream &in) { * processed object by looking down the current column for an overlay * base bit set (in which case the object is foreground). */ -overlayState_t Screen_v1w::findOvl(seq_t *seq_p, image_pt dst_p, uint16 y) { +OverlayState Screen_v1w::findOvl(Seq *seqPtr, ImagePtr dst_p, uint16 y) { debugC(4, kDebugDisplay, "findOvl()"); - for (; y < seq_p->_lines; y++) { // Each line in object + for (; y < seqPtr->_lines; y++) { // Each line in object byte ovb = _vm->_object->getBaseBoundary((uint16)(dst_p - _frontBuffer) >> 3); // Ptr into overlay bits if (ovb & (0x80 >> ((uint16)(dst_p - _frontBuffer) & 7))) // Overlay bit is set return kOvlForeground; // Found a bit - must be foreground diff --git a/engines/hugo/display.h b/engines/hugo/display.h index 0d8120e916..5fab2f18cc 100644 --- a/engines/hugo/display.h +++ b/engines/hugo/display.h @@ -31,14 +31,14 @@ #define HUGO_DISPLAY_H namespace Hugo { -enum overlayState_t {kOvlUndef, kOvlForeground, kOvlBackground}; // Overlay state +enum OverlayState {kOvlUndef, kOvlForeground, kOvlBackground}; // Overlay state static const int kCenter = -1; // Used to center text in x class Screen { public: - struct rect_t { // Rectangle used in Display list + struct Rect { // Rectangle used in Display list int16 _x; // Position in dib int16 _y; // Position in dib int16 _dx; // width @@ -55,8 +55,8 @@ public: int16 stringLength(const char *s) const; void displayBackground(); - void displayFrame(const int sx, const int sy, seq_t *seq, const bool foreFl); - void displayList(dupdate_t update, ...); + void displayFrame(const int sx, const int sy, Seq *seq, const bool foreFl); + void displayList(Dupdate update, ...); void displayRect(const int16 x, const int16 y, const int16 dx, const int16 dy); void drawBoundaries(); void drawRectangle(const bool filledFl, const int16 x1, const int16 y1, const int16 x2, const int16 y2, const int color); @@ -67,7 +67,7 @@ public: void initDisplay(); void initNewScreenDisplay(); void loadPalette(Common::ReadStream &in); - void 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); + void moveImage(ImagePtr srcImage, const int16 x1, const int16 y1, const int16 dx, int16 dy, const int16 width1, ImagePtr dstImage, const int16 x2, const int16 y2, const int16 width2); void remapPal(uint16 oldIndex, uint16 newIndex); void resetInventoryObjId(); void restorePal(Common::ReadStream *f); @@ -80,11 +80,11 @@ public: void userHelp() const; void writeStr(int16 sx, const int16 sy, const char *s, const byte color); - icondib_t &getIconBuffer(); - viewdib_t &getBackBuffer(); - viewdib_t &getBackBufferBackup(); - viewdib_t &getFrontBuffer(); - viewdib_t &getGUIBuffer(); + Icondib &getIconBuffer(); + Viewdib &getBackBuffer(); + Viewdib &getBackBufferBackup(); + Viewdib &getFrontBuffer(); + Viewdib &getGUIBuffer(); protected: HugoEngine *_vm; @@ -108,37 +108,37 @@ protected: byte *_mainPalette; int16 _arrayFontSize[kNumFonts]; - viewdib_t _frontBuffer; + Viewdib _frontBuffer; - inline bool isInX(const int16 x, const rect_t *rect) const; - inline bool isInY(const int16 y, const rect_t *rect) const; - inline bool isOverlapping(const rect_t *rectA, const rect_t *rectB) const; + inline bool isInX(const int16 x, const Rect *rect) const; + inline bool isInY(const int16 y, const Rect *rect) const; + inline bool isOverlapping(const Rect *rectA, const Rect *rectB) const; - virtual overlayState_t findOvl(seq_t *seq_p, image_pt dst_p, uint16 y) = 0; + virtual OverlayState findOvl(Seq *seqPtr, ImagePtr dst_p, uint16 y) = 0; private: byte *_curPalette; byte _iconImage[kInvDx * kInvDy]; byte _paletteSize; - icondib_t _iconBuffer; // Inventory icon DIB + Icondib _iconBuffer; // Inventory icon DIB - int16 mergeLists(rect_t *list, rect_t *blist, const int16 len, int16 blen); + int16 mergeLists(Rect *list, Rect *blist, const int16 len, int16 blen); int16 center(const char *s) const; - viewdib_t _backBuffer; - viewdib_t _GUIBuffer; // User interface images - viewdib_t _backBufferBackup; // Backup _backBuffer during inventory + Viewdib _backBuffer; + Viewdib _GUIBuffer; // User interface images + Viewdib _backBufferBackup; // Backup _backBuffer during inventory // Formerly static variables used by displayList() int16 _dlAddIndex, _dlRestoreIndex; // Index into add/restore lists - rect_t _dlRestoreList[kRectListSize]; // The restore list - rect_t _dlAddList[kRectListSize]; // The add list - rect_t _dlBlistList[kBlitListSize]; // The blit list + Rect _dlRestoreList[kRectListSize]; // The restore list + Rect _dlAddList[kRectListSize]; // The add list + Rect _dlBlistList[kBlitListSize]; // The blit list // void createPal(); - void merge(const rect_t *rectA, rect_t *rectB); + void merge(const Rect *rectA, Rect *rectB); void writeChr(const int sx, const int sy, const byte color, const char *local_fontdata); }; @@ -150,7 +150,7 @@ public: void loadFont(int16 fontId); void loadFontArr(Common::ReadStream &in); protected: - overlayState_t findOvl(seq_t *seq_p, image_pt dst_p, uint16 y); + OverlayState findOvl(Seq *seqPtr, ImagePtr dst_p, uint16 y); }; class Screen_v1w : public Screen { @@ -161,7 +161,7 @@ public: void loadFont(int16 fontId); void loadFontArr(Common::ReadStream &in); protected: - overlayState_t findOvl(seq_t *seq_p, image_pt dst_p, uint16 y); + OverlayState findOvl(Seq *seqPtr, ImagePtr dst_p, uint16 y); }; } // End of namespace Hugo diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp index 219e29a25a..b78a26241b 100644 --- a/engines/hugo/file.cpp +++ b/engines/hugo/file.cpp @@ -91,8 +91,8 @@ const char *FileManager::getUifFilename() const { * Convert 4 planes (RGBI) data to 8-bit DIB format * Return original plane data ptr */ -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); +byte *FileManager::convertPCC(byte *p, const uint16 y, const uint16 bpl, ImagePtr dataPtr) const { + debugC(2, kDebugFile, "convertPCC(byte *p, %d, %d, ImagePtr data_p)", y, bpl); dataPtr += y * bpl * 8; // Point to correct DIB line for (int16 r = 0, g = bpl, b = g + bpl, i = b + bpl; r < bpl; r++, g++, b++, i++) { // Each byte in all planes @@ -107,11 +107,11 @@ byte *FileManager::convertPCC(byte *p, const uint16 y, const uint16 bpl, image_p } /** - * Read a pcx file of length len. Use supplied seq_p and image_p or - * allocate space if NULL. Name used for errors. Returns address of seq_p + * Read a pcx file of length len. Use supplied seqPtr and image_p or + * allocate space if NULL. Name used for errors. Returns address of seqPtr * Set first TRUE to initialize b_index (i.e. not reading a sequential image in file). */ -seq_t *FileManager::readPCX(Common::ReadStream &f, seq_t *seqPtr, byte *imagePtr, const bool firstFl, const char *name) { +Seq *FileManager::readPCX(Common::ReadStream &f, Seq *seqPtr, byte *imagePtr, const bool firstFl, const char *name) { debugC(1, kDebugFile, "readPCX(..., %s)", name); // Read in the PCC header and check consistency @@ -134,9 +134,9 @@ seq_t *FileManager::readPCX(Common::ReadStream &f, seq_t *seqPtr, byte *imagePtr if (_PCCHeader._mfctr != 10) error("Bad data file format: %s", name); - // Allocate memory for seq_t if 0 + // Allocate memory for Seq if 0 if (seqPtr == 0) { - if ((seqPtr = (seq_t *)malloc(sizeof(seq_t))) == 0) + if ((seqPtr = (Seq *)malloc(sizeof(Seq))) == 0) error("Insufficient memory to run game."); } @@ -182,8 +182,8 @@ seq_t *FileManager::readPCX(Common::ReadStream &f, seq_t *seqPtr, byte *imagePtr /** * Read object file of PCC images into object supplied */ -void FileManager::readImage(const int objNum, object_t *objPtr) { - debugC(1, kDebugFile, "readImage(%d, object_t *objPtr)", objNum); +void FileManager::readImage(const int objNum, Object *objPtr) { + debugC(1, kDebugFile, "readImage(%d, Object *objPtr)", objNum); /** * Structure of object file lookup entry @@ -215,7 +215,7 @@ void FileManager::readImage(const int objNum, object_t *objPtr) { } bool firstImgFl = true; // Initializes pcx read function - seq_t *seqPtr = 0; // Ptr to sequence structure + Seq *seqPtr = 0; // Ptr to sequence structure // Now read the images into an images list for (int j = 0; j < objPtr->_seqNumb; j++) { // for each sequence @@ -239,7 +239,7 @@ void FileManager::readImage(const int objNum, object_t *objPtr) { seqPtr->_y1 = seqPtr->_lines; seqPtr->_y2 = 0; - image_pt dibPtr = seqPtr->_imagePtr; + ImagePtr dibPtr = seqPtr->_imagePtr; for (int y = 0; y < seqPtr->_lines; y++, dibPtr += seqPtr->_bytesPerLine8 - x2) { for (int x = 0; x < x2; x++) { if (*dibPtr++) { // Some data found @@ -382,7 +382,7 @@ bool FileManager::saveGame(const int16 slot, const Common::String &descrip) { _vm->_object->saveObjects(out); - const status_t &gameStatus = _vm->getGameStatus(); + const Status &gameStatus = _vm->getGameStatus(); // Save whether hero image is swapped out->writeByte(_vm->_heroImage); @@ -486,7 +486,7 @@ bool FileManager::restoreGame(const int16 slot) { _vm->_object->swapImages(kHeroIndex, _vm->_heroImage); _vm->_heroImage = heroImg; - status_t &gameStatus = _vm->getGameStatus(); + Status &gameStatus = _vm->getGameStatus(); int score = in->readSint16BE(); _vm->setScore(score); @@ -514,7 +514,7 @@ bool FileManager::restoreGame(const int16 slot) { _vm->_maze._firstScreenIndex = in->readByte(); _vm->_scheduler->restoreScreen(*_vm->_screen_p); - if ((_vm->getGameStatus()._viewState = (vstate_t) in->readByte()) != kViewPlay) + if ((_vm->getGameStatus()._viewState = (Vstate) in->readByte()) != kViewPlay) _vm->_screen->hideCursor(); @@ -624,8 +624,8 @@ 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::get_UIFHeader(const uif_t id) { - debugC(1, kDebugFile, "get_UIFHeader(%d)", id); +UifHdr *FileManager::getUIFHeader(const Uif id) { + debugC(1, kDebugFile, "getUIFHeader(%d)", id); // Initialize offset lookup if not read yet if (_firstUIFFl) { @@ -660,11 +660,11 @@ void FileManager::readUIFItem(const int16 id, byte *buf) { error("File not found: %s", getUifFilename()); // Seek to data - uif_hdr_t *_UIFHeaderPtr = get_UIFHeader((uif_t)id); + UifHdr *_UIFHeaderPtr = getUIFHeader((Uif)id); ip.seek(_UIFHeaderPtr->_offset, SEEK_SET); // We support pcx images and straight data - seq_t *dummySeq; // Dummy seq_t for image data + Seq *dummySeq; // Dummy Seq for image data switch (id) { case UIF_IMAGES: // Read uif images file dummySeq = readPCX(ip, 0, buf, true, getUifFilename()); diff --git a/engines/hugo/file.h b/engines/hugo/file.h index e7c467a315..151b749ce7 100644 --- a/engines/hugo/file.h +++ b/engines/hugo/file.h @@ -34,9 +34,9 @@ namespace Hugo { /** * Enumerate overlay file types */ -enum ovl_t {kOvlBoundary, kOvlOverlay, kOvlBase}; +enum OvlType {kOvlBoundary, kOvlOverlay, kOvlBase}; -struct uif_hdr_t { // UIF font/image look up +struct UifHdr { // UIF font/image look up uint16 _size; // Size of uif item uint32 _offset; // Offset of item in file }; @@ -50,7 +50,7 @@ public: sound_pt getSound(const int16 sound, uint16 *size); void readBootFile(); - void readImage(const int objNum, object_t *objPtr); + void readImage(const int objNum, Object *objPtr); void readUIFImages(); void readUIFItem(const int16 id, byte *buf); bool restoreGame(const int16 slot); @@ -69,7 +69,7 @@ public: virtual void instructions() const = 0; virtual void readBackground(const int screenIndex) = 0; - virtual void readOverlay(const int screenNum, image_pt image, ovl_t overlayType) = 0; + virtual void readOverlay(const int screenNum, ImagePtr image, OvlType overlayType) = 0; virtual const char *fetchString(const int index) = 0; @@ -84,7 +84,7 @@ protected: /** * Structure of scenery file lookup entry */ - struct sceneBlock_t { + struct SceneBlock { uint32 _sceneOffset; uint32 _sceneLength; uint32 _boundaryOffset; @@ -95,7 +95,7 @@ protected: uint32 _baseLength; }; - struct _PCCHeader_t { // Structure of PCX file header + struct PCCHeader { // Structure of PCX file header byte _mfctr, _vers, _enc, _bpx; uint16 _x1, _y1, _x2, _y2; // bounding box uint16 _xres, _yres; @@ -106,23 +106,23 @@ protected: }; // Header of a PCC file bool _firstUIFFl; - uif_hdr_t _UIFHeader[kMaxUifs]; // Lookup for uif fonts/images + UifHdr _UIFHeader[kMaxUifs]; // Lookup for uif fonts/images Common::File _stringArchive; // Handle for string file Common::File _sceneryArchive1; // Handle for scenery file Common::File _objectsArchive; // Handle for objects file - _PCCHeader_t _PCCHeader; + PCCHeader _PCCHeader; - seq_t *readPCX(Common::ReadStream &f, seq_t *seqPtr, byte *imagePtr, const bool firstFl, const char *name); + Seq *readPCX(Common::ReadStream &f, Seq *seqPtr, byte *imagePtr, const bool firstFl, const char *name); // If this is the first call, read the lookup table bool _hasReadHeader; - sound_hdr_t _s_hdr[kMaxSounds]; // Sound lookup table + SoundHdr _s_hdr[kMaxSounds]; // Sound lookup table private: - byte *convertPCC(byte *p, const uint16 y, const uint16 bpl, image_pt dataPtr) const; - uif_hdr_t *get_UIFHeader(const uif_t id); + byte *convertPCC(byte *p, const uint16 y, const uint16 bpl, ImagePtr dataPtr) const; + UifHdr *getUIFHeader(const Uif id); //Strangerke : Not used? void printBootText(); @@ -137,7 +137,7 @@ public: virtual void instructions() const; virtual void openDatabaseFiles(); virtual void readBackground(const int screenIndex); - virtual void readOverlay(const int screenNum, image_pt image, ovl_t overlayType); + virtual void readOverlay(const int screenNum, ImagePtr image, OvlType overlayType); virtual const char *fetchString(const int index); }; @@ -149,7 +149,7 @@ public: virtual void closeDatabaseFiles(); virtual void openDatabaseFiles(); virtual void readBackground(const int screenIndex); - virtual void readOverlay(const int screenNum, image_pt image, ovl_t overlayType); + virtual void readOverlay(const int screenNum, ImagePtr image, OvlType overlayType); const char *fetchString(const int index); private: char *_fetchStringBuf; @@ -163,7 +163,7 @@ public: void closeDatabaseFiles(); void openDatabaseFiles(); void readBackground(const int screenIndex); - void readOverlay(const int screenNum, image_pt image, ovl_t overlayType); + void readOverlay(const int screenNum, ImagePtr image, OvlType overlayType); private: Common::File _sceneryArchive2; // Handle for scenery file }; @@ -181,7 +181,7 @@ public: FileManager_v1w(HugoEngine *vm); ~FileManager_v1w(); - void readOverlay(const int screenNum, image_pt image, ovl_t overlayType); + void readOverlay(const int screenNum, ImagePtr image, OvlType overlayType); }; } // End of namespace Hugo diff --git a/engines/hugo/file_v1d.cpp b/engines/hugo/file_v1d.cpp index c3bb0e275f..e42223fb13 100644 --- a/engines/hugo/file_v1d.cpp +++ b/engines/hugo/file_v1d.cpp @@ -55,11 +55,11 @@ void FileManager_v1d::closeDatabaseFiles() { /** * Open and read in an overlay file, close file */ -void FileManager_v1d::readOverlay(const int screenNum, image_pt image, const ovl_t overlayType) { +void FileManager_v1d::readOverlay(const int screenNum, ImagePtr image, const OvlType overlayType) { debugC(1, kDebugFile, "readOverlay(%d, ...)", screenNum); - const char *ovl_ext[] = {".b", ".o", ".ob"}; - Common::String buf = Common::String(_vm->_text->getScreenNames(screenNum)) + Common::String(ovl_ext[overlayType]); + const char *ovlExt[] = {".b", ".o", ".ob"}; + Common::String buf = Common::String(_vm->_text->getScreenNames(screenNum)) + Common::String(ovlExt[overlayType]); if (!Common::File::exists(buf)) { memset(image, 0, kOvlSize); @@ -70,7 +70,7 @@ void FileManager_v1d::readOverlay(const int screenNum, image_pt image, const ovl if (!_sceneryArchive1.open(buf)) error("File not found: %s", buf.c_str()); - image_pt tmpImage = image; // temp ptr to overlay file + ImagePtr tmpImage = image; // temp ptr to overlay file _sceneryArchive1.read(tmpImage, kOvlSize); _sceneryArchive1.close(); @@ -87,7 +87,7 @@ void FileManager_v1d::readBackground(const int screenIndex) { if (!_sceneryArchive1.open(buf)) error("File not found: %s", buf.c_str()); // Read the image into dummy seq and static dib_a - seq_t *dummySeq; // Image sequence structure for Read_pcx + Seq *dummySeq; // Image sequence structure for Read_pcx dummySeq = readPCX(_sceneryArchive1, 0, _vm->_screen->getFrontBuffer(), true, _vm->_text->getScreenNames(screenIndex)); free(dummySeq); _sceneryArchive1.close(); diff --git a/engines/hugo/file_v1w.cpp b/engines/hugo/file_v1w.cpp index fba13d6915..002a1dc103 100644 --- a/engines/hugo/file_v1w.cpp +++ b/engines/hugo/file_v1w.cpp @@ -45,13 +45,13 @@ FileManager_v1w::~FileManager_v1w() { /** * Open and read in an overlay file, close file */ -void FileManager_v1w::readOverlay(const int screenNum, image_pt image, ovl_t overlayType) { +void FileManager_v1w::readOverlay(const int screenNum, ImagePtr image, OvlType overlayType) { debugC(1, kDebugFile, "readOverlay(%d, ...)", screenNum); - image_pt tmpImage = image; // temp ptr to overlay file - _sceneryArchive1.seek((uint32)screenNum * sizeof(sceneBlock_t), SEEK_SET); + ImagePtr tmpImage = image; // temp ptr to overlay file + _sceneryArchive1.seek((uint32)screenNum * sizeof(SceneBlock), SEEK_SET); - sceneBlock_t sceneBlock; // Database header entry + SceneBlock sceneBlock; // Database header entry sceneBlock._sceneOffset = _sceneryArchive1.readUint32LE(); sceneBlock._sceneLength = _sceneryArchive1.readUint32LE(); sceneBlock._boundaryOffset = _sceneryArchive1.readUint32LE(); diff --git a/engines/hugo/file_v2d.cpp b/engines/hugo/file_v2d.cpp index 7239e5174a..19c90980b0 100644 --- a/engines/hugo/file_v2d.cpp +++ b/engines/hugo/file_v2d.cpp @@ -78,9 +78,9 @@ void FileManager_v2d::closeDatabaseFiles() { void FileManager_v2d::readBackground(const int screenIndex) { debugC(1, kDebugFile, "readBackground(%d)", screenIndex); - _sceneryArchive1.seek((uint32) screenIndex * sizeof(sceneBlock_t), SEEK_SET); + _sceneryArchive1.seek((uint32) screenIndex * sizeof(SceneBlock), SEEK_SET); - sceneBlock_t sceneBlock; // Read a database header entry + SceneBlock sceneBlock; // Read a database header entry sceneBlock._sceneOffset = _sceneryArchive1.readUint32LE(); sceneBlock._sceneLength = _sceneryArchive1.readUint32LE(); sceneBlock._boundaryOffset = _sceneryArchive1.readUint32LE(); @@ -93,7 +93,7 @@ void FileManager_v2d::readBackground(const int screenIndex) { _sceneryArchive1.seek(sceneBlock._sceneOffset, SEEK_SET); // Read the image into dummy seq and static dib_a - seq_t *dummySeq; // Image sequence structure for Read_pcx + Seq *dummySeq; // Image sequence structure for Read_pcx dummySeq = readPCX(_sceneryArchive1, 0, _vm->_screen->getFrontBuffer(), true, _vm->_text->getScreenNames(screenIndex)); free(dummySeq); } @@ -101,13 +101,13 @@ void FileManager_v2d::readBackground(const int screenIndex) { /** * Open and read in an overlay file, close file */ -void FileManager_v2d::readOverlay(const int screenNum, image_pt image, ovl_t overlayType) { +void FileManager_v2d::readOverlay(const int screenNum, ImagePtr image, OvlType overlayType) { debugC(1, kDebugFile, "readOverlay(%d, ...)", screenNum); - image_pt tmpImage = image; // temp ptr to overlay file - _sceneryArchive1.seek((uint32)screenNum * sizeof(sceneBlock_t), SEEK_SET); + ImagePtr tmpImage = image; // temp ptr to overlay file + _sceneryArchive1.seek((uint32)screenNum * sizeof(SceneBlock), SEEK_SET); - sceneBlock_t sceneBlock; // Database header entry + SceneBlock sceneBlock; // Database header entry sceneBlock._sceneOffset = _sceneryArchive1.readUint32LE(); sceneBlock._sceneLength = _sceneryArchive1.readUint32LE(); sceneBlock._boundaryOffset = _sceneryArchive1.readUint32LE(); diff --git a/engines/hugo/file_v3d.cpp b/engines/hugo/file_v3d.cpp index 34c745efb6..5eb0cfc2c8 100644 --- a/engines/hugo/file_v3d.cpp +++ b/engines/hugo/file_v3d.cpp @@ -50,9 +50,9 @@ FileManager_v3d::~FileManager_v3d() { void FileManager_v3d::readBackground(const int screenIndex) { debugC(1, kDebugFile, "readBackground(%d)", screenIndex); - _sceneryArchive1.seek((uint32) screenIndex * sizeof(sceneBlock_t), SEEK_SET); + _sceneryArchive1.seek((uint32) screenIndex * sizeof(SceneBlock), SEEK_SET); - sceneBlock_t sceneBlock; // Read a database header entry + SceneBlock sceneBlock; // Read a database header entry sceneBlock._sceneOffset = _sceneryArchive1.readUint32LE(); sceneBlock._sceneLength = _sceneryArchive1.readUint32LE(); sceneBlock._boundaryOffset = _sceneryArchive1.readUint32LE(); @@ -62,7 +62,7 @@ void FileManager_v3d::readBackground(const int screenIndex) { sceneBlock._baseOffset = _sceneryArchive1.readUint32LE(); sceneBlock._baseLength = _sceneryArchive1.readUint32LE(); - seq_t *dummySeq; // Image sequence structure for Read_pcx + Seq *dummySeq; // Image sequence structure for Read_pcx if (screenIndex < 20) { _sceneryArchive1.seek(sceneBlock._sceneOffset, SEEK_SET); // Read the image into dummy seq and static dib_a @@ -106,13 +106,13 @@ void FileManager_v3d::closeDatabaseFiles() { /** * Open and read in an overlay file, close file */ -void FileManager_v3d::readOverlay(const int screenNum, image_pt image, ovl_t overlayType) { +void FileManager_v3d::readOverlay(const int screenNum, ImagePtr image, OvlType overlayType) { debugC(1, kDebugFile, "readOverlay(%d, ...)", screenNum); - image_pt tmpImage = image; // temp ptr to overlay file - _sceneryArchive1.seek((uint32)screenNum * sizeof(sceneBlock_t), SEEK_SET); + ImagePtr tmpImage = image; // temp ptr to overlay file + _sceneryArchive1.seek((uint32)screenNum * sizeof(SceneBlock), SEEK_SET); - sceneBlock_t sceneBlock; // Database header entry + SceneBlock sceneBlock; // Database header entry sceneBlock._sceneOffset = _sceneryArchive1.readUint32LE(); sceneBlock._sceneLength = _sceneryArchive1.readUint32LE(); sceneBlock._boundaryOffset = _sceneryArchive1.readUint32LE(); diff --git a/engines/hugo/game.h b/engines/hugo/game.h index ab5e2dff56..29e3bf9b55 100644 --- a/engines/hugo/game.h +++ b/engines/hugo/game.h @@ -45,7 +45,7 @@ namespace Hugo { enum {LOOK_NAME = 1, TAKE_NAME}; // Index of name used in showing takeables and in confirming take // Definitions of 'generic' commands: Max # depends on size of gencmd in -// the object_t record since each requires 1 bit. Currently up to 16 +// the Object record since each requires 1 bit. Currently up to 16 enum {LOOK = 1, TAKE = 2, DROP = 4, LOOK_S = 8}; enum TEXTCOLORS { @@ -55,25 +55,25 @@ enum TEXTCOLORS { _TLIGHTRED, _TLIGHTMAGENTA, _TLIGHTYELLOW, _TBRIGHTWHITE }; -enum uif_t {U_FONT5, U_FONT6, U_FONT8, UIF_IMAGES, NUM_UIF_ITEMS}; +enum Uif {U_FONT5, U_FONT6, U_FONT8, UIF_IMAGES, NUM_UIF_ITEMS}; static const int kFirstFont = U_FONT5; /** * Enumerate ways of cycling a sequence of frames */ -enum cycle_t {kCycleInvisible, kCycleAlmostInvisible, kCycleNotCycling, kCycleForward, kCycleBackward}; +enum Cycle {kCycleInvisible, kCycleAlmostInvisible, kCycleNotCycling, kCycleForward, kCycleBackward}; /** * Enumerate sequence index matching direction of travel */ enum {SEQ_RIGHT, SEQ_LEFT, SEQ_DOWN, SEQ_UP}; -enum font_t {LARGE_ROMAN, MED_ROMAN, NUM_GDI_FONTS, INIT_FONTS, DEL_FONTS}; +enum Font {LARGE_ROMAN, MED_ROMAN, NUM_GDI_FONTS, INIT_FONTS, DEL_FONTS}; /** * Enumerate the different path types for an object */ -enum path_t { +enum Path { kPathUser, // User has control of object via cursor keys kPathAuto, // Computer has control, controlled by action lists kPathQuiet, // Computer has control and no commands allowed @@ -83,7 +83,7 @@ enum path_t { kPathWander2 // Same as WANDER, except keeps cycling when stationary }; -struct hugo_boot_t { // Common HUGO boot file +struct hugoBoot { // Common HUGO boot file char _checksum; // Checksum for boot structure (not exit text) char _registered; // TRUE if registered version, else FALSE char _pbswitch[8]; // Playback switch string @@ -94,13 +94,13 @@ struct hugo_boot_t { // Common HUGO boot file /** * Game specific type definitions */ -typedef byte *image_pt; // ptr to an object image (sprite) +typedef byte *ImagePtr; // ptr to an object image (sprite) typedef byte *sound_pt; // ptr to sound (or music) data /** * Structure for initializing maze processing */ -struct maze_t { +struct Maze { bool _enabledFl; // TRUE when maze processing enabled byte _size; // Size of (square) maze matrix int _x1, _y1, _x2, _y2; // maze hotspot bounding box @@ -112,24 +112,24 @@ struct maze_t { * The following is a linked list of images in an animation sequence * The image data is in 8-bit DIB format, i.e. 1 byte = 1 pixel */ -struct seq_t { // Linked list of images +struct Seq { // Linked list of images byte *_imagePtr; // ptr to image uint16 _bytesPerLine8; // bytes per line (8bits) uint16 _lines; // lines uint16 _x1, _x2, _y1, _y2; // Offsets from x,y: data bounding box - seq_t *_nextSeqPtr; // ptr to next record + Seq *_nextSeqPtr; // ptr to next record }; /** * The following is an array of structures of above sequences */ -struct seqList_t { +struct SeqList { uint16 _imageNbr; // Number of images in sequence - seq_t *_seqPtr; // Ptr to sequence structure + Seq *_seqPtr; // Ptr to sequence structure }; #include "common/pack-start.h" // START STRUCT PACKING -struct sound_hdr_t { // Sound file lookup entry +struct SoundHdr { // Sound file lookup entry uint16 _size; // Size of sound data in bytes uint32 _offset; // Offset of sound data in file } PACKED_STRUCT; @@ -140,17 +140,17 @@ static const int kMaxSeqNumb = 4; // Number of sequences of im /** * Following is definition of object attributes */ -struct object_t { +struct Object { uint16 _nounIndex; // String identifying object uint16 _dataIndex; // String describing the object - uint16 *_stateDataIndex; // Added by Strangerke to handle the LOOK_S state-dependant descriptions - path_t _pathType; // Describe path object follows + uint16 *_stateDataIndex; // Added by Strangerke to handle the LOOK_S state-dependant descriptions + Path _pathType; // Describe path object follows int _vxPath, _vyPath; // Delta velocities (e.g. for CHASE) uint16 _actIndex; // Action list to do on collision with hero byte _seqNumb; // Number of sequences in list - seq_t *_currImagePtr; // Sequence image currently in use - seqList_t _seqList[kMaxSeqNumb]; // Array of sequence structure ptrs and lengths - cycle_t _cycling; // Whether cycling, forward or backward + Seq *_currImagePtr; // Sequence image currently in use + SeqList _seqList[kMaxSeqNumb]; // Array of sequence structure ptrs and lengths + Cycle _cycling; // Whether cycling, forward or backward byte _cycleNumb; // No. of times to cycle byte _frameInterval; // Interval (in ticks) between frames byte _frameTimer; // Decrementing timer for above diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp index 7462da0df8..5ae43b8b5a 100644 --- a/engines/hugo/hugo.cpp +++ b/engines/hugo/hugo.cpp @@ -106,7 +106,7 @@ GUI::Debugger *HugoEngine::getDebugger() { return _console; } -status_t &HugoEngine::getGameStatus() { +Status &HugoEngine::getGameStatus() { return _status; } @@ -323,7 +323,7 @@ void HugoEngine::initMachine() { * Hugo game state machine - called during onIdle */ void HugoEngine::runMachine() { - status_t &gameStatus = getGameStatus(); + Status &gameStatus = getGameStatus(); // Don't process if gameover if (gameStatus._gameOverFl) @@ -639,10 +639,10 @@ void HugoEngine::readScreenFiles(const int screenNum) { memcpy(_screen->getBackBuffer(), _screen->getFrontBuffer(), sizeof(_screen->getFrontBuffer())); // Make a copy // Workaround for graphic glitches in DOS versions. Cleaning the overlays fix the problem - memset(_object->_objBound, '\0', sizeof(overlay_t)); - memset(_object->_boundary, '\0', sizeof(overlay_t)); - memset(_object->_overlay, '\0', sizeof(overlay_t)); - memset(_object->_ovlBase, '\0', sizeof(overlay_t)); + memset(_object->_objBound, '\0', sizeof(Overlay)); + memset(_object->_boundary, '\0', sizeof(Overlay)); + memset(_object->_overlay, '\0', sizeof(Overlay)); + memset(_object->_ovlBase, '\0', sizeof(Overlay)); _file->readOverlay(screenNum, _object->_boundary, kOvlBoundary); // Boundary file _file->readOverlay(screenNum, _object->_overlay, kOvlOverlay); // Overlay file diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h index 68b771faa4..312f2272db 100644 --- a/engines/hugo/hugo.h +++ b/engines/hugo/hugo.h @@ -80,18 +80,18 @@ static const int kMaxPath = 256; // Max length of a full path static const int kHeroMaxWidth = 24; // Maximum width of hero static const int kHeroMinWidth = 16; // Minimum width of hero -typedef char command_t[kMaxLineSize + 8]; // Command line (+spare for prompt,cursor) +typedef char Command[kMaxLineSize + 8]; // Command line (+spare for prompt,cursor) -struct config_t { // User's config (saved) - bool _musicFl; // State of Music button/menu item - bool _soundFl; // State of Sound button/menu item - bool _turboFl; // State of Turbo button/menu item - bool _playlist[kMaxTunes]; // Tune playlist +struct Config { // User's config (saved) + bool _musicFl; // State of Music button/menu item + bool _soundFl; // State of Sound button/menu item + bool _turboFl; // State of Turbo button/menu item + bool _playlist[kMaxTunes]; // Tune playlist }; -typedef byte icondib_t[kXPix * kInvDy]; // Icon bar dib -typedef byte viewdib_t[(long)kXPix * kYPix]; // Viewport dib -typedef byte overlay_t[kOvlSize]; // Overlay file +typedef byte Icondib[kXPix * kInvDy]; // Icon bar dib +typedef byte Viewdib[(long)kXPix * kYPix]; // Viewport dib +typedef byte Overlay[kOvlSize]; // Overlay file enum GameType { kGameTypeNone = 0, @@ -131,12 +131,12 @@ enum HugoRegistered { /** * Inventory icon bar states */ -enum istate_t {kInventoryOff, kInventoryUp, kInventoryDown, kInventoryActive}; +enum Istate {kInventoryOff, kInventoryUp, kInventoryDown, kInventoryActive}; /** * Game view state machine */ -enum vstate_t {kViewIdle, kViewIntroInit, kViewIntro, kViewPlay, kViewInvent, kViewExit}; +enum Vstate {kViewIdle, kViewIntroInit, kViewIntro, kViewPlay, kViewInvent, kViewExit}; /** * Enumerate whether object is foreground, background or 'floating' @@ -152,12 +152,12 @@ enum {kPriorityForeground, kPriorityBackground, kPriorityFloating, kPriorityOver /** * Display list functions */ -enum dupdate_t {kDisplayInit, kDisplayAdd, kDisplayDisplay, kDisplayRestore}; +enum Dupdate {kDisplayInit, kDisplayAdd, kDisplayDisplay, kDisplayRestore}; /** * Priority for sound effect */ -enum priority_t {kSoundPriorityLow, kSoundPriorityMedium, kSoundPriorityHigh}; +enum Priority {kSoundPriorityLow, kSoundPriorityMedium, kSoundPriorityHigh}; enum HugoGameFeatures { GF_PACKED = (1 << 0) // Database @@ -170,27 +170,27 @@ enum seqTextEngine { struct HugoGameDescription; -struct status_t { // Game status (not saved) - bool _storyModeFl; // Game is telling story - no commands - bool _gameOverFl; // Game is over - hero knobbled - bool _lookFl; // Toolbar "look" button pressed - bool _recallFl; // Toolbar "recall" button pressed - bool _newScreenFl; // New screen just loaded in dib_a - bool _godModeFl; // Allow DEBUG features in live version - bool _showBoundariesFl; // Flag used to show and hide boundaries, +struct Status { // Game status (not saved) + bool _storyModeFl; // Game is telling story - no commands + bool _gameOverFl; // Game is over - hero knobbled + bool _lookFl; // Toolbar "look" button pressed + bool _recallFl; // Toolbar "recall" button pressed + bool _newScreenFl; // New screen just loaded in dib_a + bool _godModeFl; // Allow DEBUG features in live version + bool _showBoundariesFl; // Flag used to show and hide boundaries, // used by the console bool _doQuitFl; bool _skipIntroFl; bool _helpFl; - uint32 _tick; // Current time in ticks - vstate_t _viewState; // View state machine - int16 _song; // Current song + uint32 _tick; // Current time in ticks + Vstate _viewState; // View state machine + int16 _song; // Current song }; /** * Structure to define an EXIT or other collision-activated hotspot */ -struct hotspot_t { +struct Hotspot { int _screenIndex; // Screen in which hotspot appears int _x1, _y1, _x2, _y2; // Bounding box of hotspot uint16 _actIndex; // Actions to carry out if a 'hit' @@ -225,19 +225,19 @@ public: uint16 _numStates; int8 _normalTPS; // Number of ticks (frames) per second. // 8 for Win versions, 9 for DOS versions - object_t *_hero; + Object *_hero; byte *_screen_p; byte _heroImage; byte *_screenStates; - command_t _line; // Line of user text input - config_t _config; // User's config + Command _line; // Line of user text input + Config _config; // User's config int16 *_defltTunes; uint16 _look; uint16 _take; uint16 _drop; - maze_t _maze; // Maze control structure - hugo_boot_t _boot; // Boot info structure + Maze _maze; // Maze control structure + hugoBoot _boot; // Boot info structure GUI::Debugger *getDebugger(); @@ -246,8 +246,8 @@ public: const char *_episode; Common::String _picDir; - command_t _statusLine; - command_t _scoreLine; + Command _statusLine; + Command _scoreLine; const HugoGameDescription *_gameDescription; uint32 getFeatures() const; @@ -279,7 +279,7 @@ public: void shutdown(); void syncSoundSettings(); - status_t &getGameStatus(); + Status &getGameStatus(); int getScore() const; void setScore(const int newScore); void adjustScore(const int adjustment); @@ -314,7 +314,7 @@ protected: private: static const int kTurboTps = 16; // This many in turbo mode - status_t _status; // Game status structure + Status _status; // Game status structure uint32 _lastTime; uint32 _curTime; diff --git a/engines/hugo/inventory.cpp b/engines/hugo/inventory.cpp index 151fe0ee13..c2495beadb 100644 --- a/engines/hugo/inventory.cpp +++ b/engines/hugo/inventory.cpp @@ -56,7 +56,7 @@ void InventoryHandler::setInventoryObjId(int16 objId) { _inventoryObjId = objId; } -void InventoryHandler::setInventoryState(istate_t state) { +void InventoryHandler::setInventoryState(Istate state) { _inventoryState = state; } @@ -68,7 +68,7 @@ int16 InventoryHandler::getInventoryObjId() const { return _inventoryObjId; } -istate_t InventoryHandler::getInventoryState() const { +Istate InventoryHandler::getInventoryState() const { return _inventoryState; } @@ -137,8 +137,8 @@ void InventoryHandler::constructInventory(const int16 imageTotNumb, int displayN * Process required action for inventory * Returns objId under cursor (or -1) for INV_GET */ -int16 InventoryHandler::processInventory(const invact_t action, ...) { - debugC(1, kDebugInventory, "processInventory(invact_t action, ...)"); +int16 InventoryHandler::processInventory(const InvAct action, ...) { + debugC(1, kDebugInventory, "processInventory(InvAct action, ...)"); int16 imageNumb; // Total number of inventory items int displayNumb; // Total number displayed/carried @@ -208,7 +208,7 @@ int16 InventoryHandler::processInventory(const invact_t action, ...) { * Process inventory state machine */ void InventoryHandler::runInventory() { - status_t &gameStatus = _vm->getGameStatus(); + Status &gameStatus = _vm->getGameStatus(); debugC(1, kDebugInventory, "runInventory"); diff --git a/engines/hugo/inventory.h b/engines/hugo/inventory.h index 666cc37b51..5b55c3ec94 100644 --- a/engines/hugo/inventory.h +++ b/engines/hugo/inventory.h @@ -34,22 +34,22 @@ namespace Hugo { /** * Actions for Process_inventory() */ -enum invact_t {kInventoryActionInit, kInventoryActionLeft, kInventoryActionRight, kInventoryActionGet}; +enum InvAct {kInventoryActionInit, kInventoryActionLeft, kInventoryActionRight, kInventoryActionGet}; class InventoryHandler { public: InventoryHandler(HugoEngine *vm); void setInventoryObjId(int16 objId); - void setInventoryState(istate_t state); + void setInventoryState(Istate state); void freeInvent(); int16 getInventoryObjId() const; - istate_t getInventoryState() const; + Istate getInventoryState() const; int16 findIconId(int16 objId); void loadInvent(Common::SeekableReadStream &in); - int16 processInventory(const invact_t action, ...); + int16 processInventory(const InvAct action, ...); void runInventory(); private: @@ -59,7 +59,7 @@ private: int16 _firstIconId; // Index of first icon to display int16 *_invent; - istate_t _inventoryState; // Inventory icon bar state + Istate _inventoryState; // Inventory icon bar state int16 _inventoryHeight; // Inventory icon bar height int16 _inventoryObjId; // Inventory object selected, or -1 byte _maxInvent; diff --git a/engines/hugo/mouse.cpp b/engines/hugo/mouse.cpp index 864934a0d3..fef3cca608 100644 --- a/engines/hugo/mouse.cpp +++ b/engines/hugo/mouse.cpp @@ -108,7 +108,7 @@ int16 MouseHandler::getHotspotActIndex(const int16 hotspotId) const { /** * Shadow-blit supplied string into dib_a at cx,cy and add to display list */ -void MouseHandler::cursorText(const char *buffer, const int16 cx, const int16 cy, const uif_t fontId, const int16 color) { +void MouseHandler::cursorText(const char *buffer, const int16 cx, const int16 cy, const Uif fontId, const int16 color) { debugC(1, kDebugMouse, "cursorText(%s, %d, %d, %d, %d)", buffer, cx, cy, fontId, color); _vm->_screen->loadFont(fontId); @@ -152,7 +152,7 @@ int16 MouseHandler::findExit(const int16 cx, const int16 cy, byte screenId) { 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(); + Status &gameStatus = _vm->getGameStatus(); if (gameStatus._storyModeFl || _vm->_hero->_pathType == kPathQuiet) // Make sure user has control return; @@ -168,7 +168,7 @@ void MouseHandler::processRightClick(const int16 objId, const int16 cx, const in else _vm->_object->useObject(objId); // Use status.objid on object } else { // Clicked over viewport object - object_t *obj = &_vm->_object->_objects[objId]; + Object *obj = &_vm->_object->_objects[objId]; int16 x, y; switch (obj->_viewx) { // Where to walk to case -1: // Walk to object position @@ -203,9 +203,9 @@ void MouseHandler::processLeftClick(const int16 objId, const int16 cx, const int debugC(1, kDebugMouse, "ProcessLeftClick(%d, %d, %d)", objId, cx, cy); int16 i, x, y; - object_t *obj; + Object *obj; - status_t &gameStatus = _vm->getGameStatus(); + Status &gameStatus = _vm->getGameStatus(); if (gameStatus._storyModeFl || _vm->_hero->_pathType == kPathQuiet) // Make sure user has control return; @@ -284,8 +284,8 @@ void MouseHandler::processLeftClick(const int16 objId, const int16 cx, const int void MouseHandler::mouseHandler() { debugC(2, kDebugMouse, "mouseHandler"); - status_t &gameStatus = _vm->getGameStatus(); - istate_t inventState = _vm->_inventory->getInventoryState(); + Status &gameStatus = _vm->getGameStatus(); + Istate inventState = _vm->_inventory->getInventoryState(); if ((gameStatus._viewState != kViewPlay) && (inventState != kInventoryActive)) return; @@ -343,7 +343,7 @@ void MouseHandler::mouseHandler() { resetRightButton(); } -void MouseHandler::readHotspot(Common::ReadStream &in, hotspot_t &hotspot) { +void MouseHandler::readHotspot(Common::ReadStream &in, Hotspot &hotspot) { hotspot._screenIndex = in.readSint16BE(); hotspot._x1 = in.readSint16BE(); hotspot._y1 = in.readSint16BE(); @@ -359,13 +359,13 @@ void MouseHandler::readHotspot(Common::ReadStream &in, hotspot_t &hotspot) { * Load hotspots data from hugo.dat */ void MouseHandler::loadHotspots(Common::ReadStream &in) { - hotspot_t *wrkHotspots = 0; - hotspot_t tmp; + Hotspot *wrkHotspots = 0; + Hotspot tmp; memset(&tmp, 0, sizeof(tmp)); for (int varnt = 0; varnt < _vm->_numVariant; varnt++) { int numRows = in.readUint16BE(); if (varnt == _vm->_gameVariant) - _hotspots = wrkHotspots = (hotspot_t *)malloc(sizeof(hotspot_t) * numRows); + _hotspots = wrkHotspots = (Hotspot *)malloc(sizeof(Hotspot) * numRows); for (int i = 0; i < numRows; i++) readHotspot(in, (varnt == _vm->_gameVariant) ? wrkHotspots[i] : tmp); @@ -377,7 +377,7 @@ void MouseHandler::loadHotspots(Common::ReadStream &in) { */ void MouseHandler::drawHotspots() const { for (int i = 0; _hotspots[i]._screenIndex >= 0; i++) { - hotspot_t *hotspot = &_hotspots[i]; + Hotspot *hotspot = &_hotspots[i]; if (hotspot->_screenIndex == _vm->_hero->_screenIndex) _vm->_screen->drawRectangle(false, hotspot->_x1, hotspot->_y1, hotspot->_x2, hotspot->_y2, _TLIGHTRED); } diff --git a/engines/hugo/mouse.h b/engines/hugo/mouse.h index 35f9e4e87e..e20716f72c 100644 --- a/engines/hugo/mouse.h +++ b/engines/hugo/mouse.h @@ -70,17 +70,17 @@ private: kMsExit = 1 }; - hotspot_t *_hotspots; + Hotspot *_hotspots; bool _leftButtonFl; // Left mouse button pressed bool _rightButtonFl; // Right button pressed int _mouseX; int _mouseY; bool _jumpExitFl; // Allowed to jump to a screen exit - void cursorText(const char *buffer, const int16 cx, const int16 cy, const uif_t fontId, const int16 color); + void cursorText(const char *buffer, const int16 cx, const int16 cy, const Uif fontId, const int16 color); void processRightClick(const int16 objId, const int16 cx, const int16 cy); void processLeftClick(const int16 objId, const int16 cx, const int16 cy); - void readHotspot(Common::ReadStream &in, hotspot_t &hotspot); + void readHotspot(Common::ReadStream &in, Hotspot &hotspot); }; } // End of namespace Hugo diff --git a/engines/hugo/object.cpp b/engines/hugo/object.cpp index 92a04227d6..e0dd0abd49 100644 --- a/engines/hugo/object.cpp +++ b/engines/hugo/object.cpp @@ -48,10 +48,10 @@ ObjectHandler::ObjectHandler(HugoEngine *vm) : _vm(vm), _objects(0), _uses(0) { _numObj = 0; _objCount = 0; _usesSize = 0; - memset(_objBound, '\0', sizeof(overlay_t)); - memset(_boundary, '\0', sizeof(overlay_t)); - memset(_overlay, '\0', sizeof(overlay_t)); - memset(_ovlBase, '\0', sizeof(overlay_t)); + memset(_objBound, '\0', sizeof(Overlay)); + memset(_boundary, '\0', sizeof(Overlay)); + memset(_overlay, '\0', sizeof(Overlay)); + memset(_ovlBase, '\0', sizeof(Overlay)); } ObjectHandler::~ObjectHandler() { @@ -86,7 +86,7 @@ void ObjectHandler::setVelocity(int objIndex, int8 vx, int8 vy) { _objects[objIndex]._vy = vy; } -void ObjectHandler::setPath(int objIndex, path_t pathType, int16 vxPath, int16 vyPath) { +void ObjectHandler::setPath(int objIndex, Path pathType, int16 vxPath, int16 vyPath) { _objects[objIndex]._pathType = pathType; _objects[objIndex]._vxPath = vxPath; _objects[objIndex]._vyPath = vyPath; @@ -95,12 +95,12 @@ void ObjectHandler::setPath(int objIndex, path_t pathType, int16 vxPath, int16 v /** * Save sequence number and image number in given object */ -void ObjectHandler::saveSeq(object_t *obj) { +void ObjectHandler::saveSeq(Object *obj) { debugC(1, kDebugObject, "saveSeq"); bool found = false; for (int i = 0; !found && (i < obj->_seqNumb); i++) { - seq_t *q = obj->_seqList[i]._seqPtr; + Seq *q = obj->_seqList[i]._seqPtr; for (int j = 0; !found && (j < obj->_seqList[i]._imageNbr); j++) { if (obj->_currImagePtr == q) { found = true; @@ -114,12 +114,12 @@ void ObjectHandler::saveSeq(object_t *obj) { } /** - * Set up cur_seq_p from stored sequence and image number in object + * Set up cur_seqPtr from stored sequence and image number in object */ -void ObjectHandler::restoreSeq(object_t *obj) { +void ObjectHandler::restoreSeq(Object *obj) { debugC(1, kDebugObject, "restoreSeq"); - seq_t *q = obj->_seqList[obj->_curSeqNum]._seqPtr; + Seq *q = obj->_seqList[obj->_curSeqNum]._seqPtr; for (int j = 0; j < obj->_curImageNum; j++) q = q->_nextSeqPtr; obj->_currImagePtr = q; @@ -134,7 +134,7 @@ void ObjectHandler::useObject(int16 objId) { const char *verb; // Background verb to use directly int16 inventObjId = _vm->_inventory->getInventoryObjId(); - object_t *obj = &_objects[objId]; // Ptr to object + Object *obj = &_objects[objId]; // Ptr to object if (inventObjId == -1) { // Get or use objid directly if ((obj->_genericCmd & TAKE) || obj->_objValue) // Get collectible item @@ -153,12 +153,12 @@ void ObjectHandler::useObject(int16 objId) { _vm->_text->getNoun(obj->_nounIndex, 0)); // Check valid use of objects and override verb if necessary - for (uses_t *use = _uses; use->_objId != _numObj; use++) { + for (Uses *use = _uses; use->_objId != _numObj; use++) { if (inventObjId == use->_objId) { // Look for secondary object, if found use matching verb bool foundFl = false; - for (target_t *target = use->_targets; target->_nounIndex != 0; target++) + for (Target *target = use->_targets; target->_nounIndex != 0; target++) if (target->_nounIndex == obj->_nounIndex) { foundFl = true; sprintf(_vm->_line, "%s %s %s", _vm->_text->getVerb(target->_verbIndex, 0), @@ -195,12 +195,12 @@ int16 ObjectHandler::findObject(uint16 x, uint16 y) { int16 objIndex = -1; // Index of found object uint16 y2Max = 0; // Greatest y2 - object_t *obj = _objects; + Object *obj = _objects; // Check objects on screen for (int i = 0; i < _numObj; i++, obj++) { // Object must be in current screen and "useful" if (obj->_screenIndex == *_vm->_screen_p && (obj->_genericCmd || obj->_objValue || obj->_cmdIndex)) { - seq_t *curImage = obj->_currImagePtr; + Seq *curImage = obj->_currImagePtr; // Object must have a visible image... if (curImage != 0 && obj->_cycling != kCycleInvisible) { // If cursor inside object @@ -233,7 +233,7 @@ int16 ObjectHandler::findObject(uint16 x, uint16 y) { * Issue "Look at " command * Note special case of swapped hero image */ -void ObjectHandler::lookObject(object_t *obj) { +void ObjectHandler::lookObject(Object *obj) { debugC(1, kDebugObject, "lookObject"); if (obj == _vm->_hero) @@ -252,10 +252,10 @@ void ObjectHandler::freeObjects() { if (_vm->_hero != 0 && _vm->_hero->_seqList[0]._seqPtr != 0) { // Free all sequence lists and image data for (int16 i = 0; i < _numObj; i++) { - object_t *obj = &_objects[i]; + Object *obj = &_objects[i]; for (int16 j = 0; j < obj->_seqNumb; j++) { - seq_t *seq = obj->_seqList[j]._seqPtr; - seq_t *next; + Seq *seq = obj->_seqList[j]._seqPtr; + Seq *next; if (seq == 0) // Failure during database load break; if (seq->_imagePtr != 0) { @@ -300,8 +300,8 @@ void ObjectHandler::freeObjects() { int ObjectHandler::y2comp(const void *a, const void *b) { debugC(6, kDebugObject, "y2comp"); - const object_t *p1 = &HugoEngine::get()._object->_objects[*(const byte *)a]; - const object_t *p2 = &HugoEngine::get()._object->_objects[*(const byte *)b]; + const Object *p1 = &HugoEngine::get()._object->_objects[*(const byte *)a]; + const Object *p2 = &HugoEngine::get()._object->_objects[*(const byte *)b]; if (p1 == p2) // Why does qsort try the same indexes? @@ -345,7 +345,7 @@ void ObjectHandler::showTakeables() { debugC(1, kDebugObject, "showTakeables"); for (int j = 0; j < _numObj; j++) { - object_t *obj = &_objects[j]; + Object *obj = &_objects[j]; if ((obj->_cycling != kCycleInvisible) && (obj->_screenIndex == *_vm->_screen_p) && (((TAKE & obj->_genericCmd) == TAKE) || obj->_objValue)) { @@ -357,10 +357,10 @@ void ObjectHandler::showTakeables() { /** * Find a clear space around supplied object that hero can walk to */ -bool ObjectHandler::findObjectSpace(object_t *obj, int16 *destx, int16 *desty) { +bool ObjectHandler::findObjectSpace(Object *obj, int16 *destx, int16 *desty) { debugC(1, kDebugObject, "findObjectSpace(obj, %d, %d)", *destx, *desty); - seq_t *curImage = obj->_currImagePtr; + Seq *curImage = obj->_currImagePtr; int16 y = obj->_y + curImage->_y2 - 1; bool foundFl = true; @@ -399,11 +399,11 @@ bool ObjectHandler::findObjectSpace(object_t *obj, int16 *destx, int16 *desty) { return foundFl; } -void ObjectHandler::readUse(Common::ReadStream &in, uses_t &curUse) { +void ObjectHandler::readUse(Common::ReadStream &in, Uses &curUse) { curUse._objId = in.readSint16BE(); curUse._dataIndex = in.readUint16BE(); uint16 numSubElem = in.readUint16BE(); - curUse._targets = (target_t *)malloc(sizeof(target_t) * numSubElem); + curUse._targets = (Target *)malloc(sizeof(Target) * numSubElem); for (int j = 0; j < numSubElem; j++) { curUse._targets[j]._nounIndex = in.readUint16BE(); curUse._targets[j]._verbIndex = in.readUint16BE(); @@ -413,7 +413,7 @@ void ObjectHandler::readUse(Common::ReadStream &in, uses_t &curUse) { * Load _uses from Hugo.dat */ void ObjectHandler::loadObjectUses(Common::ReadStream &in) { - uses_t tmpUse; + Uses tmpUse; tmpUse._targets = 0; //Read _uses @@ -421,7 +421,7 @@ void ObjectHandler::loadObjectUses(Common::ReadStream &in) { uint16 numElem = in.readUint16BE(); if (varnt == _vm->_gameVariant) { _usesSize = numElem; - _uses = (uses_t *)malloc(sizeof(uses_t) * numElem); + _uses = (Uses *)malloc(sizeof(Uses) * numElem); } for (int i = 0; i < numElem; i++) { @@ -436,7 +436,7 @@ void ObjectHandler::loadObjectUses(Common::ReadStream &in) { } } -void ObjectHandler::readObject(Common::ReadStream &in, object_t &curObject) { +void ObjectHandler::readObject(Common::ReadStream &in, Object &curObject) { curObject._nounIndex = in.readUint16BE(); curObject._dataIndex = in.readUint16BE(); uint16 numSubElem = in.readUint16BE(); @@ -448,7 +448,7 @@ void ObjectHandler::readObject(Common::ReadStream &in, object_t &curObject) { for (int j = 0; j < numSubElem; j++) curObject._stateDataIndex[j] = in.readUint16BE(); - curObject._pathType = (path_t) in.readSint16BE(); + curObject._pathType = (Path) in.readSint16BE(); curObject._vxPath = in.readSint16BE(); curObject._vyPath = in.readSint16BE(); curObject._actIndex = in.readUint16BE(); @@ -465,7 +465,7 @@ void ObjectHandler::readObject(Common::ReadStream &in, object_t &curObject) { curObject._seqList[j]._seqPtr = 0; } - curObject._cycling = (cycle_t)in.readByte(); + curObject._cycling = (Cycle)in.readByte(); curObject._cycleNumb = in.readByte(); curObject._frameInterval = in.readByte(); curObject._frameTimer = in.readByte(); @@ -497,7 +497,7 @@ void ObjectHandler::readObject(Common::ReadStream &in, object_t &curObject) { */ void ObjectHandler::loadObjectArr(Common::ReadStream &in) { debugC(6, kDebugObject, "loadObject(&in)"); - object_t tmpObject; + Object tmpObject; tmpObject._stateDataIndex = 0; for (int varnt = 0; varnt < _vm->_numVariant; varnt++) { @@ -505,7 +505,7 @@ void ObjectHandler::loadObjectArr(Common::ReadStream &in) { if (varnt == _vm->_gameVariant) { _objCount = numElem; - _objects = (object_t *)malloc(sizeof(object_t) * numElem); + _objects = (Object *)malloc(sizeof(Object) * numElem); } for (int i = 0; i < numElem; i++) { @@ -559,7 +559,7 @@ void ObjectHandler::restoreAllSeq() { */ void ObjectHandler::saveObjects(Common::WriteStream *out) { for (int i = 0; i < _numObj; i++) { - // Save where curr_seq_p is pointing to + // Save where curr_seqPtr is pointing to saveSeq(&_objects[i]); out->writeByte(_objects[i]._pathType); @@ -594,10 +594,10 @@ void ObjectHandler::saveObjects(Common::WriteStream *out) { */ void ObjectHandler::restoreObjects(Common::SeekableReadStream *in) { for (int i = 0; i < _numObj; i++) { - _objects[i]._pathType = (path_t) in->readByte(); + _objects[i]._pathType = (Path) in->readByte(); _objects[i]._vxPath = in->readSint16BE(); _objects[i]._vyPath = in->readSint16BE(); - _objects[i]._cycling = (cycle_t) in->readByte(); + _objects[i]._cycling = (Cycle) in->readByte(); _objects[i]._cycleNumb = in->readByte(); _objects[i]._frameTimer = in->readByte(); _objects[i]._screenIndex = in->readByte(); @@ -782,7 +782,7 @@ void ObjectHandler::clearScreenBoundary(const int x1, const int x2, const int y) /** * An object has collided with a boundary. See if any actions are required */ -void ObjectHandler::boundaryCollision(object_t *obj) { +void ObjectHandler::boundaryCollision(Object *obj) { debugC(1, kDebugEngine, "boundaryCollision"); if (obj == _vm->_hero) { diff --git a/engines/hugo/object.h b/engines/hugo/object.h index 8f8043dbbc..fd0d731a98 100644 --- a/engines/hugo/object.h +++ b/engines/hugo/object.h @@ -34,15 +34,15 @@ namespace Hugo { -struct target_t { // Secondary target for action +struct Target { // Secondary target for action uint16 _nounIndex; // Secondary object uint16 _verbIndex; // Action on secondary object }; -struct uses_t { // Define uses of certain objects +struct Uses { // Define uses of certain objects int16 _objId; // Primary object uint16 _dataIndex; // String if no secondary object matches - target_t *_targets; // List of secondary targets + Target *_targets; // List of secondary targets }; class ObjectHandler { @@ -50,12 +50,12 @@ public: ObjectHandler(HugoEngine *vm); virtual ~ObjectHandler(); - overlay_t _objBound; - overlay_t _boundary; // Boundary overlay file - overlay_t _overlay; // First overlay file - overlay_t _ovlBase; // First overlay base file + Overlay _objBound; + Overlay _boundary; // Boundary overlay file + Overlay _overlay; // First overlay file + Overlay _ovlBase; // First overlay base file - object_t *_objects; + Object *_objects; uint16 _numObj; byte getBoundaryOverlay(uint16 index) const; @@ -65,7 +65,7 @@ public: 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; - void boundaryCollision(object_t *obj); + void boundaryCollision(Object *obj); void clearBoundary(const int x1, const int x2, const int y); void clearScreenBoundary(const int x1, const int x2, const int y); void storeBoundary(const int x1, const int x2, const int y); @@ -76,7 +76,7 @@ public: virtual void swapImages(int objIndex1, int objIndex2) = 0; bool isCarrying(uint16 wordIndex); - bool findObjectSpace(object_t *obj, int16 *destx, int16 *desty); + bool findObjectSpace(Object *obj, int16 *destx, int16 *desty); int calcMaxScore(); int16 findObject(uint16 x, uint16 y); @@ -84,14 +84,14 @@ public: void loadObjectArr(Common::ReadStream &in); void loadObjectUses(Common::ReadStream &in); void loadNumObj(Common::ReadStream &in); - void lookObject(object_t *obj); + void lookObject(Object *obj); void readObjectImages(); - void readObject(Common::ReadStream &in, object_t &curObject); - void readUse(Common::ReadStream &in, uses_t &curUse); + void readObject(Common::ReadStream &in, Object &curObject); + void readUse(Common::ReadStream &in, Uses &curUse); void restoreAllSeq(); void restoreObjects(Common::SeekableReadStream *in); void saveObjects(Common::WriteStream *out); - void saveSeq(object_t *obj); + void saveSeq(Object *obj); void setCarriedScreen(int screenNum); void showTakeables(); void useObject(int16 objId); @@ -101,7 +101,7 @@ public: bool isCarried(int objIndex) const; void setCarry(int objIndex, bool val); void setVelocity(int objIndex, int8 vx, int8 vy); - void setPath(int objIndex, path_t pathType, int16 vxPath, int16 vyPath); + void setPath(int objIndex, Path pathType, int16 vxPath, int16 vyPath); protected: HugoEngine *_vm; @@ -110,11 +110,11 @@ protected: static const int kEdge2 = kEdge * 2; // Push object further back on edge collision static const int kMaxObjNumb = 128; // Used in Update_images() - uint16 _objCount; - uses_t *_uses; - uint16 _usesSize; + uint16 _objCount; + Uses *_uses; + uint16 _usesSize; - void restoreSeq(object_t *obj); + void restoreSeq(Object *obj); inline bool checkBoundary(int16 x, int16 y); template diff --git a/engines/hugo/object_v1d.cpp b/engines/hugo/object_v1d.cpp index 7b8f90e189..e5fedb3b2a 100644 --- a/engines/hugo/object_v1d.cpp +++ b/engines/hugo/object_v1d.cpp @@ -59,21 +59,21 @@ void ObjectHandler_v1d::updateImages() { debugC(5, kDebugObject, "updateImages"); // Initialize the index array to visible objects in current screen - int num_objs = 0; + int objNumb = 0; byte objindex[kMaxObjNumb]; // Array of indeces to objects for (int i = 0; i < _numObj; i++) { - object_t *obj = &_objects[i]; + Object *obj = &_objects[i]; if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling >= kCycleAlmostInvisible)) - objindex[num_objs++] = i; + objindex[objNumb++] = i; } // Sort the objects into increasing y+y2 (painter's algorithm) - qsort(objindex, num_objs, sizeof(objindex[0]), y2comp); + qsort(objindex, objNumb, sizeof(objindex[0]), y2comp); // Add each visible object to display list - for (int i = 0; i < num_objs; i++) { - object_t *obj = &_objects[objindex[i]]; + for (int i = 0; i < objNumb; i++) { + Object *obj = &_objects[objindex[i]]; // Count down inter-frame timer if (obj->_frameTimer) obj->_frameTimer--; @@ -90,7 +90,7 @@ void ObjectHandler_v1d::updateImages() { _vm->_screen->displayFrame(obj->_x, obj->_y, obj->_currImagePtr->_nextSeqPtr, false); break; case kCycleBackward: { - seq_t *seqPtr = obj->_currImagePtr; + Seq *seqPtr = obj->_currImagePtr; if (!obj->_frameTimer) { // Show next frame while (seqPtr->_nextSeqPtr != obj->_currImagePtr) seqPtr = seqPtr->_nextSeqPtr; @@ -107,8 +107,8 @@ void ObjectHandler_v1d::updateImages() { _vm->_scheduler->waitForRefresh(); // Cycle any animating objects - for (int i = 0; i < num_objs; i++) { - object_t *obj = &_objects[objindex[i]]; + for (int i = 0; i < objNumb; i++) { + Object *obj = &_objects[objindex[i]]; if (obj->_cycling != kCycleInvisible) { // Only if it's visible if (obj->_cycling == kCycleAlmostInvisible) @@ -140,7 +140,7 @@ void ObjectHandler_v1d::updateImages() { case kCycleBackward: { if (!obj->_frameTimer) { // Time to step to prev frame - seq_t *seqPtr = obj->_currImagePtr; + Seq *seqPtr = obj->_currImagePtr; while (obj->_currImagePtr->_nextSeqPtr != seqPtr) obj->_currImagePtr = obj->_currImagePtr->_nextSeqPtr; // Find out if this is first frame of sequence @@ -183,8 +183,8 @@ void ObjectHandler_v1d::moveObjects() { // and store all (visible) object baselines into the boundary file. // Don't store foreground or background objects for (int i = 0; i < _numObj; i++) { - object_t *obj = &_objects[i]; // Get pointer to object - seq_t *currImage = obj->_currImagePtr; // Get ptr to current image + Object *obj = &_objects[i]; // Get pointer to object + Seq *currImage = obj->_currImagePtr; // Get ptr to current image if (obj->_screenIndex == *_vm->_screen_p) { switch (obj->_pathType) { case kPathChase: { @@ -271,13 +271,13 @@ void ObjectHandler_v1d::moveObjects() { // Move objects, allowing for boundaries for (int i = 0; i < _numObj; i++) { - object_t *obj = &_objects[i]; // Get pointer to object + Object *obj = &_objects[i]; // Get pointer to object if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_vx || obj->_vy)) { // Only process if it's moving // Do object movement. Delta_x,y return allowed movement in x,y // to move as close to a boundary as possible without crossing it. - seq_t *currImage = obj->_currImagePtr; // Get ptr to current image + Seq *currImage = obj->_currImagePtr; // Get ptr to current image // object coordinates int x1 = obj->_x + currImage->_x1; // Left edge of object int x2 = obj->_x + currImage->_x2; // Right edge @@ -325,15 +325,15 @@ void ObjectHandler_v1d::moveObjects() { // Clear all object baselines from the boundary file. for (int i = 0; i < _numObj; i++) { - object_t *obj = &_objects[i]; // Get pointer to object - seq_t *currImage = obj->_currImagePtr; // Get ptr to current image + Object *obj = &_objects[i]; // Get pointer to object + Seq *currImage = obj->_currImagePtr; // Get ptr to current image if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) clearBoundary(obj->_oldx + currImage->_x1, obj->_oldx + currImage->_x2, obj->_oldy + currImage->_y2); } // If maze mode is enabled, do special maze processing if (_vm->_maze._enabledFl) { - seq_t *currImage = _vm->_hero->_currImagePtr;// Get ptr to current image + Seq *currImage = _vm->_hero->_currImagePtr;// Get ptr to current image // hero coordinates int x1 = _vm->_hero->_x + currImage->_x1; // Left edge of object int x2 = _vm->_hero->_x + currImage->_x2; // Right edge @@ -352,8 +352,8 @@ void ObjectHandler_v1d::moveObjects() { void ObjectHandler_v1d::swapImages(int objIndex1, int objIndex2) { debugC(1, kDebugObject, "swapImages(%d, %d)", objIndex1, objIndex2); - seqList_t tmpSeqList[kMaxSeqNumb]; - int seqListSize = sizeof(seqList_t) * kMaxSeqNumb; + SeqList tmpSeqList[kMaxSeqNumb]; + int seqListSize = sizeof(SeqList) * kMaxSeqNumb; memmove(tmpSeqList, _objects[objIndex1]._seqList, seqListSize); memmove(_objects[objIndex1]._seqList, _objects[objIndex2]._seqList, seqListSize); @@ -365,8 +365,8 @@ void ObjectHandler_v1d::swapImages(int objIndex1, int objIndex2) { 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]; + Object *obj1 = &_objects[objIndex1]; + Object *obj2 = &_objects[objIndex2]; obj1->_pathType = kPathAuto; int dx = obj1->_x + obj1->_currImagePtr->_x1 - obj2->_x - obj2->_currImagePtr->_x1; int dy = obj1->_y + obj1->_currImagePtr->_y1 - obj2->_y - obj2->_currImagePtr->_y1; diff --git a/engines/hugo/object_v1w.cpp b/engines/hugo/object_v1w.cpp index dd3de5fe40..e1e8496d9d 100644 --- a/engines/hugo/object_v1w.cpp +++ b/engines/hugo/object_v1w.cpp @@ -59,21 +59,21 @@ void ObjectHandler_v1w::updateImages() { debugC(5, kDebugObject, "updateImages"); // Initialize the index array to visible objects in current screen - int num_objs = 0; + int objNumb = 0; byte objindex[kMaxObjNumb]; // Array of indeces to objects for (int i = 0; i < _numObj; i++) { - object_t *obj = &_objects[i]; + Object *obj = &_objects[i]; if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling >= kCycleAlmostInvisible)) - objindex[num_objs++] = i; + objindex[objNumb++] = i; } // Sort the objects into increasing y+y2 (painter's algorithm) - qsort(objindex, num_objs, sizeof(objindex[0]), y2comp); + qsort(objindex, objNumb, sizeof(objindex[0]), y2comp); // Add each visible object to display list - for (int i = 0; i < num_objs; i++) { - object_t *obj = &_objects[objindex[i]]; + for (int i = 0; i < objNumb; i++) { + Object *obj = &_objects[objindex[i]]; // Count down inter-frame timer if (obj->_frameTimer) obj->_frameTimer--; @@ -90,7 +90,7 @@ void ObjectHandler_v1w::updateImages() { _vm->_screen->displayFrame(obj->_x, obj->_y, obj->_currImagePtr->_nextSeqPtr, obj->_priority == kPriorityOverOverlay); break; case kCycleBackward: { - seq_t *seqPtr = obj->_currImagePtr; + Seq *seqPtr = obj->_currImagePtr; if (!obj->_frameTimer) { // Show next frame while (seqPtr->_nextSeqPtr != obj->_currImagePtr) seqPtr = seqPtr->_nextSeqPtr; @@ -105,8 +105,8 @@ void ObjectHandler_v1w::updateImages() { } // Cycle any animating objects - for (int i = 0; i < num_objs; i++) { - object_t *obj = &_objects[objindex[i]]; + for (int i = 0; i < objNumb; i++) { + Object *obj = &_objects[objindex[i]]; if (obj->_cycling != kCycleInvisible) { // Only if it's visible if (obj->_cycling == kCycleAlmostInvisible) @@ -138,7 +138,7 @@ void ObjectHandler_v1w::updateImages() { case kCycleBackward: { if (!obj->_frameTimer) { // Time to step to prev frame - seq_t *seqPtr = obj->_currImagePtr; + Seq *seqPtr = obj->_currImagePtr; while (obj->_currImagePtr->_nextSeqPtr != seqPtr) obj->_currImagePtr = obj->_currImagePtr->_nextSeqPtr; // Find out if this is first frame of sequence @@ -180,8 +180,8 @@ void ObjectHandler_v1w::moveObjects() { // and store all (visible) object baselines into the boundary file. // Don't store foreground or background objects for (int i = 0; i < _numObj; i++) { - object_t *obj = &_objects[i]; // Get pointer to object - seq_t *currImage = obj->_currImagePtr; // Get ptr to current image + Object *obj = &_objects[i]; // Get pointer to object + Seq *currImage = obj->_currImagePtr; // Get ptr to current image if (obj->_screenIndex == *_vm->_screen_p) { switch (obj->_pathType) { case kPathChase: @@ -281,13 +281,13 @@ void ObjectHandler_v1w::moveObjects() { // Move objects, allowing for boundaries for (int i = 0; i < _numObj; i++) { - object_t *obj = &_objects[i]; // Get pointer to object + Object *obj = &_objects[i]; // Get pointer to object if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_vx || obj->_vy)) { // Only process if it's moving // Do object movement. Delta_x,y return allowed movement in x,y // to move as close to a boundary as possible without crossing it. - seq_t *currImage = obj->_currImagePtr; // Get ptr to current image + Seq *currImage = obj->_currImagePtr; // Get ptr to current image // object coordinates int x1 = obj->_x + currImage->_x1; // Left edge of object int x2 = obj->_x + currImage->_x2; // Right edge @@ -335,15 +335,15 @@ void ObjectHandler_v1w::moveObjects() { // Clear all object baselines from the boundary file. for (int i = 0; i < _numObj; i++) { - object_t *obj = &_objects[i]; // Get pointer to object - seq_t *currImage = obj->_currImagePtr; // Get ptr to current image + Object *obj = &_objects[i]; // Get pointer to object + Seq *currImage = obj->_currImagePtr; // Get ptr to current image if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) clearBoundary(obj->_oldx + currImage->_x1, obj->_oldx + currImage->_x2, obj->_oldy + currImage->_y2); } // If maze mode is enabled, do special maze processing if (_vm->_maze._enabledFl) { - seq_t *currImage = _vm->_hero->_currImagePtr; // Get ptr to current image + Seq *currImage = _vm->_hero->_currImagePtr; // Get ptr to current image // hero coordinates int x1 = _vm->_hero->_x + currImage->_x1; // Left edge of object int x2 = _vm->_hero->_x + currImage->_x2; // Right edge @@ -364,8 +364,8 @@ void ObjectHandler_v1w::swapImages(int objIndex1, int objIndex2) { saveSeq(&_objects[objIndex1]); - seqList_t tmpSeqList[kMaxSeqNumb]; - int seqListSize = sizeof(seqList_t) * kMaxSeqNumb; + SeqList tmpSeqList[kMaxSeqNumb]; + int seqListSize = sizeof(SeqList) * kMaxSeqNumb; memmove(tmpSeqList, _objects[objIndex1]._seqList, seqListSize); memmove(_objects[objIndex1]._seqList, _objects[objIndex2]._seqList, seqListSize); diff --git a/engines/hugo/object_v2d.cpp b/engines/hugo/object_v2d.cpp index 025374521c..f0d83269d5 100644 --- a/engines/hugo/object_v2d.cpp +++ b/engines/hugo/object_v2d.cpp @@ -59,21 +59,21 @@ void ObjectHandler_v2d::updateImages() { debugC(5, kDebugObject, "updateImages"); // Initialize the index array to visible objects in current screen - int num_objs = 0; + int objNumb = 0; byte objindex[kMaxObjNumb]; // Array of indeces to objects for (int i = 0; i < _numObj; i++) { - object_t *obj = &_objects[i]; + Object *obj = &_objects[i]; if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling >= kCycleAlmostInvisible)) - objindex[num_objs++] = i; + objindex[objNumb++] = i; } // Sort the objects into increasing y+y2 (painter's algorithm) - qsort(objindex, num_objs, sizeof(objindex[0]), y2comp); + qsort(objindex, objNumb, sizeof(objindex[0]), y2comp); // Add each visible object to display list - for (int i = 0; i < num_objs; i++) { - object_t *obj = &_objects[objindex[i]]; + for (int i = 0; i < objNumb; i++) { + Object *obj = &_objects[objindex[i]]; // Count down inter-frame timer if (obj->_frameTimer) obj->_frameTimer--; @@ -90,7 +90,7 @@ void ObjectHandler_v2d::updateImages() { _vm->_screen->displayFrame(obj->_x, obj->_y, obj->_currImagePtr->_nextSeqPtr, obj->_priority == kPriorityOverOverlay); break; case kCycleBackward: { - seq_t *seqPtr = obj->_currImagePtr; + Seq *seqPtr = obj->_currImagePtr; if (!obj->_frameTimer) { // Show next frame while (seqPtr->_nextSeqPtr != obj->_currImagePtr) seqPtr = seqPtr->_nextSeqPtr; @@ -107,8 +107,8 @@ void ObjectHandler_v2d::updateImages() { _vm->_scheduler->waitForRefresh(); // Cycle any animating objects - for (int i = 0; i < num_objs; i++) { - object_t *obj = &_objects[objindex[i]]; + for (int i = 0; i < objNumb; i++) { + Object *obj = &_objects[objindex[i]]; if (obj->_cycling != kCycleInvisible) { // Only if it's visible if (obj->_cycling == kCycleAlmostInvisible) @@ -140,7 +140,7 @@ void ObjectHandler_v2d::updateImages() { case kCycleBackward: { if (!obj->_frameTimer) { // Time to step to prev frame - seq_t *seqPtr = obj->_currImagePtr; + Seq *seqPtr = obj->_currImagePtr; while (obj->_currImagePtr->_nextSeqPtr != seqPtr) obj->_currImagePtr = obj->_currImagePtr->_nextSeqPtr; // Find out if this is first frame of sequence @@ -183,8 +183,8 @@ void ObjectHandler_v2d::moveObjects() { // and store all (visible) object baselines into the boundary file. // Don't store foreground or background objects for (int i = 0; i < _numObj; i++) { - object_t *obj = &_objects[i]; // Get pointer to object - seq_t *currImage = obj->_currImagePtr; // Get ptr to current image + Object *obj = &_objects[i]; // Get pointer to object + Seq *currImage = obj->_currImagePtr; // Get ptr to current image if (obj->_screenIndex == *_vm->_screen_p) { switch (obj->_pathType) { case kPathChase: @@ -284,13 +284,13 @@ void ObjectHandler_v2d::moveObjects() { // Move objects, allowing for boundaries for (int i = 0; i < _numObj; i++) { - object_t *obj = &_objects[i]; // Get pointer to object + Object *obj = &_objects[i]; // Get pointer to object if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_vx || obj->_vy)) { // Only process if it's moving // Do object movement. Delta_x,y return allowed movement in x,y // to move as close to a boundary as possible without crossing it. - seq_t *currImage = obj->_currImagePtr; // Get ptr to current image + Seq *currImage = obj->_currImagePtr; // Get ptr to current image // object coordinates int x1 = obj->_x + currImage->_x1; // Left edge of object int x2 = obj->_x + currImage->_x2; // Right edge @@ -338,15 +338,15 @@ void ObjectHandler_v2d::moveObjects() { // Clear all object baselines from the boundary file. for (int i = 0; i < _numObj; i++) { - object_t *obj = &_objects[i]; // Get pointer to object - seq_t *currImage = obj->_currImagePtr; // Get ptr to current image + Object *obj = &_objects[i]; // Get pointer to object + Seq *currImage = obj->_currImagePtr; // Get ptr to current image if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) clearBoundary(obj->_oldx + currImage->_x1, obj->_oldx + currImage->_x2, obj->_oldy + currImage->_y2); } // If maze mode is enabled, do special maze processing if (_vm->_maze._enabledFl) { - seq_t *currImage = _vm->_hero->_currImagePtr; // Get ptr to current image + Seq *currImage = _vm->_hero->_currImagePtr; // Get ptr to current image // hero coordinates int x1 = _vm->_hero->_x + currImage->_x1; // Left edge of object int x2 = _vm->_hero->_x + currImage->_x2; // Right edge @@ -359,8 +359,8 @@ void ObjectHandler_v2d::moveObjects() { 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]; + Object *obj1 = &_objects[objIndex1]; + Object *obj2 = &_objects[objIndex2]; obj1->_pathType = kPathAuto; int dx = obj1->_x + obj1->_currImagePtr->_x1 - obj2->_x - obj2->_currImagePtr->_x1; int dy = obj1->_y + obj1->_currImagePtr->_y1 - obj2->_y - obj2->_currImagePtr->_y1; diff --git a/engines/hugo/object_v3d.cpp b/engines/hugo/object_v3d.cpp index 15d5fcd936..13c9c8c93d 100644 --- a/engines/hugo/object_v3d.cpp +++ b/engines/hugo/object_v3d.cpp @@ -64,8 +64,8 @@ void ObjectHandler_v3d::moveObjects() { // and store all (visible) object baselines into the boundary file. // Don't store foreground or background objects for (int i = 0; i < _numObj; i++) { - object_t *obj = &_objects[i]; // Get pointer to object - seq_t *currImage = obj->_currImagePtr; // Get ptr to current image + Object *obj = &_objects[i]; // Get pointer to object + Seq *currImage = obj->_currImagePtr; // Get ptr to current image if (obj->_screenIndex == *_vm->_screen_p) { switch (obj->_pathType) { case kPathChase: @@ -166,13 +166,13 @@ void ObjectHandler_v3d::moveObjects() { // Move objects, allowing for boundaries for (int i = 0; i < _numObj; i++) { - object_t *obj = &_objects[i]; // Get pointer to object + Object *obj = &_objects[i]; // Get pointer to object if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_vx || obj->_vy)) { // Only process if it's moving // Do object movement. Delta_x,y return allowed movement in x,y // to move as close to a boundary as possible without crossing it. - seq_t *currImage = obj->_currImagePtr; // Get ptr to current image + Seq *currImage = obj->_currImagePtr; // Get ptr to current image // object coordinates int x1 = obj->_x + currImage->_x1; // Left edge of object int x2 = obj->_x + currImage->_x2; // Right edge @@ -220,15 +220,15 @@ void ObjectHandler_v3d::moveObjects() { // Clear all object baselines from the boundary file. for (int i = 0; i < _numObj; i++) { - object_t *obj = &_objects[i]; // Get pointer to object - seq_t *currImage = obj->_currImagePtr; // Get ptr to current image + Object *obj = &_objects[i]; // Get pointer to object + Seq *currImage = obj->_currImagePtr; // Get ptr to current image if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) clearBoundary(obj->_oldx + currImage->_x1, obj->_oldx + currImage->_x2, obj->_oldy + currImage->_y2); } // If maze mode is enabled, do special maze processing if (_vm->_maze._enabledFl) { - seq_t *currImage = _vm->_hero->_currImagePtr;// Get ptr to current image + Seq *currImage = _vm->_hero->_currImagePtr;// Get ptr to current image // hero coordinates int x1 = _vm->_hero->_x + currImage->_x1; // Left edge of object int x2 = _vm->_hero->_x + currImage->_x2; // Right edge @@ -249,8 +249,8 @@ void ObjectHandler_v3d::swapImages(int objIndex1, int objIndex2) { saveSeq(&_objects[objIndex1]); - seqList_t tmpSeqList[kMaxSeqNumb]; - int seqListSize = sizeof(seqList_t) * kMaxSeqNumb; + SeqList tmpSeqList[kMaxSeqNumb]; + int seqListSize = sizeof(SeqList) * kMaxSeqNumb; memmove(tmpSeqList, _objects[objIndex1]._seqList, seqListSize); memmove(_objects[objIndex1]._seqList, _objects[objIndex2]._seqList, seqListSize); diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp index 3b0eb1d979..68343a0374 100644 --- a/engines/hugo/parser.cpp +++ b/engines/hugo/parser.cpp @@ -99,7 +99,7 @@ void Parser::loadCmdList(Common::ReadStream &in) { } -void Parser::readBG(Common::ReadStream &in, background_t &curBG) { +void Parser::readBG(Common::ReadStream &in, Background &curBG) { curBG._verbIndex = in.readUint16BE(); curBG._nounIndex = in.readUint16BE(); curBG._commentIndex = in.readSint16BE(); @@ -112,7 +112,7 @@ void Parser::readBG(Common::ReadStream &in, background_t &curBG) { * Read _backgrounObjects from Hugo.dat */ void Parser::loadBackgroundObjects(Common::ReadStream &in) { - background_t tmpBG; + Background tmpBG; memset(&tmpBG, 0, sizeof(tmpBG)); for (int varnt = 0; varnt < _vm->_numVariant; varnt++) { @@ -120,13 +120,13 @@ void Parser::loadBackgroundObjects(Common::ReadStream &in) { if (varnt == _vm->_gameVariant) { _backgroundObjectsSize = numElem; - _backgroundObjects = (background_t **)malloc(sizeof(background_t *) * numElem); + _backgroundObjects = (Background **)malloc(sizeof(Background *) * numElem); } for (int i = 0; i < numElem; i++) { uint16 numSubElem = in.readUint16BE(); if (varnt == _vm->_gameVariant) - _backgroundObjects[i] = (background_t *)malloc(sizeof(background_t) * numSubElem); + _backgroundObjects[i] = (Background *)malloc(sizeof(Background) * numSubElem); for (int j = 0; j < numSubElem; j++) readBG(in, (varnt == _vm->_gameVariant) ? _backgroundObjects[i][j] : tmpBG); @@ -138,15 +138,15 @@ void Parser::loadBackgroundObjects(Common::ReadStream &in) { * Read _catchallList from Hugo.dat */ void Parser::loadCatchallList(Common::ReadStream &in) { - background_t *wrkCatchallList = 0; - background_t tmpBG; + Background *wrkCatchallList = 0; + Background tmpBG; memset(&tmpBG, 0, sizeof(tmpBG)); for (int varnt = 0; varnt < _vm->_numVariant; varnt++) { uint16 numElem = in.readUint16BE(); if (varnt == _vm->_gameVariant) - _catchallList = wrkCatchallList = (background_t *)malloc(sizeof(background_t) * numElem); + _catchallList = wrkCatchallList = (Background *)malloc(sizeof(Background) * numElem); for (int i = 0; i < numElem; i++) readBG(in, (varnt == _vm->_gameVariant) ? wrkCatchallList[i] : tmpBG); @@ -164,7 +164,7 @@ void Parser::loadArrayReqs(Common::SeekableReadStream &in) { const char *Parser::useBG(const char *name) { debugC(1, kDebugEngine, "useBG(%s)", name); - objectList_t p = _backgroundObjects[*_vm->_screen_p]; + ObjectList p = _backgroundObjects[*_vm->_screen_p]; for (int i = 0; p[i]._verbIndex != 0; i++) { if ((name == _vm->_text->getNoun(p[i]._nounIndex, 0) && p[i]._verbIndex != _vm->_look) && @@ -208,7 +208,7 @@ void Parser::switchTurbo() { void Parser::charHandler() { debugC(4, kDebugParser, "charHandler"); - status_t &gameStatus = _vm->getGameStatus(); + Status &gameStatus = _vm->getGameStatus(); // Check for one or more characters in ring buffer while (_getIndex != _putIndex) { @@ -268,7 +268,7 @@ void Parser::charHandler() { void Parser::keyHandler(Common::Event event) { debugC(1, kDebugParser, "keyHandler(%d)", event.kbd.keycode); - status_t &gameStatus = _vm->getGameStatus(); + Status &gameStatus = _vm->getGameStatus(); uint16 nChar = event.kbd.keycode; if (event.kbd.flags & (Common::KBD_ALT | Common::KBD_SCRL)) diff --git a/engines/hugo/parser.h b/engines/hugo/parser.h index 18f4916b1e..e72c46f591 100644 --- a/engines/hugo/parser.h +++ b/engines/hugo/parser.h @@ -64,7 +64,7 @@ struct cmd { * interesting ever happens with them. Rather than just be dumb and say * "don't understand" we produce an interesting msg to keep user sane. */ -struct background_t { +struct Background { uint16 _verbIndex; uint16 _nounIndex; int _commentIndex; // Index of comment produced on match @@ -73,7 +73,7 @@ struct background_t { byte _bonusIndex; // Index of bonus score (0 = no bonus) }; -typedef background_t *objectList_t; +typedef Background *ObjectList; class Parser { public: @@ -97,7 +97,7 @@ public: virtual void lineHandler() = 0; virtual void showInventory() const = 0; - virtual void takeObject(object_t *obj) = 0; + virtual void takeObject(Object *obj) = 0; protected: HugoEngine *_vm; @@ -105,18 +105,18 @@ protected: int16 _cmdLineIndex; // Index into line uint32 _cmdLineTick; // For flashing cursor char _cmdLineCursor; - command_t _cmdLine; // Build command line + Command _cmdLine; // Build command line uint16 _backgroundObjectsSize; uint16 _cmdListSize; uint16 **_arrayReqs; - background_t **_backgroundObjects; - background_t *_catchallList; + Background **_backgroundObjects; + Background *_catchallList; cmd **_cmdList; const char *findNoun() const; const char *findVerb() const; - void readBG(Common::ReadStream &in, background_t &curBG); + void readBG(Common::ReadStream &in, Background &curBG); void readCmd(Common::ReadStream &in, cmd &curCmd); void showDosInventory() const; @@ -136,17 +136,17 @@ public: virtual void lineHandler(); virtual void showInventory() const; - virtual void takeObject(object_t *obj); + virtual void takeObject(Object *obj); protected: - virtual void dropObject(object_t *obj); + virtual void dropObject(Object *obj); const char *findNextNoun(const char *noun) const; - bool isBackgroundWord_v1(const char *noun, const char *verb, objectList_t obj) const; - bool isCatchallVerb_v1(bool testNounFl, const char *noun, const char *verb, objectList_t obj) const; - bool isGenericVerb_v1(const char *word, object_t *obj); - bool isNear_v1(const char *verb, const char *noun, object_t *obj, char *comment) const; - bool isObjectVerb_v1(const char *word, object_t *obj); + bool isBackgroundWord_v1(const char *noun, const char *verb, ObjectList obj) const; + bool isCatchallVerb_v1(bool testNounFl, const char *noun, const char *verb, ObjectList obj) const; + bool isGenericVerb_v1(const char *word, Object *obj); + bool isNear_v1(const char *verb, const char *noun, Object *obj, char *comment) const; + bool isObjectVerb_v1(const char *word, Object *obj); }; class Parser_v2d : public Parser_v1d { @@ -164,13 +164,13 @@ public: virtual void lineHandler(); protected: - void dropObject(object_t *obj); - bool isBackgroundWord_v3(objectList_t obj) const; - bool isCatchallVerb_v3(objectList_t obj) const; - bool isGenericVerb_v3(object_t *obj, char *comment); - bool isNear_v3(object_t *obj, const char *verb, char *comment) const; - bool isObjectVerb_v3(object_t *obj, char *comment); - void takeObject(object_t *obj); + void dropObject(Object *obj); + bool isBackgroundWord_v3(ObjectList obj) const; + bool isCatchallVerb_v3(ObjectList obj) const; + bool isGenericVerb_v3(Object *obj, char *comment); + bool isNear_v3(Object *obj, const char *verb, char *comment) const; + bool isObjectVerb_v3(Object *obj, char *comment); + void takeObject(Object *obj); }; class Parser_v1w : public Parser_v3d { diff --git a/engines/hugo/parser_v1d.cpp b/engines/hugo/parser_v1d.cpp index aa43cce536..f29a03f796 100644 --- a/engines/hugo/parser_v1d.cpp +++ b/engines/hugo/parser_v1d.cpp @@ -78,7 +78,7 @@ const char *Parser_v1d::findNextNoun(const char *noun) const { * If object not near, return suitable string; may be similar object closer * If radius is -1, treat radius as infinity */ -bool Parser_v1d::isNear_v1(const char *verb, const char *noun, object_t *obj, char *comment) const { +bool Parser_v1d::isNear_v1(const char *verb, const char *noun, Object *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 @@ -140,8 +140,8 @@ bool Parser_v1d::isNear_v1(const char *verb, const char *noun, object_t *obj, ch * say_ok needed for special case of take/drop which may be handled not only * here but also in a cmd_list with a donestr string simultaneously */ -bool Parser_v1d::isGenericVerb_v1(const char *word, object_t *obj) { - debugC(1, kDebugParser, "isGenericVerb(%s, object_t *obj)", word); +bool Parser_v1d::isGenericVerb_v1(const char *word, Object *obj) { + debugC(1, kDebugParser, "isGenericVerb(%s, Object *obj)", word); if (!obj->_genericCmd) return false; @@ -181,8 +181,8 @@ bool Parser_v1d::isGenericVerb_v1(const char *word, object_t *obj) { * and if it passes, perform the actions in the action list. If the verb * is catered for, return TRUE */ -bool Parser_v1d::isObjectVerb_v1(const char *word, object_t *obj) { - debugC(1, kDebugParser, "isObjectVerb(%s, object_t *obj)", word); +bool Parser_v1d::isObjectVerb_v1(const char *word, Object *obj) { + debugC(1, kDebugParser, "isObjectVerb(%s, Object *obj)", word); // First, find matching verb in cmd list uint16 cmdIndex = obj->_cmdIndex; // ptr to list of commands @@ -231,7 +231,7 @@ bool Parser_v1d::isObjectVerb_v1(const 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_v1(const char *noun, const char *verb, objectList_t obj) const { +bool Parser_v1d::isBackgroundWord_v1(const char *noun, const char *verb, ObjectList obj) const { debugC(1, kDebugParser, "isBackgroundWord(%s, %s, object_list_t obj)", noun, verb); if (!noun) @@ -249,8 +249,8 @@ bool Parser_v1d::isBackgroundWord_v1(const char *noun, const char *verb, objectL /** * Do all things necessary to carry an object */ -void Parser_v1d::takeObject(object_t *obj) { - debugC(1, kDebugParser, "takeObject(object_t *obj)"); +void Parser_v1d::takeObject(Object *obj) { + debugC(1, kDebugParser, "takeObject(Object *obj)"); obj->_carriedFl = true; if (obj->_seqNumb) // Don't change if no image to display @@ -264,8 +264,8 @@ void Parser_v1d::takeObject(object_t *obj) { /** * Do all necessary things to drop an object */ -void Parser_v1d::dropObject(object_t *obj) { - debugC(1, kDebugParser, "dropObject(object_t *obj)"); +void Parser_v1d::dropObject(Object *obj) { + debugC(1, kDebugParser, "dropObject(Object *obj)"); obj->_carriedFl = false; obj->_screenIndex = *_vm->_screen_p; @@ -281,7 +281,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_v1(bool testNounFl, const char *noun, const char *verb, objectList_t obj) const { +bool Parser_v1d::isCatchallVerb_v1(bool testNounFl, const char *noun, const char *verb, ObjectList obj) const { debugC(1, kDebugParser, "isCatchallVerb(%d, %s, %s, object_list_t obj)", (testNounFl) ? 1 : 0, noun, verb); if (_vm->_maze._enabledFl) @@ -305,7 +305,7 @@ bool Parser_v1d::isCatchallVerb_v1(bool testNounFl, const char *noun, const char void Parser_v1d::lineHandler() { debugC(1, kDebugParser, "lineHandler()"); - status_t &gameStatus = _vm->getGameStatus(); + Status &gameStatus = _vm->getGameStatus(); // Toggle God Mode if (!strncmp(_vm->_line, "PPG", 3)) { @@ -403,7 +403,7 @@ void Parser_v1d::lineHandler() { noun = findNextNoun(noun); // Find a noun in the line // Must try at least once for objects allowing verb-context for (int i = 0; i < _vm->_object->_numObj; i++) { - object_t *obj = &_vm->_object->_objects[i]; + Object *obj = &_vm->_object->_objects[i]; if (isNear_v1(verb, noun, obj, farComment)) { if (isObjectVerb_v1(verb, obj) // Foreground object || isGenericVerb_v1(verb, obj))// Common action type @@ -424,7 +424,7 @@ void Parser_v1d::lineHandler() { } void Parser_v1d::showInventory() const { - status_t &gameStatus = _vm->getGameStatus(); + Status &gameStatus = _vm->getGameStatus(); if (gameStatus._viewState == kViewPlay) { if (gameStatus._gameOverFl) _vm->gameOverMsg(); diff --git a/engines/hugo/parser_v1w.cpp b/engines/hugo/parser_v1w.cpp index 832e6fd1b0..8c0da63554 100644 --- a/engines/hugo/parser_v1w.cpp +++ b/engines/hugo/parser_v1w.cpp @@ -56,7 +56,7 @@ Parser_v1w::~Parser_v1w() { void Parser_v1w::lineHandler() { debugC(1, kDebugParser, "lineHandler()"); - status_t &gameStatus = _vm->getGameStatus(); + Status &gameStatus = _vm->getGameStatus(); // Toggle God Mode if (!strncmp(_vm->_line, "PPG", 3)) { @@ -147,7 +147,7 @@ void Parser_v1w::lineHandler() { // Test for nearby objects referenced explicitly for (int i = 0; i < _vm->_object->_numObj; i++) { - object_t *obj = &_vm->_object->_objects[i]; + Object *obj = &_vm->_object->_objects[i]; if (isWordPresent(_vm->_text->getNounArray(obj->_nounIndex))) { if (isObjectVerb_v3(obj, farComment) || isGenericVerb_v3(obj, farComment)) return; @@ -157,7 +157,7 @@ void Parser_v1w::lineHandler() { // Test for nearby objects that only require a verb // Note comment is unused if not near. for (int i = 0; i < _vm->_object->_numObj; i++) { - object_t *obj = &_vm->_object->_objects[i]; + Object *obj = &_vm->_object->_objects[i]; if (obj->_verbOnlyFl) { char contextComment[kCompLineSize * 5] = ""; // Unused comment for context objects if (isObjectVerb_v3(obj, contextComment) || isGenericVerb_v3(obj, contextComment)) @@ -200,8 +200,8 @@ void Parser_v1w::lineHandler() { } void Parser_v1w::showInventory() const { - status_t &gameStatus = _vm->getGameStatus(); - istate_t inventState = _vm->_inventory->getInventoryState(); + Status &gameStatus = _vm->getGameStatus(); + Istate inventState = _vm->_inventory->getInventoryState(); if (gameStatus._gameOverFl) { _vm->gameOverMsg(); } else if ((inventState == kInventoryOff) && (gameStatus._viewState == kViewPlay)) { diff --git a/engines/hugo/parser_v2d.cpp b/engines/hugo/parser_v2d.cpp index 2daf3c5e9f..674836b90e 100644 --- a/engines/hugo/parser_v2d.cpp +++ b/engines/hugo/parser_v2d.cpp @@ -55,7 +55,7 @@ Parser_v2d::~Parser_v2d() { void Parser_v2d::lineHandler() { debugC(1, kDebugParser, "lineHandler()"); - status_t &gameStatus = _vm->getGameStatus(); + Status &gameStatus = _vm->getGameStatus(); // Toggle God Mode if (!strncmp(_vm->_line, "PPG", 3)) { @@ -153,7 +153,7 @@ void Parser_v2d::lineHandler() { noun = findNextNoun(noun); // Find a noun in the line // Must try at least once for objects allowing verb-context for (int i = 0; i < _vm->_object->_numObj; i++) { - object_t *obj = &_vm->_object->_objects[i]; + Object *obj = &_vm->_object->_objects[i]; if (isNear_v1(verb, noun, obj, farComment)) { if (isObjectVerb_v1(verb, obj) // Foreground object || isGenericVerb_v1(verb, obj))// Common action type diff --git a/engines/hugo/parser_v3d.cpp b/engines/hugo/parser_v3d.cpp index abfe263f6e..9bbaf49f67 100644 --- a/engines/hugo/parser_v3d.cpp +++ b/engines/hugo/parser_v3d.cpp @@ -55,7 +55,7 @@ Parser_v3d::~Parser_v3d() { void Parser_v3d::lineHandler() { debugC(1, kDebugParser, "lineHandler()"); - status_t &gameStatus = _vm->getGameStatus(); + Status &gameStatus = _vm->getGameStatus(); // Toggle God Mode if (!strncmp(_vm->_line, "PPG", 3)) { @@ -149,7 +149,7 @@ void Parser_v3d::lineHandler() { // Test for nearby objects referenced explicitly for (int i = 0; i < _vm->_object->_numObj; i++) { - object_t *obj = &_vm->_object->_objects[i]; + Object *obj = &_vm->_object->_objects[i]; if (isWordPresent(_vm->_text->getNounArray(obj->_nounIndex))) { if (isObjectVerb_v3(obj, farComment) || isGenericVerb_v3(obj, farComment)) return; @@ -159,7 +159,7 @@ void Parser_v3d::lineHandler() { // Test for nearby objects that only require a verb // Note comment is unused if not near. for (int i = 0; i < _vm->_object->_numObj; i++) { - object_t *obj = &_vm->_object->_objects[i]; + Object *obj = &_vm->_object->_objects[i]; if (obj->_verbOnlyFl) { char contextComment[kCompLineSize * 5] = ""; // Unused comment for context objects if (isObjectVerb_v3(obj, contextComment) || isGenericVerb_v3(obj, contextComment)) @@ -204,8 +204,8 @@ void Parser_v3d::lineHandler() { * If it does, and the object is near and passes the tests in the command * list then carry out the actions in the action list and return TRUE */ -bool Parser_v3d::isObjectVerb_v3(object_t *obj, char *comment) { - debugC(1, kDebugParser, "isObjectVerb(object_t *obj, %s)", comment); +bool Parser_v3d::isObjectVerb_v3(Object *obj, char *comment) { + debugC(1, kDebugParser, "isObjectVerb(Object *obj, %s)", comment); // First, find matching verb in cmd list uint16 cmdIndex = obj->_cmdIndex; // ptr to list of commands @@ -259,8 +259,8 @@ bool Parser_v3d::isObjectVerb_v3(object_t *obj, char *comment) { /** * Test whether command line contains one of the generic actions */ -bool Parser_v3d::isGenericVerb_v3(object_t *obj, char *comment) { - debugC(1, kDebugParser, "isGenericVerb(object_t *obj, %s)", comment); +bool Parser_v3d::isGenericVerb_v3(Object *obj, char *comment) { + debugC(1, kDebugParser, "isGenericVerb(Object *obj, %s)", comment); if (!obj->_genericCmd) return false; @@ -313,8 +313,8 @@ bool Parser_v3d::isGenericVerb_v3(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_v3(object_t *obj, const char *verb, char *comment) const { - debugC(1, kDebugParser, "isNear(object_t *obj, %s, %s)", verb, comment); +bool Parser_v3d::isNear_v3(Object *obj, const char *verb, char *comment) const { + debugC(1, kDebugParser, "isNear(Object *obj, %s, %s)", verb, comment); if (obj->_carriedFl) // Object is being carried return true; @@ -368,8 +368,8 @@ bool Parser_v3d::isNear_v3(object_t *obj, const char *verb, char *comment) const /** * Do all things necessary to carry an object */ -void Parser_v3d::takeObject(object_t *obj) { - debugC(1, kDebugParser, "takeObject(object_t *obj)"); +void Parser_v3d::takeObject(Object *obj) { + debugC(1, kDebugParser, "takeObject(Object *obj)"); obj->_carriedFl = true; if (obj->_seqNumb) { // Don't change if no image to display @@ -385,8 +385,8 @@ void Parser_v3d::takeObject(object_t *obj) { /** * Do all necessary things to drop an object */ -void Parser_v3d::dropObject(object_t *obj) { - debugC(1, kDebugParser, "dropObject(object_t *obj)"); +void Parser_v3d::dropObject(Object *obj) { + debugC(1, kDebugParser, "dropObject(Object *obj)"); obj->_carriedFl = false; obj->_screenIndex = *_vm->_screen_p; @@ -407,7 +407,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_v3(objectList_t obj) const { +bool Parser_v3d::isCatchallVerb_v3(ObjectList obj) const { debugC(1, kDebugParser, "isCatchallVerb(object_list_t obj)"); if (_vm->_maze._enabledFl) @@ -435,7 +435,7 @@ bool Parser_v3d::isCatchallVerb_v3(objectList_t obj) const { * 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_v3(objectList_t obj) const { +bool Parser_v3d::isBackgroundWord_v3(ObjectList obj) const { debugC(1, kDebugParser, "isBackgroundWord(object_list_t obj)"); if (_vm->_maze._enabledFl) diff --git a/engines/hugo/route.cpp b/engines/hugo/route.cpp index 873cb587af..45d72bafb1 100644 --- a/engines/hugo/route.cpp +++ b/engines/hugo/route.cpp @@ -61,7 +61,7 @@ int16 Route::getRouteIndex() const { void Route::setDirection(const uint16 keyCode) { debugC(1, kDebugRoute, "setDirection(%d)", keyCode); - object_t *obj = _vm->_hero; // Pointer to hero object + Object *obj = _vm->_hero; // Pointer to hero object // Set first image in sequence switch (keyCode) { @@ -107,7 +107,7 @@ void Route::setDirection(const uint16 keyCode) { void Route::setWalk(const uint16 direction) { debugC(1, kDebugRoute, "setWalk(%d)", direction); - object_t *obj = _vm->_hero; // Pointer to hero object + Object *obj = _vm->_hero; // Pointer to hero object if (_vm->getGameStatus()._storyModeFl || obj->_pathType != kPathUser) // Make sure user has control return; @@ -188,8 +188,8 @@ void Route::segment(int16 x, int16 y) { debugC(1, kDebugRoute, "segment(%d, %d)", x, y); // Note: use of static - can't waste stack - static image_pt p; // Ptr to _boundaryMap[y] - static segment_t *seg_p; // Ptr to segment + static ImagePtr p; // Ptr to _boundaryMap[y] + static Segment *segPtr; // Ptr to segment // Bomb out if stack exhausted // Vinterstum: Is this just a safeguard, or actually used? @@ -285,10 +285,10 @@ void Route::segment(int16 x, int16 y) { _fullSegmentFl = true; } else { // Create segment - seg_p = &_segment[_segmentNumb]; - seg_p->_y = y; - seg_p->_x1 = x1; - seg_p->_x2 = x2; + segPtr = &_segment[_segmentNumb]; + segPtr->_y = y; + segPtr->_x1 = x1; + segPtr->_x2 = x2; _segmentNumb++; } } @@ -332,7 +332,7 @@ bool Route::findRoute(const int16 cx, const int16 cy) { int16 heroy = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2; // Hero baseline // Store all object baselines into objbound (except hero's = [0]) - object_t *obj; // Ptr to object + Object *obj; // Ptr to object int i; for (i = 1, obj = &_vm->_object->_objects[i]; i < _vm->_object->_numObj; i++, obj++) { if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling != kCycleInvisible) && (obj->_priority == kPriorityFloating)) @@ -382,18 +382,18 @@ bool Route::findRoute(const int16 cx, const int16 cy) { // Look ahead for furthest straight line for (int16 j = i + 1; j < _segmentNumb; j++) { - segment_t *seg_p = &_segment[j]; + Segment *segPtr = &_segment[j]; // Can we get to this segment from previous node? - if (seg_p->_x1 <= routeNode->x && seg_p->_x2 >= routeNode->x + _heroWidth - 1) { - routeNode->y = seg_p->_y; // Yes, keep updating node + if (segPtr->_x1 <= routeNode->x && segPtr->_x2 >= routeNode->x + _heroWidth - 1) { + routeNode->y = segPtr->_y; // Yes, keep updating node } else { // No, create another node on previous segment to reach it if ((routeNode = newNode()) == 0) // Add new route node return false; // Too many nodes // Find overlap between old and new segments - int16 x1 = MAX(_segment[j - 1]._x1, seg_p->_x1); - int16 x2 = MIN(_segment[j - 1]._x2, seg_p->_x2); + int16 x1 = MAX(_segment[j - 1]._x1, segPtr->_x1); + int16 x2 = MIN(_segment[j - 1]._x2, segPtr->_x2); // If room, add a little offset to reduce staircase effect int16 dx = kHeroMaxWidth >> 1; @@ -500,7 +500,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(const go_t routeType, const int16 objId, int16 cx, int16 cy) { +bool Route::startRoute(const RouteType routeType, const int16 objId, int16 cx, int16 cy) { debugC(1, kDebugRoute, "startRoute(%d, %d, %d, %d)", routeType, objId, 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 53b0dd0f88..716829a201 100644 --- a/engines/hugo/route.h +++ b/engines/hugo/route.h @@ -37,11 +37,11 @@ namespace Hugo { /** * Purpose of an automatic route */ -enum go_t {kRouteSpace, kRouteExit, kRouteLook, kRouteGet}; +enum RouteType {kRouteSpace, kRouteExit, kRouteLook, kRouteGet}; -struct segment_t { // Search segment - int16 _y; // y position - int16 _x1, _x2; // Range of segment +struct Segment { // Search segment + int16 _y; // y position + int16 _x1, _x2; // Range of segment }; class Route { @@ -52,7 +52,7 @@ public: int16 getRouteIndex() const; void processRoute(); - bool startRoute(const go_t routeType, const int16 objId, int16 cx, int16 cy); + bool startRoute(const RouteType routeType, const int16 objId, int16 cx, int16 cy); void setDirection(const uint16 keyCode); void setWalk(const uint16 direction); @@ -66,12 +66,12 @@ private: uint16 _oldWalkDirection; // Last direction char - int16 _routeIndex; // Index into route list, or -1 - go_t _routeType; // Purpose of an automatic route - int16 _routeObjId; // Index of exit of object walking to + int16 _routeIndex; // Index into route list, or -1 + RouteType _routeType; // Purpose of an automatic route + int16 _routeObjId; // Index of exit of object walking to byte _boundaryMap[kYPix][kXPix]; // Boundary byte map - segment_t _segment[kMaxSeg]; // List of points in fill-path + Segment _segment[kMaxSeg]; // List of points in fill-path Common::Point _route[kMaxNodes]; // List of nodes in route (global) int16 _segmentNumb; // Count number of segments int16 _routeListIndex; // Index into route list diff --git a/engines/hugo/schedule.cpp b/engines/hugo/schedule.cpp index 0e57b08f19..3bbec6670e 100644 --- a/engines/hugo/schedule.cpp +++ b/engines/hugo/schedule.cpp @@ -83,12 +83,12 @@ void Scheduler::initEventQueue() { /** * Return a ptr to an event structure from the free list */ -event_t *Scheduler::getQueue() { +Event *Scheduler::getQueue() { debugC(4, kDebugSchedule, "getQueue"); if (!_freeEvent) // Error: no more events available error("An error has occurred: %s", "getQueue"); - event_t *resEvent = _freeEvent; + Event *resEvent = _freeEvent; _freeEvent = _freeEvent->_nextEvent; resEvent->_nextEvent = 0; return resEvent; @@ -175,8 +175,8 @@ void Scheduler::newScreen(const int screenIndex) { } // 1. Clear out all local events - event_t *curEvent = _headEvent; // The earliest event - event_t *wrkEvent; // Event ptr + Event *curEvent = _headEvent; // The earliest event + Event *wrkEvent; // Event ptr while (curEvent) { // While mature events found wrkEvent = curEvent->_nextEvent; // Save p (becomes undefined after Del) if (curEvent->_localActionFl) @@ -259,7 +259,7 @@ void Scheduler::loadPoints(Common::SeekableReadStream &in) { uint16 numElem = in.readUint16BE(); if (varnt == _vm->_gameVariant) { _numBonuses = numElem; - _points = (point_t *)malloc(sizeof(point_t) * _numBonuses); + _points = (Point *)malloc(sizeof(Point) * _numBonuses); for (int i = 0; i < _numBonuses; i++) { _points[i]._score = in.readByte(); _points[i]._scoredFl = false; @@ -270,10 +270,10 @@ void Scheduler::loadPoints(Common::SeekableReadStream &in) { } } -void Scheduler::readAct(Common::ReadStream &in, act &curAct) { +void Scheduler::readAct(Common::ReadStream &in, Act &curAct) { uint16 numSubAct; - curAct._a0._actType = (action_t) in.readByte(); + curAct._a0._actType = (Action) in.readByte(); switch (curAct._a0._actType) { case ANULL: // -1 break; @@ -285,7 +285,7 @@ void Scheduler::readAct(Common::ReadStream &in, act &curAct) { curAct._a1._timer = in.readSint16BE(); curAct._a1._objIndex = in.readSint16BE(); curAct._a1._cycleNumb = in.readSint16BE(); - curAct._a1._cycle = (cycle_t) in.readByte(); + curAct._a1._cycle = (Cycle) in.readByte(); break; case INIT_OBJXY: // 2 curAct._a2._timer = in.readSint16BE(); @@ -393,7 +393,7 @@ void Scheduler::readAct(Common::ReadStream &in, act &curAct) { break; case DEL_EVENTS: // 20 curAct._a20._timer = in.readSint16BE(); - curAct._a20._actTypeDel = (action_t) in.readByte(); + curAct._a20._actTypeDel = (Action) in.readByte(); break; case GAMEOVER: // 21 curAct._a21._timer = in.readSint16BE(); @@ -553,20 +553,20 @@ void Scheduler::readAct(Common::ReadStream &in, act &curAct) { void Scheduler::loadActListArr(Common::ReadStream &in) { debugC(6, kDebugSchedule, "loadActListArr(&in)"); - act tmpAct; + Act tmpAct; int numElem, numSubElem; for (int varnt = 0; varnt < _vm->_numVariant; varnt++) { numElem = in.readUint16BE(); if (varnt == _vm->_gameVariant) { _actListArrSize = numElem; - _actListArr = (act **)malloc(sizeof(act *) * _actListArrSize); + _actListArr = (Act **)malloc(sizeof(Act *) * _actListArrSize); } for (int i = 0; i < numElem; i++) { numSubElem = in.readUint16BE(); if (varnt == _vm->_gameVariant) - _actListArr[i] = (act *)malloc(sizeof(act) * (numSubElem + 1)); + _actListArr[i] = (Act *)malloc(sizeof(Act) * (numSubElem + 1)); for (int j = 0; j < numSubElem; j++) { if (varnt == _vm->_gameVariant) { readAct(in, _actListArr[i][j]); @@ -708,7 +708,7 @@ void Scheduler::saveEvents(Common::WriteStream *f) { // Convert event ptrs to indexes for (int16 i = 0; i < kMaxEvents; i++) { - event_t *wrkEvent = &_events[i]; + Event *wrkEvent = &_events[i]; // fix up action pointer (to do better) int16 index, subElem; @@ -1039,7 +1039,7 @@ void Scheduler::saveActions(Common::WriteStream *f) const { /* * Find the index in the action list to be able to serialize the action to save game */ -void Scheduler::findAction(const act* action, int16* index, int16* subElem) { +void Scheduler::findAction(const Act *action, int16 *index, int16 *subElem) { assert(index && subElem); if (!action) { @@ -1104,7 +1104,7 @@ void Scheduler::restoreEvents(Common::ReadStream *f) { if ((index == -1) && (subElem == -1)) _events[i]._action = 0; else - _events[i]._action = (act *)&_actListArr[index][subElem]; + _events[i]._action = (Act *)&_actListArr[index][subElem]; _events[i]._localActionFl = (f->readByte() == 1) ? true : false; _events[i]._time = f->readUint32BE(); @@ -1112,8 +1112,8 @@ void Scheduler::restoreEvents(Common::ReadStream *f) { int16 prevIndex = f->readSint16BE(); int16 nextIndex = f->readSint16BE(); - _events[i]._prevEvent = (prevIndex == -1) ? (event_t *)0 : &_events[prevIndex]; - _events[i]._nextEvent = (nextIndex == -1) ? (event_t *)0 : &_events[nextIndex]; + _events[i]._prevEvent = (prevIndex == -1) ? (Event *)0 : &_events[prevIndex]; + _events[i]._nextEvent = (nextIndex == -1) ? (Event *)0 : &_events[nextIndex]; } _freeEvent = (freeIndex == -1) ? 0 : &_events[freeIndex]; _headEvent = (headIndex == -1) ? 0 : &_events[headIndex]; @@ -1121,7 +1121,7 @@ void Scheduler::restoreEvents(Common::ReadStream *f) { // Adjust times to fit our time uint32 curTime = getTicks(); - event_t *wrkEvent = _headEvent; // The earliest event + Event *wrkEvent = _headEvent; // The earliest event while (wrkEvent) { // While mature events found wrkEvent->_time = wrkEvent->_time - saveTime + curTime; wrkEvent = wrkEvent->_nextEvent; @@ -1132,11 +1132,11 @@ void Scheduler::restoreEvents(Common::ReadStream *f) { * Insert the action pointed to by p into the timer event queue * The queue goes from head (earliest) to tail (latest) timewise */ -void Scheduler::insertAction(act *action) { +void Scheduler::insertAction(Act *action) { debugC(1, kDebugSchedule, "insertAction() - Action type A%d", action->_a0._actType); // First, get and initialize the event structure - event_t *curEvent = getQueue(); + Event *curEvent = getQueue(); curEvent->_action = action; switch (action->_a0._actType) { // Assign whether local or global case AGSCHEDULE: @@ -1158,7 +1158,7 @@ void Scheduler::insertAction(act *action) { _tailEvent = _headEvent = curEvent; curEvent->_nextEvent = curEvent->_prevEvent = 0; } else { - event_t *wrkEvent = _tailEvent; // Search from latest time back + Event *wrkEvent = _tailEvent; // Search from latest time back bool found = false; while (wrkEvent && !found) { @@ -1189,14 +1189,14 @@ void Scheduler::insertAction(act *action) { * It dequeues the event and returns it to the free list. It returns a ptr * to the next action in the list, except special case of NEW_SCREEN */ -event_t *Scheduler::doAction(event_t *curEvent) { +Event *Scheduler::doAction(Event *curEvent) { debugC(1, kDebugSchedule, "doAction - Event action type : %d", curEvent->_action->_a0._actType); - status_t &gameStatus = _vm->getGameStatus(); - act *action = curEvent->_action; - object_t *obj1; - int dx, dy; - event_t *wrkEvent; // Save ev_p->next_p for return + Status &gameStatus = _vm->getGameStatus(); + Act *action = curEvent->_action; + Object *obj1; + int dx, dy; + Event *wrkEvent; // Save ev_p->next_p for return switch (action->_a0._actType) { case ANULL: // Big NOP from DEL_EVENTS @@ -1236,7 +1236,7 @@ event_t *Scheduler::doAction(event_t *curEvent) { _vm->_object->_objects[action->_a9._objIndex]._state = action->_a9._newState; break; case INIT_PATH: // act10: Initialize an object path and velocity - _vm->_object->setPath(action->_a10._objIndex, (path_t) action->_a10._newPathType, action->_a10._vxPath, action->_a10._vyPath); + _vm->_object->setPath(action->_a10._objIndex, (Path) action->_a10._newPathType, action->_a10._vxPath, action->_a10._vyPath); break; case COND_R: // act11: action lists conditional on object state if (_vm->_object->_objects[action->_a11._objIndex]._state == action->_a11._stateReq) @@ -1441,7 +1441,7 @@ event_t *Scheduler::doAction(event_t *curEvent) { * was modified to allow deletes anywhere in the list, and the DEL_EVENT * action was modified to perform the actual delete. */ -void Scheduler::delQueue(event_t *curEvent) { +void Scheduler::delQueue(Event *curEvent) { debugC(4, kDebugSchedule, "delQueue()"); if (curEvent == _headEvent) { // If p was the head ptr @@ -1468,10 +1468,10 @@ void Scheduler::delQueue(event_t *curEvent) { /** * Delete all the active events of a given type */ -void Scheduler::delEventType(const action_t _actTypeDel) { +void Scheduler::delEventType(const Action _actTypeDel) { // Note: actions are not deleted here, simply turned into NOPs! - event_t *wrkEvent = _headEvent; // The earliest event - event_t *saveEvent; + Event *wrkEvent = _headEvent; // The earliest event + Event *saveEvent; while (wrkEvent) { // While events found in list saveEvent = wrkEvent->_nextEvent; @@ -1525,13 +1525,13 @@ void Scheduler_v1d::runScheduler() { debugC(6, kDebugSchedule, "runScheduler"); uint32 ticker = getTicks(); // The time now, in ticks - event_t *curEvent = _headEvent; // The earliest event + Event *curEvent = _headEvent; // The earliest event while (curEvent && (curEvent->_time <= ticker)) // While mature events found curEvent = doAction(curEvent); // Perform the action (returns next_p) } -void Scheduler_v1d::promptAction(act *action) { +void Scheduler_v1d::promptAction(Act *action) { Common::String response; response = Utils::promptBox(_vm->_file->fetchString(action->_a3._promptIndex)); @@ -1574,7 +1574,7 @@ const char *Scheduler_v2d::getCypher() const { return "Copyright 1991, Gray Design Associates"; } -void Scheduler_v2d::promptAction(act *action) { +void Scheduler_v2d::promptAction(Act *action) { Common::String response; response = Utils::promptBox(_vm->_file->fetchString(action->_a3._promptIndex)); @@ -1639,7 +1639,7 @@ void Scheduler_v1w::runScheduler() { debugC(6, kDebugSchedule, "runScheduler"); uint32 ticker = getTicks(); // The time now, in ticks - event_t *curEvent = _headEvent; // The earliest event + Event *curEvent = _headEvent; // The earliest event while (curEvent && (curEvent->_time <= ticker)) // While mature events found curEvent = doAction(curEvent); // Perform the action (returns next_p) diff --git a/engines/hugo/schedule.h b/engines/hugo/schedule.h index 74a65a5c64..37851f1ebc 100644 --- a/engines/hugo/schedule.h +++ b/engines/hugo/schedule.h @@ -37,7 +37,7 @@ namespace Hugo { /** * Following defines the action types and action list */ -enum action_t { // Parameters: +enum Action { // Parameters: ANULL = 0xff, // Special NOP used to 'delete' events in DEL_EVENTS ASCHEDULE = 0, // 0 - Ptr to action list to be rescheduled START_OBJ, // 1 - Object number @@ -56,7 +56,7 @@ enum action_t { // Parameters: SWAP_IMAGES, // 13 - Swap 2 object images COND_SCR, // 14 - Conditional on current screen AUTOPILOT, // 15 - Set object to home in on another (stationary) object - INIT_OBJ_SEQ, // 16 - Object number, sequence index to set curr_seq_p to + INIT_OBJ_SEQ, // 16 - Object number, sequence index to set curr_seqPtr to SET_STATE_BITS, // 17 - Objnum, mask to OR with obj states word CLEAR_STATE_BITS, // 18 - Objnum, mask to ~AND with obj states word TEST_STATE_BITS, // 19 - Objnum, mask to test obj states word @@ -88,33 +88,33 @@ enum action_t { // Parameters: COND_ROUTE, // 45 - Conditional on route in progress INIT_JUMPEXIT, // 46 - Initialize status.jumpexit INIT_VIEW, // 47 - Initialize viewx, viewy, dir - INIT_OBJ_FRAME, // 48 - Object number, seq,frame to set curr_seq_p to + INIT_OBJ_FRAME, // 48 - Object number, seq,frame to set curr_seqPtr to OLD_SONG = 49 // Added by Strangerke - Set currently playing sound, old way: that is, using a string index instead of a reference in a file }; struct act0 { // Type 0 - Schedule - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action uint16 _actIndex; // Ptr to an action list }; struct act1 { // Type 1 - Start an object - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex; // The object number int _cycleNumb; // Number of times to cycle - cycle_t _cycle; // Direction to start cycling + Cycle _cycle; // Direction to start cycling }; struct act2 { // Type 2 - Initialize an object coords - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex; // The object number int _x, _y; // Coordinates }; struct act3 { // Type 3 - Prompt user for text - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action uint16 _promptIndex; // Index of prompt string int *_responsePtr; // Array of indexes to valid response string(s) (terminate list with -1) @@ -124,54 +124,54 @@ struct act3 { // Type 3 - Prompt user for }; struct act4 { // Type 4 - Set new background color - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action long _newBackgroundColor; // New color }; struct act5 { // Type 5 - Initialize an object velocity - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex; // The object number int _vx, _vy; // velocity }; struct act6 { // Type 6 - Initialize an object carrying - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex; // The object number bool _carriedFl; // carrying }; struct act7 { // Type 7 - Initialize an object to hero's coords - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex; // The object number }; struct act8 { // Type 8 - switch to new screen - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _screenIndex; // The new screen number }; struct act9 { // Type 9 - Initialize an object state - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex; // The object number byte _newState; // New state }; struct act10 { // Type 10 - Initialize an object path type - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex; // The object number int _newPathType; // New path type - int8 _vxPath, _vyPath; // Max delta velocities e.g. for CHASE + int8 _vxPath, _vyPath; // Max delta velocities e.g. for CHASE }; struct act11 { // Type 11 - Conditional on object's state - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex; // The object number byte _stateReq; // Required state @@ -180,20 +180,20 @@ struct act11 { // Type 11 - Conditional on }; struct act12 { // Type 12 - Simple text box - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _stringIndex; // Index (enum) of string in strings.dat }; struct act13 { // Type 13 - Swap first object image with second - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex1; // Index of first object int _objIndex2; // 2nd }; struct act14 { // Type 14 - Conditional on current screen - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex; // The required object int _screenReq; // The required screen number @@ -202,7 +202,7 @@ struct act14 { // Type 14 - Conditional on }; struct act15 { // Type 15 - Home in on an object - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex1; // The object number homing in int _objIndex2; // The object number to home in on @@ -211,29 +211,29 @@ struct act15 { // Type 15 - Home in on an o // Note: Don't set a sequence at time 0 of a new screen, it causes // problems clearing the boundary bits of the object! timer > 0 is safe -struct act16 { // Type 16 - Set curr_seq_p to seq - action_t _actType; // The type of action +struct act16 { // Type 16 - Set curr_seqPtr to seq + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex; // The object number int _seqIndex; // The index of seq array to set to }; struct act17 { // Type 17 - SET obj individual state bits - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex; // The object number int _stateMask; // The mask to OR with current obj state }; struct act18 { // Type 18 - CLEAR obj individual state bits - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex; // The object number int _stateMask; // The mask to ~AND with current obj state }; struct act19 { // Type 19 - TEST obj individual state bits - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex; // The object number int _stateMask; // The mask to AND with current obj state @@ -242,35 +242,35 @@ struct act19 { // Type 19 - TEST obj indivi }; struct act20 { // Type 20 - Remove all events with this type of action - action_t _actType; // The type of action - int _timer; // Time to set off the action - action_t _actTypeDel; // The action type to remove + Action _actType; // The type of action + int _timer; // Time to set off the action + Action _actTypeDel; // The action type to remove }; struct act21 { // Type 21 - Gameover. Disable hero & commands - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action }; struct act22 { // Type 22 - Initialize an object to hero's coords - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex; // The object number }; struct act23 { // Type 23 - Exit game back to DOS - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action }; struct act24 { // Type 24 - Get bonus score - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _pointIndex; // Index into points array }; struct act25 { // Type 25 - Conditional on bounding box - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex; // The required object number int _x1, _y1, _x2, _y2; // The bounding box @@ -279,25 +279,25 @@ struct act25 { // Type 25 - Conditional on }; struct act26 { // Type 26 - Play a sound - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int16 _soundIndex; // Sound index in data file }; struct act27 { // Type 27 - Add object's value to score - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex; // object number }; struct act28 { // Type 28 - Subtract object's value from score - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex; // object number }; struct act29 { // Type 29 - Conditional on object carried - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex; // The required object number uint16 _actPassIndex; // Ptr to action list if success @@ -305,7 +305,7 @@ struct act29 { // Type 29 - Conditional on }; struct act30 { // Type 30 - Start special maze processing - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action byte _mazeSize; // Size of (square) maze int _x1, _y1, _x2, _y2; // Bounding box of maze @@ -314,39 +314,39 @@ struct act30 { // Type 30 - Start special m }; struct act31 { // Type 31 - Exit special maze processing - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action }; struct act32 { // Type 32 - Init fbg field of object - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex; // The object number byte _priority; // Value of foreground/background field }; struct act33 { // Type 33 - Init screen field of object - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex; // The object number int _screenIndex; // Screen number }; struct act34 { // Type 34 - Global Schedule - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action uint16 _actIndex; // Ptr to an action list }; struct act35 { // Type 35 - Remappe palette - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int16 _oldColorIndex; // Old color index, 0..15 int16 _newColorIndex; // New color index, 0..15 }; struct act36 { // Type 36 - Conditional on noun mentioned - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action uint16 _nounIndex; // The required noun (list) uint16 _actPassIndex; // Ptr to action list if success @@ -354,14 +354,14 @@ struct act36 { // Type 36 - Conditional on }; struct act37 { // Type 37 - Set new screen state - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _screenIndex; // The screen number byte _newState; // The new state }; struct act38 { // Type 38 - Position lips - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _lipsObjIndex; // The LIPS object int _objIndex; // The object to speak @@ -370,19 +370,19 @@ struct act38 { // Type 38 - Position lips }; struct act39 { // Type 39 - Init story mode - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action bool _storyModeFl; // New state of story_mode flag }; struct act40 { // Type 40 - Unsolicited text box - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _stringIndex; // Index (enum) of string in strings.dat }; struct act41 { // Type 41 - Conditional on bonus scored - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _bonusIndex; // Index into bonus list uint16 _actPassIndex; // Index of the action list if scored for the first time @@ -390,13 +390,13 @@ struct act41 { // Type 41 - Conditional on }; struct act42 { // Type 42 - Text box with "take" string - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex; // The object taken }; struct act43 { // Type 43 - Prompt user for Yes or No - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _promptIndex; // index of prompt string uint16 _actYesIndex; // Ptr to action list if YES @@ -404,12 +404,12 @@ struct act43 { // Type 43 - Prompt user for }; struct act44 { // Type 44 - Stop any route in progress - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action }; struct act45 { // Type 45 - Conditional on route in progress - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _routeIndex; // Must be >= current status.rindex uint16 _actPassIndex; // Ptr to action list if en-route @@ -417,13 +417,13 @@ struct act45 { // Type 45 - Conditional on }; struct act46 { // Type 46 - Init status.jumpexit - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action bool _jumpExitFl; // New state of jumpexit flag }; struct act47 { // Type 47 - Init viewx,viewy,dir - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex; // The object int16 _viewx; // object.viewx @@ -431,8 +431,8 @@ struct act47 { // Type 47 - Init viewx,view int16 _direction; // object.dir }; -struct act48 { // Type 48 - Set curr_seq_p to frame n - action_t _actType; // The type of action +struct act48 { // Type 48 - Set curr_seqPtr to frame n + Action _actType; // The type of action int _timer; // Time to set off the action int _objIndex; // The object number int _seqIndex; // The index of seq array to set to @@ -440,12 +440,12 @@ struct act48 { // Type 48 - Set curr_seq_p }; struct act49 { // Added by Strangerke - Type 49 - Play a song (DOS way) - action_t _actType; // The type of action + Action _actType; // The type of action int _timer; // Time to set off the action uint16 _songIndex; // Song index in string array }; -union act { +union Act { act0 _a0; act1 _a1; act2 _a2; @@ -498,18 +498,18 @@ union act { act49 _a49; }; -struct event_t { - act *_action; // Ptr to action to perform - bool _localActionFl; // true if action is only for this screen - uint32 _time; // (absolute) time to perform action - struct event_t *_prevEvent; // Chain to previous event - struct event_t *_nextEvent; // Chain to next event +struct Event { + Act *_action; // Ptr to action to perform + bool _localActionFl; // true if action is only for this screen + uint32 _time; // (absolute) time to perform action + struct Event *_prevEvent; // Chain to previous event + struct Event *_nextEvent; // Chain to next event }; /** * Following are points for achieving certain actions. */ -struct point_t { +struct Point { byte _score; // The value of the point bool _scoredFl; // Whether scored yet }; @@ -554,36 +554,36 @@ protected: uint16 **_screenActs; byte _numBonuses; - point_t *_points; + Point *_points; uint32 _curTick; // Current system time in ticks uint32 _oldTime; // The previous wall time in ticks uint32 _refreshTimeout; - event_t *_freeEvent; // Free list of event structures - event_t *_headEvent; // Head of list (earliest time) - event_t *_tailEvent; // Tail of list (latest time) - event_t _events[kMaxEvents]; // Statically declare event structures + Event *_freeEvent; // Free list of event structures + Event *_headEvent; // Head of list (earliest time) + Event *_tailEvent; // Tail of list (latest time) + Event _events[kMaxEvents]; // Statically declare event structures - act **_actListArr; + Act **_actListArr; virtual const char *getCypher() const = 0; virtual uint32 getTicks() = 0; - virtual void promptAction(act *action) = 0; + virtual void promptAction(Act *action) = 0; - event_t *doAction(event_t *curEvent); - event_t *getQueue(); + Event *doAction(Event *curEvent); + Event *getQueue(); uint32 getDosTicks(const bool updateFl); uint32 getWinTicks() const; - void delEventType(const action_t actTypeDel); - void delQueue(event_t *curEvent); - void findAction(const act* action, int16* index, int16* subElem); - void insertAction(act *action); - void readAct(Common::ReadStream &in, act &curAct); + void delEventType(const Action actTypeDel); + void delQueue(Event *curEvent); + void findAction(const Act* action, int16* index, int16* subElem); + void insertAction(Act *action); + void readAct(Common::ReadStream &in, Act &curAct); void restoreActions(Common::ReadStream *f); void restoreEvents(Common::ReadStream *f); void restorePoints(Common::ReadStream *in); @@ -605,7 +605,7 @@ public: protected: virtual const char *getCypher() const; virtual uint32 getTicks(); - virtual void promptAction(act *action); + virtual void promptAction(Act *action); }; class Scheduler_v2d : public Scheduler_v1d { @@ -618,7 +618,7 @@ public: protected: virtual const char *getCypher() const; - void promptAction(act *action); + void promptAction(Act *action); }; class Scheduler_v3d : public Scheduler_v2d { diff --git a/engines/hugo/sound.cpp b/engines/hugo/sound.cpp index 463a19ae8c..a8b4759d9b 100644 --- a/engines/hugo/sound.cpp +++ b/engines/hugo/sound.cpp @@ -174,8 +174,8 @@ void SoundHandler::toggleSound() { _vm->_config._soundFl = !_vm->_config._soundFl; } -void SoundHandler::playMIDI(sound_pt seq_p, uint16 size) { - _midiPlayer->play(seq_p, size); +void SoundHandler::playMIDI(sound_pt seqPtr, uint16 size) { + _midiPlayer->play(seqPtr, size); } /** -- cgit v1.2.3 From 179427c78f2a634beb4485661bf2b1fc78ef559f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 13 Jun 2012 21:18:37 +0200 Subject: HUGO: Rename pointers --- engines/hugo/display.cpp | 14 ++-- engines/hugo/display.h | 6 +- engines/hugo/file.cpp | 18 ++--- engines/hugo/file.h | 4 +- engines/hugo/game.h | 2 +- engines/hugo/hugo.cpp | 4 +- engines/hugo/hugo.h | 2 +- engines/hugo/mouse.cpp | 4 +- engines/hugo/object.cpp | 4 +- engines/hugo/object_v1d.cpp | 8 +- engines/hugo/object_v1w.cpp | 8 +- engines/hugo/object_v2d.cpp | 8 +- engines/hugo/object_v3d.cpp | 6 +- engines/hugo/parser.cpp | 4 +- engines/hugo/parser_v1d.cpp | 8 +- engines/hugo/parser_v1w.cpp | 4 +- engines/hugo/parser_v2d.cpp | 6 +- engines/hugo/parser_v3d.cpp | 12 +-- engines/hugo/route.cpp | 4 +- engines/hugo/schedule.cpp | 188 ++++++++++++++++++++++---------------------- engines/hugo/sound.cpp | 14 ++-- engines/hugo/sound.h | 2 +- 22 files changed, 165 insertions(+), 165 deletions(-) (limited to 'engines/hugo') diff --git a/engines/hugo/display.cpp b/engines/hugo/display.cpp index 34b0303eee..b86b1f0366 100644 --- a/engines/hugo/display.cpp +++ b/engines/hugo/display.cpp @@ -657,7 +657,7 @@ void Screen::drawBoundaries() { for (int i = 0; i < _vm->_object->_numObj; i++) { Object *obj = &_vm->_object->_objects[i]; // Get pointer to object - if (obj->_screenIndex == *_vm->_screen_p) { + if (obj->_screenIndex == *_vm->_screenPtr) { if ((obj->_currImagePtr != 0) && (obj->_cycling != kCycleInvisible)) drawRectangle(false, obj->_x + obj->_currImagePtr->_x1, obj->_y + obj->_currImagePtr->_y1, obj->_x + obj->_currImagePtr->_x2, obj->_y + obj->_currImagePtr->_y2, _TLIGHTGREEN); @@ -730,10 +730,10 @@ void Screen_v1d::loadFontArr(Common::ReadStream &in) { * processed object by looking down the current column for an overlay * base byte set (in which case the object is foreground). */ -OverlayState Screen_v1d::findOvl(Seq *seqPtr, ImagePtr dst_p, uint16 y) { +OverlayState Screen_v1d::findOvl(Seq *seqPtr, ImagePtr dstPtr, uint16 y) { debugC(4, kDebugDisplay, "findOvl()"); - uint16 index = (uint16)(dst_p - _frontBuffer) >> 3; + uint16 index = (uint16)(dstPtr - _frontBuffer) >> 3; for (int i = 0; i < seqPtr->_lines-y; i++) { // Each line in object if (_vm->_object->getBaseBoundary(index)) // If any overlay base byte is non-zero then the object is foreground, else back. @@ -799,14 +799,14 @@ void Screen_v1w::loadFontArr(Common::ReadStream &in) { * processed object by looking down the current column for an overlay * base bit set (in which case the object is foreground). */ -OverlayState Screen_v1w::findOvl(Seq *seqPtr, ImagePtr dst_p, uint16 y) { +OverlayState Screen_v1w::findOvl(Seq *seqPtr, ImagePtr dstPtr, uint16 y) { debugC(4, kDebugDisplay, "findOvl()"); for (; y < seqPtr->_lines; y++) { // Each line in object - byte ovb = _vm->_object->getBaseBoundary((uint16)(dst_p - _frontBuffer) >> 3); // Ptr into overlay bits - if (ovb & (0x80 >> ((uint16)(dst_p - _frontBuffer) & 7))) // Overlay bit is set + byte ovb = _vm->_object->getBaseBoundary((uint16)(dstPtr - _frontBuffer) >> 3); // Ptr into overlay bits + if (ovb & (0x80 >> ((uint16)(dstPtr - _frontBuffer) & 7))) // Overlay bit is set return kOvlForeground; // Found a bit - must be foreground - dst_p += kXPix; + dstPtr += kXPix; } return kOvlBackground; // No bits set, must be background diff --git a/engines/hugo/display.h b/engines/hugo/display.h index 5fab2f18cc..00dc1b743c 100644 --- a/engines/hugo/display.h +++ b/engines/hugo/display.h @@ -114,7 +114,7 @@ protected: inline bool isInY(const int16 y, const Rect *rect) const; inline bool isOverlapping(const Rect *rectA, const Rect *rectB) const; - virtual OverlayState findOvl(Seq *seqPtr, ImagePtr dst_p, uint16 y) = 0; + virtual OverlayState findOvl(Seq *seqPtr, ImagePtr dstPtr, uint16 y) = 0; private: byte *_curPalette; @@ -150,7 +150,7 @@ public: void loadFont(int16 fontId); void loadFontArr(Common::ReadStream &in); protected: - OverlayState findOvl(Seq *seqPtr, ImagePtr dst_p, uint16 y); + OverlayState findOvl(Seq *seqPtr, ImagePtr dstPtr, uint16 y); }; class Screen_v1w : public Screen { @@ -161,7 +161,7 @@ public: void loadFont(int16 fontId); void loadFontArr(Common::ReadStream &in); protected: - OverlayState findOvl(Seq *seqPtr, ImagePtr dst_p, uint16 y); + OverlayState findOvl(Seq *seqPtr, ImagePtr dstPtr, uint16 y); }; } // End of namespace Hugo diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp index b78a26241b..5556f5abc0 100644 --- a/engines/hugo/file.cpp +++ b/engines/hugo/file.cpp @@ -92,7 +92,7 @@ const char *FileManager::getUifFilename() const { * Return original plane data ptr */ byte *FileManager::convertPCC(byte *p, const uint16 y, const uint16 bpl, ImagePtr dataPtr) const { - debugC(2, kDebugFile, "convertPCC(byte *p, %d, %d, ImagePtr data_p)", y, bpl); + debugC(2, kDebugFile, "convertPCC(byte *p, %d, %d, ImagePtr dataPtr)", y, bpl); dataPtr += y * bpl * 8; // Point to correct DIB line for (int16 r = 0, g = bpl, b = g + bpl, i = b + bpl; r < bpl; r++, g++, b++, i++) { // Each byte in all planes @@ -282,7 +282,7 @@ void FileManager::readImage(const int objNum, Object *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(const int16 sound, uint16 *size) { +SoundPtr FileManager::getSound(const int16 sound, uint16 *size) { debugC(1, kDebugFile, "getSound(%d)", sound); // No more to do if SILENCE (called for cleanup purposes) @@ -298,25 +298,25 @@ sound_pt FileManager::getSound(const int16 sound, uint16 *size) { if (!_hasReadHeader) { for (int i = 0; i < kMaxSounds; i++) { - _s_hdr[i]._size = fp.readUint16LE(); - _s_hdr[i]._offset = fp.readUint32LE(); + _soundHdr[i]._size = fp.readUint16LE(); + _soundHdr[i]._offset = fp.readUint32LE(); } if (fp.err()) error("Wrong sound file format"); _hasReadHeader = true; } - *size = _s_hdr[sound]._size; + *size = _soundHdr[sound]._size; if (*size == 0) 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 + SoundPtr soundPtr = (byte *)malloc(_soundHdr[sound]._size); // Ptr to sound data assert(soundPtr); // 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) + fp.seek(_soundHdr[sound]._offset, SEEK_SET); + if (fp.read(soundPtr, _soundHdr[sound]._size) != _soundHdr[sound]._size) error("Wrong sound file format"); fp.close(); @@ -513,7 +513,7 @@ bool FileManager::restoreGame(const int16 slot) { _vm->_maze._x4 = in->readSint16BE(); _vm->_maze._firstScreenIndex = in->readByte(); - _vm->_scheduler->restoreScreen(*_vm->_screen_p); + _vm->_scheduler->restoreScreen(*_vm->_screenPtr); if ((_vm->getGameStatus()._viewState = (Vstate) in->readByte()) != kViewPlay) _vm->_screen->hideCursor(); diff --git a/engines/hugo/file.h b/engines/hugo/file.h index 151b749ce7..e4aa7f7fec 100644 --- a/engines/hugo/file.h +++ b/engines/hugo/file.h @@ -47,7 +47,7 @@ public: FileManager(HugoEngine *vm); virtual ~FileManager(); - sound_pt getSound(const int16 sound, uint16 *size); + SoundPtr getSound(const int16 sound, uint16 *size); void readBootFile(); void readImage(const int objNum, Object *objPtr); @@ -118,7 +118,7 @@ protected: // If this is the first call, read the lookup table bool _hasReadHeader; - SoundHdr _s_hdr[kMaxSounds]; // Sound lookup table + SoundHdr _soundHdr[kMaxSounds]; // Sound lookup table private: byte *convertPCC(byte *p, const uint16 y, const uint16 bpl, ImagePtr dataPtr) const; diff --git a/engines/hugo/game.h b/engines/hugo/game.h index 29e3bf9b55..ed49ee8cbe 100644 --- a/engines/hugo/game.h +++ b/engines/hugo/game.h @@ -95,7 +95,7 @@ struct hugoBoot { // Common HUGO boot file * Game specific type definitions */ typedef byte *ImagePtr; // ptr to an object image (sprite) -typedef byte *sound_pt; // ptr to sound (or music) data +typedef byte *SoundPtr; // ptr to sound (or music) data /** * Structure for initializing maze processing diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp index 5ae43b8b5a..f2db630198 100644 --- a/engines/hugo/hugo.cpp +++ b/engines/hugo/hugo.cpp @@ -427,7 +427,7 @@ bool HugoEngine::loadHugoDat() { _scheduler->loadActListArr(in); _scheduler->loadAlNewscrIndex(in); _hero = &_object->_objects[kHeroIndex]; // This always points to hero - _screen_p = &(_object->_objects[kHeroIndex]._screenIndex); // Current screen is hero's + _screenPtr = &(_object->_objects[kHeroIndex]._screenIndex); // Current screen is hero's _heroImage = kHeroIndex; // Current in use hero image for (int varnt = 0; varnt < _numVariant; varnt++) { @@ -660,7 +660,7 @@ void HugoEngine::readScreenFiles(const int screenNum) { void HugoEngine::setNewScreen(const int screenNum) { debugC(1, kDebugEngine, "setNewScreen(%d)", screenNum); - *_screen_p = screenNum; // HERO object + *_screenPtr = screenNum; // HERO object _object->setCarriedScreen(screenNum); // Carried objects } diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h index 312f2272db..9f495a9037 100644 --- a/engines/hugo/hugo.h +++ b/engines/hugo/hugo.h @@ -226,7 +226,7 @@ public: int8 _normalTPS; // Number of ticks (frames) per second. // 8 for Win versions, 9 for DOS versions Object *_hero; - byte *_screen_p; + byte *_screenPtr; byte _heroImage; byte *_screenStates; Command _line; // Line of user text input diff --git a/engines/hugo/mouse.cpp b/engines/hugo/mouse.cpp index fef3cca608..a95170696c 100644 --- a/engines/hugo/mouse.cpp +++ b/engines/hugo/mouse.cpp @@ -223,7 +223,7 @@ void MouseHandler::processLeftClick(const int16 objId, const int16 cx, const int _vm->_screen->displayList(kDisplayAdd, 0, kDibOffY, kXPix, kInvDy); break; case kExitHotspot: // Walk to exit hotspot - i = findExit(cx, cy, *_vm->_screen_p); + i = findExit(cx, cy, *_vm->_screenPtr); x = _hotspots[i]._viewx; y = _hotspots[i]._viewy; if (x >= 0) { // Hotspot refers to an exit @@ -327,7 +327,7 @@ void MouseHandler::mouseHandler() { // Process cursor over an exit hotspot if (objId == -1) { - int i = findExit(cx, cy, *_vm->_screen_p); + int i = findExit(cx, cy, *_vm->_screenPtr); if (i != -1 && _hotspots[i]._viewx >= 0) { objId = kExitHotspot; cursorText(_vm->_text->getTextMouse(kMsExit), cx, cy, U_FONT8, _TBRIGHTWHITE); diff --git a/engines/hugo/object.cpp b/engines/hugo/object.cpp index e0dd0abd49..7b4783e4d8 100644 --- a/engines/hugo/object.cpp +++ b/engines/hugo/object.cpp @@ -199,7 +199,7 @@ int16 ObjectHandler::findObject(uint16 x, uint16 y) { // Check objects on screen for (int i = 0; i < _numObj; i++, obj++) { // Object must be in current screen and "useful" - if (obj->_screenIndex == *_vm->_screen_p && (obj->_genericCmd || obj->_objValue || obj->_cmdIndex)) { + if (obj->_screenIndex == *_vm->_screenPtr && (obj->_genericCmd || obj->_objValue || obj->_cmdIndex)) { Seq *curImage = obj->_currImagePtr; // Object must have a visible image... if (curImage != 0 && obj->_cycling != kCycleInvisible) { @@ -347,7 +347,7 @@ void ObjectHandler::showTakeables() { for (int j = 0; j < _numObj; j++) { Object *obj = &_objects[j]; if ((obj->_cycling != kCycleInvisible) && - (obj->_screenIndex == *_vm->_screen_p) && + (obj->_screenIndex == *_vm->_screenPtr) && (((TAKE & obj->_genericCmd) == TAKE) || obj->_objValue)) { Utils::notifyBox(Common::String::format("You can also see:\n%s.", _vm->_text->getNoun(obj->_nounIndex, LOOK_NAME))); } diff --git a/engines/hugo/object_v1d.cpp b/engines/hugo/object_v1d.cpp index e5fedb3b2a..7f88e9e5b8 100644 --- a/engines/hugo/object_v1d.cpp +++ b/engines/hugo/object_v1d.cpp @@ -64,7 +64,7 @@ void ObjectHandler_v1d::updateImages() { for (int i = 0; i < _numObj; i++) { Object *obj = &_objects[i]; - if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling >= kCycleAlmostInvisible)) + if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling >= kCycleAlmostInvisible)) objindex[objNumb++] = i; } @@ -185,7 +185,7 @@ void ObjectHandler_v1d::moveObjects() { for (int i = 0; i < _numObj; i++) { Object *obj = &_objects[i]; // Get pointer to object Seq *currImage = obj->_currImagePtr; // Get ptr to current image - if (obj->_screenIndex == *_vm->_screen_p) { + if (obj->_screenIndex == *_vm->_screenPtr) { switch (obj->_pathType) { case kPathChase: { // Allowable motion wrt boundary @@ -272,7 +272,7 @@ void ObjectHandler_v1d::moveObjects() { // Move objects, allowing for boundaries for (int i = 0; i < _numObj; i++) { Object *obj = &_objects[i]; // Get pointer to object - if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_vx || obj->_vy)) { + if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_vx || obj->_vy)) { // Only process if it's moving // Do object movement. Delta_x,y return allowed movement in x,y @@ -327,7 +327,7 @@ void ObjectHandler_v1d::moveObjects() { for (int i = 0; i < _numObj; i++) { Object *obj = &_objects[i]; // Get pointer to object Seq *currImage = obj->_currImagePtr; // Get ptr to current image - if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) + if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) clearBoundary(obj->_oldx + currImage->_x1, obj->_oldx + currImage->_x2, obj->_oldy + currImage->_y2); } diff --git a/engines/hugo/object_v1w.cpp b/engines/hugo/object_v1w.cpp index e1e8496d9d..61b0f2e48a 100644 --- a/engines/hugo/object_v1w.cpp +++ b/engines/hugo/object_v1w.cpp @@ -64,7 +64,7 @@ void ObjectHandler_v1w::updateImages() { for (int i = 0; i < _numObj; i++) { Object *obj = &_objects[i]; - if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling >= kCycleAlmostInvisible)) + if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling >= kCycleAlmostInvisible)) objindex[objNumb++] = i; } @@ -182,7 +182,7 @@ void ObjectHandler_v1w::moveObjects() { for (int i = 0; i < _numObj; i++) { Object *obj = &_objects[i]; // Get pointer to object Seq *currImage = obj->_currImagePtr; // Get ptr to current image - if (obj->_screenIndex == *_vm->_screen_p) { + if (obj->_screenIndex == *_vm->_screenPtr) { switch (obj->_pathType) { case kPathChase: case kPathChase2: { @@ -282,7 +282,7 @@ void ObjectHandler_v1w::moveObjects() { // Move objects, allowing for boundaries for (int i = 0; i < _numObj; i++) { Object *obj = &_objects[i]; // Get pointer to object - if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_vx || obj->_vy)) { + if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_vx || obj->_vy)) { // Only process if it's moving // Do object movement. Delta_x,y return allowed movement in x,y @@ -337,7 +337,7 @@ void ObjectHandler_v1w::moveObjects() { for (int i = 0; i < _numObj; i++) { Object *obj = &_objects[i]; // Get pointer to object Seq *currImage = obj->_currImagePtr; // Get ptr to current image - if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) + if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) clearBoundary(obj->_oldx + currImage->_x1, obj->_oldx + currImage->_x2, obj->_oldy + currImage->_y2); } diff --git a/engines/hugo/object_v2d.cpp b/engines/hugo/object_v2d.cpp index f0d83269d5..7cb6c20dd0 100644 --- a/engines/hugo/object_v2d.cpp +++ b/engines/hugo/object_v2d.cpp @@ -64,7 +64,7 @@ void ObjectHandler_v2d::updateImages() { for (int i = 0; i < _numObj; i++) { Object *obj = &_objects[i]; - if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling >= kCycleAlmostInvisible)) + if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling >= kCycleAlmostInvisible)) objindex[objNumb++] = i; } @@ -185,7 +185,7 @@ void ObjectHandler_v2d::moveObjects() { for (int i = 0; i < _numObj; i++) { Object *obj = &_objects[i]; // Get pointer to object Seq *currImage = obj->_currImagePtr; // Get ptr to current image - if (obj->_screenIndex == *_vm->_screen_p) { + if (obj->_screenIndex == *_vm->_screenPtr) { switch (obj->_pathType) { case kPathChase: case kPathChase2: { @@ -285,7 +285,7 @@ void ObjectHandler_v2d::moveObjects() { // Move objects, allowing for boundaries for (int i = 0; i < _numObj; i++) { Object *obj = &_objects[i]; // Get pointer to object - if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_vx || obj->_vy)) { + if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_vx || obj->_vy)) { // Only process if it's moving // Do object movement. Delta_x,y return allowed movement in x,y @@ -340,7 +340,7 @@ void ObjectHandler_v2d::moveObjects() { for (int i = 0; i < _numObj; i++) { Object *obj = &_objects[i]; // Get pointer to object Seq *currImage = obj->_currImagePtr; // Get ptr to current image - if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) + if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) clearBoundary(obj->_oldx + currImage->_x1, obj->_oldx + currImage->_x2, obj->_oldy + currImage->_y2); } diff --git a/engines/hugo/object_v3d.cpp b/engines/hugo/object_v3d.cpp index 13c9c8c93d..7bb4b95b4a 100644 --- a/engines/hugo/object_v3d.cpp +++ b/engines/hugo/object_v3d.cpp @@ -66,7 +66,7 @@ void ObjectHandler_v3d::moveObjects() { for (int i = 0; i < _numObj; i++) { Object *obj = &_objects[i]; // Get pointer to object Seq *currImage = obj->_currImagePtr; // Get ptr to current image - if (obj->_screenIndex == *_vm->_screen_p) { + if (obj->_screenIndex == *_vm->_screenPtr) { switch (obj->_pathType) { case kPathChase: case kPathChase2: { @@ -167,7 +167,7 @@ void ObjectHandler_v3d::moveObjects() { // Move objects, allowing for boundaries for (int i = 0; i < _numObj; i++) { Object *obj = &_objects[i]; // Get pointer to object - if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_vx || obj->_vy)) { + if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_vx || obj->_vy)) { // Only process if it's moving // Do object movement. Delta_x,y return allowed movement in x,y @@ -222,7 +222,7 @@ void ObjectHandler_v3d::moveObjects() { for (int i = 0; i < _numObj; i++) { Object *obj = &_objects[i]; // Get pointer to object Seq *currImage = obj->_currImagePtr; // Get ptr to current image - if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) + if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating)) clearBoundary(obj->_oldx + currImage->_x1, obj->_oldx + currImage->_x2, obj->_oldy + currImage->_y2); } diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp index 68343a0374..d18cc2181c 100644 --- a/engines/hugo/parser.cpp +++ b/engines/hugo/parser.cpp @@ -164,11 +164,11 @@ void Parser::loadArrayReqs(Common::SeekableReadStream &in) { const char *Parser::useBG(const char *name) { debugC(1, kDebugEngine, "useBG(%s)", name); - ObjectList p = _backgroundObjects[*_vm->_screen_p]; + ObjectList p = _backgroundObjects[*_vm->_screenPtr]; for (int i = 0; p[i]._verbIndex != 0; i++) { if ((name == _vm->_text->getNoun(p[i]._nounIndex, 0) && p[i]._verbIndex != _vm->_look) && - ((p[i]._roomState == kStateDontCare) || (p[i]._roomState == _vm->_screenStates[*_vm->_screen_p]))) + ((p[i]._roomState == kStateDontCare) || (p[i]._roomState == _vm->_screenStates[*_vm->_screenPtr]))) return _vm->_text->getVerb(p[i]._verbIndex, 0); } diff --git a/engines/hugo/parser_v1d.cpp b/engines/hugo/parser_v1d.cpp index f29a03f796..f29b0161f5 100644 --- a/engines/hugo/parser_v1d.cpp +++ b/engines/hugo/parser_v1d.cpp @@ -87,7 +87,7 @@ bool Parser_v1d::isNear_v1(const char *verb, const char *noun, Object *obj, char return false; } else if (obj->_carriedFl) { // Object is being carried return true; - } else if (obj->_screenIndex != *_vm->_screen_p) { // Not in same screen + } else if (obj->_screenIndex != *_vm->_screenPtr) { // Not in same screen if (obj->_objValue) strcpy (comment, _vm->_text->getTextParser(kCmtAny4)); return false; @@ -268,7 +268,7 @@ void Parser_v1d::dropObject(Object *obj) { debugC(1, kDebugParser, "dropObject(Object *obj)"); obj->_carriedFl = false; - obj->_screenIndex = *_vm->_screen_p; + obj->_screenIndex = *_vm->_screenPtr; if (obj->_seqNumb) // Don't change if no image to display obj->_cycling = kCycleNotCycling; obj->_x = _vm->_hero->_x - 1; @@ -410,7 +410,7 @@ void Parser_v1d::lineHandler() { return; } } - if ((*farComment == '\0') && isBackgroundWord_v1(noun, verb, _backgroundObjects[*_vm->_screen_p])) + if ((*farComment == '\0') && isBackgroundWord_v1(noun, verb, _backgroundObjects[*_vm->_screenPtr])) return; } while (noun); } @@ -418,7 +418,7 @@ void Parser_v1d::lineHandler() { if (*farComment != '\0') // An object matched but not near enough Utils::notifyBox(farComment); else if (!isCatchallVerb_v1(true, noun, verb, _catchallList) && - !isCatchallVerb_v1(false, noun, verb, _backgroundObjects[*_vm->_screen_p]) && + !isCatchallVerb_v1(false, noun, verb, _backgroundObjects[*_vm->_screenPtr]) && !isCatchallVerb_v1(false, noun, verb, _catchallList)) Utils::notifyBox(_vm->_text->getTextParser(kTBEh_1d)); } diff --git a/engines/hugo/parser_v1w.cpp b/engines/hugo/parser_v1w.cpp index 8c0da63554..3722ccc0e1 100644 --- a/engines/hugo/parser_v1w.cpp +++ b/engines/hugo/parser_v1w.cpp @@ -166,9 +166,9 @@ void Parser_v1w::lineHandler() { } // No objects match command line, try background and catchall commands - if (isBackgroundWord_v3(_backgroundObjects[*_vm->_screen_p])) + if (isBackgroundWord_v3(_backgroundObjects[*_vm->_screenPtr])) return; - if (isCatchallVerb_v3(_backgroundObjects[*_vm->_screen_p])) + if (isCatchallVerb_v3(_backgroundObjects[*_vm->_screenPtr])) return; if (isBackgroundWord_v3(_catchallList)) diff --git a/engines/hugo/parser_v2d.cpp b/engines/hugo/parser_v2d.cpp index 674836b90e..6d71186f49 100644 --- a/engines/hugo/parser_v2d.cpp +++ b/engines/hugo/parser_v2d.cpp @@ -160,15 +160,15 @@ void Parser_v2d::lineHandler() { return; } } - if ((*farComment != '\0') && isBackgroundWord_v1(noun, verb, _backgroundObjects[*_vm->_screen_p])) + if ((*farComment != '\0') && isBackgroundWord_v1(noun, verb, _backgroundObjects[*_vm->_screenPtr])) return; } while (noun); } noun = findNextNoun(noun); - if ( !isCatchallVerb_v1(true, noun, verb, _backgroundObjects[*_vm->_screen_p]) + if ( !isCatchallVerb_v1(true, noun, verb, _backgroundObjects[*_vm->_screenPtr]) && !isCatchallVerb_v1(true, noun, verb, _catchallList) - && !isCatchallVerb_v1(false, noun, verb, _backgroundObjects[*_vm->_screen_p]) + && !isCatchallVerb_v1(false, noun, verb, _backgroundObjects[*_vm->_screenPtr]) && !isCatchallVerb_v1(false, noun, verb, _catchallList)) { if (*farComment != '\0') { // An object matched but not near enough Utils::notifyBox(farComment); diff --git a/engines/hugo/parser_v3d.cpp b/engines/hugo/parser_v3d.cpp index 9bbaf49f67..a7e5896833 100644 --- a/engines/hugo/parser_v3d.cpp +++ b/engines/hugo/parser_v3d.cpp @@ -168,9 +168,9 @@ void Parser_v3d::lineHandler() { } // No objects match command line, try background and catchall commands - if (isBackgroundWord_v3(_backgroundObjects[*_vm->_screen_p])) + if (isBackgroundWord_v3(_backgroundObjects[*_vm->_screenPtr])) return; - if (isCatchallVerb_v3(_backgroundObjects[*_vm->_screen_p])) + if (isCatchallVerb_v3(_backgroundObjects[*_vm->_screenPtr])) return; if (isBackgroundWord_v3(_catchallList)) @@ -319,7 +319,7 @@ bool Parser_v3d::isNear_v3(Object *obj, const char *verb, char *comment) const { if (obj->_carriedFl) // Object is being carried return true; - if (obj->_screenIndex != *_vm->_screen_p) { + if (obj->_screenIndex != *_vm->_screenPtr) { // Not in same screen if (obj->_objValue) strcpy(comment, _vm->_text->getTextParser(kCmtAny1)); @@ -389,7 +389,7 @@ void Parser_v3d::dropObject(Object *obj) { debugC(1, kDebugParser, "dropObject(Object *obj)"); obj->_carriedFl = false; - obj->_screenIndex = *_vm->_screen_p; + obj->_screenIndex = *_vm->_screenPtr; if ((obj->_seqNumb > 1) || (obj->_seqList[0]._imageNbr > 1)) obj->_cycling = kCycleForward; else @@ -417,7 +417,7 @@ bool Parser_v3d::isCatchallVerb_v3(ObjectList obj) const { if (isWordPresent(_vm->_text->getVerbArray(obj[i]._verbIndex)) && obj[i]._nounIndex == 0 && (!obj[i]._matchFl || !findNoun()) && ((obj[i]._roomState == kStateDontCare) || - (obj[i]._roomState == _vm->_screenStates[*_vm->_screen_p]))) { + (obj[i]._roomState == _vm->_screenStates[*_vm->_screenPtr]))) { Utils::notifyBox(_vm->_file->fetchString(obj[i]._commentIndex)); _vm->_scheduler->processBonus(obj[i]._bonusIndex); @@ -445,7 +445,7 @@ bool Parser_v3d::isBackgroundWord_v3(ObjectList obj) const { if (isWordPresent(_vm->_text->getVerbArray(obj[i]._verbIndex)) && isWordPresent(_vm->_text->getNounArray(obj[i]._nounIndex)) && ((obj[i]._roomState == kStateDontCare) || - (obj[i]._roomState == _vm->_screenStates[*_vm->_screen_p]))) { + (obj[i]._roomState == _vm->_screenStates[*_vm->_screenPtr]))) { Utils::notifyBox(_vm->_file->fetchString(obj[i]._commentIndex)); _vm->_scheduler->processBonus(obj[i]._bonusIndex); return true; diff --git a/engines/hugo/route.cpp b/engines/hugo/route.cpp index 45d72bafb1..54dae88c28 100644 --- a/engines/hugo/route.cpp +++ b/engines/hugo/route.cpp @@ -335,7 +335,7 @@ bool Route::findRoute(const int16 cx, const int16 cy) { Object *obj; // Ptr to object int i; for (i = 1, obj = &_vm->_object->_objects[i]; i < _vm->_object->_numObj; i++, obj++) { - if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling != kCycleInvisible) && (obj->_priority == kPriorityFloating)) + if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling != kCycleInvisible) && (obj->_priority == kPriorityFloating)) _vm->_object->storeBoundary(obj->_oldx + obj->_currImagePtr->_x1, obj->_oldx + obj->_currImagePtr->_x2, obj->_oldy + obj->_currImagePtr->_y2); } @@ -350,7 +350,7 @@ bool Route::findRoute(const int16 cx, const int16 cy) { // Clear all object baselines from objbound for (i = 0, obj = _vm->_object->_objects; i < _vm->_object->_numObj; i++, obj++) { - if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling != kCycleInvisible) && (obj->_priority == kPriorityFloating)) + if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling != kCycleInvisible) && (obj->_priority == kPriorityFloating)) _vm->_object->clearBoundary(obj->_oldx + obj->_currImagePtr->_x1, obj->_oldx + obj->_currImagePtr->_x2, obj->_oldy + obj->_currImagePtr->_y2); } diff --git a/engines/hugo/schedule.cpp b/engines/hugo/schedule.cpp index 3bbec6670e..32b8a47df7 100644 --- a/engines/hugo/schedule.cpp +++ b/engines/hugo/schedule.cpp @@ -66,12 +66,12 @@ void Scheduler::initCypher() { void Scheduler::initEventQueue() { debugC(1, kDebugSchedule, "initEventQueue"); - // Chain next_p from first to last + // Chain nextEvent from first to last for (int i = kMaxEvents; --i;) _events[i - 1]._nextEvent = &_events[i]; _events[kMaxEvents - 1]._nextEvent = 0; - // Chain prev_p from last to first + // Chain prevEvent from last to first for (int i = 1; i < kMaxEvents; i++) _events[i]._prevEvent = &_events[i - 1]; _events[0]._prevEvent = 0; @@ -658,28 +658,28 @@ void Scheduler::processMaze(const int x1, const int x2, const int y1, const int if (x1 < _vm->_maze._x1) { // Exit west - _actListArr[_alNewscrIndex][3]._a8._screenIndex = *_vm->_screen_p - 1; + _actListArr[_alNewscrIndex][3]._a8._screenIndex = *_vm->_screenPtr - 1; _actListArr[_alNewscrIndex][0]._a2._x = _vm->_maze._x2 - kShiftSize - (x2 - x1); _actListArr[_alNewscrIndex][0]._a2._y = _vm->_hero->_y; _vm->_route->resetRoute(); insertActionList(_alNewscrIndex); } else if (x2 > _vm->_maze._x2) { // Exit east - _actListArr[_alNewscrIndex][3]._a8._screenIndex = *_vm->_screen_p + 1; + _actListArr[_alNewscrIndex][3]._a8._screenIndex = *_vm->_screenPtr + 1; _actListArr[_alNewscrIndex][0]._a2._x = _vm->_maze._x1 + kShiftSize; _actListArr[_alNewscrIndex][0]._a2._y = _vm->_hero->_y; _vm->_route->resetRoute(); insertActionList(_alNewscrIndex); } else if (y1 < _vm->_maze._y1 - kShiftSize) { // Exit north - _actListArr[_alNewscrIndex][3]._a8._screenIndex = *_vm->_screen_p - _vm->_maze._size; + _actListArr[_alNewscrIndex][3]._a8._screenIndex = *_vm->_screenPtr - _vm->_maze._size; _actListArr[_alNewscrIndex][0]._a2._x = _vm->_maze._x3; _actListArr[_alNewscrIndex][0]._a2._y = _vm->_maze._y2 - kShiftSize - (y2 - y1); _vm->_route->resetRoute(); insertActionList(_alNewscrIndex); } else if (y2 > _vm->_maze._y2 - kShiftSize / 2) { // Exit south - _actListArr[_alNewscrIndex][3]._a8._screenIndex = *_vm->_screen_p + _vm->_maze._size; + _actListArr[_alNewscrIndex][3]._a8._screenIndex = *_vm->_screenPtr + _vm->_maze._size; _actListArr[_alNewscrIndex][0]._a2._x = _vm->_maze._x4; _actListArr[_alNewscrIndex][0]._a2._y = _vm->_maze._y1 + kShiftSize; _vm->_route->resetRoute(); @@ -1090,10 +1090,10 @@ void Scheduler::restoreSchedulerData(Common::ReadStream *in) { void Scheduler::restoreEvents(Common::ReadStream *f) { debugC(1, kDebugSchedule, "restoreEvents"); - uint32 saveTime = f->readUint32BE(); // time of save - int16 freeIndex = f->readSint16BE(); // Free list index - int16 headIndex = f->readSint16BE(); // Head of list index - int16 tailIndex = f->readSint16BE(); // Tail of list index + uint32 saveTime = f->readUint32BE(); // time of save + int16 freeIndex = f->readSint16BE(); // Free list index + int16 headIndex = f->readSint16BE(); // Head of list index + int16 tailIndex = f->readSint16BE(); // Tail of list index // Restore events indexes to pointers for (int i = 0; i < kMaxEvents; i++) { @@ -1121,8 +1121,8 @@ void Scheduler::restoreEvents(Common::ReadStream *f) { // Adjust times to fit our time uint32 curTime = getTicks(); - Event *wrkEvent = _headEvent; // The earliest event - while (wrkEvent) { // While mature events found + Event *wrkEvent = _headEvent; // The earliest event + while (wrkEvent) { // While mature events found wrkEvent->_time = wrkEvent->_time - saveTime + curTime; wrkEvent = wrkEvent->_nextEvent; } @@ -1140,31 +1140,31 @@ void Scheduler::insertAction(Act *action) { curEvent->_action = action; switch (action->_a0._actType) { // Assign whether local or global case AGSCHEDULE: - curEvent->_localActionFl = false; // Lasts over a new screen + curEvent->_localActionFl = false; // Lasts over a new screen break; // Workaround: When dying, switch to storyMode in order to block the keyboard. case GAMEOVER: _vm->getGameStatus()._storyModeFl = true; // No break on purpose default: - curEvent->_localActionFl = true; // Rest are for current screen only + curEvent->_localActionFl = true; // Rest are for current screen only break; } curEvent->_time = action->_a0._timer + getTicks(); // Convert rel to abs time // Now find the place to insert the event - if (!_tailEvent) { // Empty queue + if (!_tailEvent) { // Empty queue _tailEvent = _headEvent = curEvent; curEvent->_nextEvent = curEvent->_prevEvent = 0; } else { - Event *wrkEvent = _tailEvent; // Search from latest time back + Event *wrkEvent = _tailEvent; // Search from latest time back bool found = false; while (wrkEvent && !found) { - if (wrkEvent->_time <= curEvent->_time) { // Found if new event later + if (wrkEvent->_time <= curEvent->_time) { // Found if new event later found = true; - if (wrkEvent == _tailEvent) // New latest in list + if (wrkEvent == _tailEvent) // New latest in list _tailEvent = curEvent; else wrkEvent->_nextEvent->_prevEvent = curEvent; @@ -1175,8 +1175,8 @@ void Scheduler::insertAction(Act *action) { wrkEvent = wrkEvent->_prevEvent; } - if (!found) { // Must be earliest in list - _headEvent->_prevEvent = curEvent; // So insert as new head + if (!found) { // Must be earliest in list + _headEvent->_prevEvent = curEvent; // So insert as new head curEvent->_nextEvent = _headEvent; curEvent->_prevEvent = 0; _headEvent = curEvent; @@ -1196,106 +1196,106 @@ Event *Scheduler::doAction(Event *curEvent) { Act *action = curEvent->_action; Object *obj1; int dx, dy; - Event *wrkEvent; // Save ev_p->next_p for return + Event *wrkEvent; // Save ev_p->nextEvent for return switch (action->_a0._actType) { - case ANULL: // Big NOP from DEL_EVENTS + case ANULL: // Big NOP from DEL_EVENTS break; - case ASCHEDULE: // act0: Schedule an action list + case ASCHEDULE: // act0: Schedule an action list insertActionList(action->_a0._actIndex); break; - case START_OBJ: // act1: Start an object cycling + case START_OBJ: // act1: Start an object cycling _vm->_object->_objects[action->_a1._objIndex]._cycleNumb = action->_a1._cycleNumb; _vm->_object->_objects[action->_a1._objIndex]._cycling = action->_a1._cycle; break; - case INIT_OBJXY: // act2: Initialize an object + case INIT_OBJXY: // act2: Initialize an object _vm->_object->_objects[action->_a2._objIndex]._x = action->_a2._x; // Coordinates _vm->_object->_objects[action->_a2._objIndex]._y = action->_a2._y; break; - case PROMPT: // act3: Prompt user for key phrase + case PROMPT: // act3: Prompt user for key phrase promptAction(action); break; - case BKGD_COLOR: // act4: Set new background color + case BKGD_COLOR: // act4: Set new background color _vm->_screen->setBackgroundColor(action->_a4._newBackgroundColor); break; - case INIT_OBJVXY: // act5: Initialize an object velocity + case INIT_OBJVXY: // act5: Initialize an object velocity _vm->_object->setVelocity(action->_a5._objIndex, action->_a5._vx, action->_a5._vy); break; - case INIT_CARRY: // act6: Initialize an object + case INIT_CARRY: // act6: Initialize an object _vm->_object->setCarry(action->_a6._objIndex, action->_a6._carriedFl); // carried status break; - case INIT_HF_COORD: // act7: Initialize an object to hero's "feet" coords + case INIT_HF_COORD: // act7: Initialize an object to hero's "feet" coords _vm->_object->_objects[action->_a7._objIndex]._x = _vm->_hero->_x - 1; _vm->_object->_objects[action->_a7._objIndex]._y = _vm->_hero->_y + _vm->_hero->_currImagePtr->_y2 - 1; - _vm->_object->_objects[action->_a7._objIndex]._screenIndex = *_vm->_screen_p; // Don't forget screen! + _vm->_object->_objects[action->_a7._objIndex]._screenIndex = *_vm->_screenPtr; // Don't forget screen! break; - case NEW_SCREEN: // act8: Start new screen + case NEW_SCREEN: // act8: Start new screen newScreen(action->_a8._screenIndex); break; - case INIT_OBJSTATE: // act9: Initialize an object state + case INIT_OBJSTATE: // act9: Initialize an object state _vm->_object->_objects[action->_a9._objIndex]._state = action->_a9._newState; break; - case INIT_PATH: // act10: Initialize an object path and velocity + case INIT_PATH: // act10: Initialize an object path and velocity _vm->_object->setPath(action->_a10._objIndex, (Path) action->_a10._newPathType, action->_a10._vxPath, action->_a10._vyPath); break; - case COND_R: // act11: action lists conditional on object state + case COND_R: // act11: action lists conditional on object state if (_vm->_object->_objects[action->_a11._objIndex]._state == action->_a11._stateReq) insertActionList(action->_a11._actPassIndex); else insertActionList(action->_a11._actFailIndex); break; - case TEXT: // act12: Text box (CF WARN) + case TEXT: // act12: Text box (CF WARN) Utils::notifyBox(_vm->_file->fetchString(action->_a12._stringIndex)); // Fetch string from file break; - case SWAP_IMAGES: // act13: Swap 2 object images + case SWAP_IMAGES: // act13: Swap 2 object images _vm->_object->swapImages(action->_a13._objIndex1, action->_a13._objIndex2); break; - case COND_SCR: // act14: Conditional on current screen + case COND_SCR: // act14: Conditional on current screen if (_vm->_object->_objects[action->_a14._objIndex]._screenIndex == action->_a14._screenReq) insertActionList(action->_a14._actPassIndex); else insertActionList(action->_a14._actFailIndex); break; - case AUTOPILOT: // act15: Home in on a (stationary) object + case AUTOPILOT: // act15: Home in on a (stationary) object _vm->_object->homeIn(action->_a15._objIndex1, action->_a15._objIndex2, action->_a15._dx, action->_a15._dy); break; - case INIT_OBJ_SEQ: // act16: Set sequence number to use + case INIT_OBJ_SEQ: // act16: Set sequence number to use // Note: Don't set a sequence at time 0 of a new screen, it causes // problems clearing the boundary bits of the object! t>0 is safe _vm->_object->_objects[action->_a16._objIndex]._currImagePtr = _vm->_object->_objects[action->_a16._objIndex]._seqList[action->_a16._seqIndex]._seqPtr; break; - case SET_STATE_BITS: // act17: OR mask with curr obj state + case SET_STATE_BITS: // act17: OR mask with curr obj state _vm->_object->_objects[action->_a17._objIndex]._state |= action->_a17._stateMask; break; - case CLEAR_STATE_BITS: // act18: AND ~mask with curr obj state + case CLEAR_STATE_BITS: // act18: AND ~mask with curr obj state _vm->_object->_objects[action->_a18._objIndex]._state &= ~action->_a18._stateMask; break; - case TEST_STATE_BITS: // act19: If all bits set, do apass else afail + case TEST_STATE_BITS: // act19: If all bits set, do apass else afail if ((_vm->_object->_objects[action->_a19._objIndex]._state & action->_a19._stateMask) == action->_a19._stateMask) insertActionList(action->_a19._actPassIndex); else insertActionList(action->_a19._actFailIndex); break; - case DEL_EVENTS: // act20: Remove all events of this action type + case DEL_EVENTS: // act20: Remove all events of this action type delEventType(action->_a20._actTypeDel); break; - case GAMEOVER: // act21: Game over! + case GAMEOVER: // act21: Game over! // NOTE: Must wait at least 1 tick before issuing this action if // any objects are to be made invisible! gameStatus._gameOverFl = true; break; - case INIT_HH_COORD: // act22: Initialize an object to hero's actual coords + case INIT_HH_COORD: // act22: Initialize an object to hero's actual coords _vm->_object->_objects[action->_a22._objIndex]._x = _vm->_hero->_x; _vm->_object->_objects[action->_a22._objIndex]._y = _vm->_hero->_y; - _vm->_object->_objects[action->_a22._objIndex]._screenIndex = *_vm->_screen_p;// Don't forget screen! + _vm->_object->_objects[action->_a22._objIndex]._screenIndex = *_vm->_screenPtr;// Don't forget screen! break; - case EXIT: // act23: Exit game back to DOS + case EXIT: // act23: Exit game back to DOS _vm->endGame(); break; - case BONUS: // act24: Get bonus score for action + case BONUS: // act24: Get bonus score for action processBonus(action->_a24._pointIndex); break; - case COND_BOX: // act25: Conditional on bounding box + case COND_BOX: // act25: Conditional on bounding box obj1 = &_vm->_object->_objects[action->_a25._objIndex]; dx = obj1->_x + obj1->_currImagePtr->_x1; dy = obj1->_y + obj1->_currImagePtr->_y2; @@ -1305,25 +1305,25 @@ Event *Scheduler::doAction(Event *curEvent) { else insertActionList(action->_a25._actFailIndex); break; - case SOUND: // act26: Play a sound (or tune) + case SOUND: // act26: Play a sound (or tune) if (action->_a26._soundIndex < _vm->_tunesNbr) _vm->_sound->playMusic(action->_a26._soundIndex); else _vm->_sound->playSound(action->_a26._soundIndex, kSoundPriorityMedium); break; - case ADD_SCORE: // act27: Add object's value to score + case ADD_SCORE: // act27: Add object's value to score _vm->adjustScore(_vm->_object->_objects[action->_a27._objIndex]._objValue); break; - case SUB_SCORE: // act28: Subtract object's value from score + case SUB_SCORE: // act28: Subtract object's value from score _vm->adjustScore(-_vm->_object->_objects[action->_a28._objIndex]._objValue); break; - case COND_CARRY: // act29: Conditional on object being carried + case COND_CARRY: // act29: Conditional on object being carried if (_vm->_object->isCarried(action->_a29._objIndex)) insertActionList(action->_a29._actPassIndex); else insertActionList(action->_a29._actFailIndex); break; - case INIT_MAZE: // act30: Enable and init maze structure + case INIT_MAZE: // act30: Enable and init maze structure _vm->_maze._enabledFl = true; _vm->_maze._size = action->_a30._mazeSize; _vm->_maze._x1 = action->_a30._x1; @@ -1334,7 +1334,7 @@ Event *Scheduler::doAction(Event *curEvent) { _vm->_maze._x4 = action->_a30._x4; _vm->_maze._firstScreenIndex = action->_a30._firstScreenIndex; break; - case EXIT_MAZE: // act31: Disable maze mode + case EXIT_MAZE: // act31: Disable maze mode _vm->_maze._enabledFl = false; break; case INIT_PRIORITY: @@ -1343,71 +1343,71 @@ Event *Scheduler::doAction(Event *curEvent) { case INIT_SCREEN: _vm->_object->_objects[action->_a33._objIndex]._screenIndex = action->_a33._screenIndex; break; - case AGSCHEDULE: // act34: Schedule a (global) action list + case AGSCHEDULE: // act34: Schedule a (global) action list insertActionList(action->_a34._actIndex); break; - case REMAPPAL: // act35: Remap a palette color + case REMAPPAL: // act35: Remap a palette color _vm->_screen->remapPal(action->_a35._oldColorIndex, action->_a35._newColorIndex); break; - case COND_NOUN: // act36: Conditional on noun mentioned + case COND_NOUN: // act36: Conditional on noun mentioned if (_vm->_parser->isWordPresent(_vm->_text->getNounArray(action->_a36._nounIndex))) insertActionList(action->_a36._actPassIndex); else insertActionList(action->_a36._actFailIndex); break; - case SCREEN_STATE: // act37: Set new screen state + case SCREEN_STATE: // act37: Set new screen state _vm->_screenStates[action->_a37._screenIndex] = action->_a37._newState; break; - case INIT_LIPS: // act38: Position lips on object + case INIT_LIPS: // act38: Position lips on object _vm->_object->_objects[action->_a38._lipsObjIndex]._x = _vm->_object->_objects[action->_a38._objIndex]._x + action->_a38._dxLips; _vm->_object->_objects[action->_a38._lipsObjIndex]._y = _vm->_object->_objects[action->_a38._objIndex]._y + action->_a38._dyLips; - _vm->_object->_objects[action->_a38._lipsObjIndex]._screenIndex = *_vm->_screen_p; // Don't forget screen! + _vm->_object->_objects[action->_a38._lipsObjIndex]._screenIndex = *_vm->_screenPtr; // Don't forget screen! _vm->_object->_objects[action->_a38._lipsObjIndex]._cycling = kCycleForward; break; - case INIT_STORY_MODE: // act39: Init story_mode flag + case INIT_STORY_MODE: // act39: Init story_mode flag // This is similar to the QUIET path mode, except that it is // independant of it and it additionally disables the ">" prompt gameStatus._storyModeFl = action->_a39._storyModeFl; break; - case WARN: // act40: Text box (CF TEXT) + case WARN: // act40: Text box (CF TEXT) Utils::notifyBox(_vm->_file->fetchString(action->_a40._stringIndex)); break; - case COND_BONUS: // act41: Perform action if got bonus + case COND_BONUS: // act41: Perform action if got bonus if (_points[action->_a41._bonusIndex]._scoredFl) insertActionList(action->_a41._actPassIndex); else insertActionList(action->_a41._actFailIndex); break; - case TEXT_TAKE: // act42: Text box with "take" message + case TEXT_TAKE: // act42: Text box with "take" message Utils::notifyBox(Common::String::format(TAKE_TEXT, _vm->_text->getNoun(_vm->_object->_objects[action->_a42._objIndex]._nounIndex, TAKE_NAME))); break; - case YESNO: // act43: Prompt user for Yes or No + case YESNO: // act43: Prompt user for Yes or No if (Utils::yesNoBox(_vm->_file->fetchString(action->_a43._promptIndex))) insertActionList(action->_a43._actYesIndex); else insertActionList(action->_a43._actNoIndex); break; - case STOP_ROUTE: // act44: Stop any route in progress + case STOP_ROUTE: // act44: Stop any route in progress _vm->_route->resetRoute(); break; - case COND_ROUTE: // act45: Conditional on route in progress + case COND_ROUTE: // act45: Conditional on route in progress if (_vm->_route->getRouteIndex() >= action->_a45._routeIndex) insertActionList(action->_a45._actPassIndex); else insertActionList(action->_a45._actFailIndex); break; - case INIT_JUMPEXIT: // act46: Init status.jumpexit flag + case INIT_JUMPEXIT: // act46: Init status.jumpexit flag // This is to allow left click on exit to get there immediately // For example the plane crash in Hugo2 where hero is invisible // Couldn't use INVISIBLE flag since conflicts with boat in Hugo1 _vm->_mouse->setJumpExitFl(action->_a46._jumpExitFl); break; - case INIT_VIEW: // act47: Init object._viewx, viewy, dir + case INIT_VIEW: // act47: Init object._viewx, viewy, dir _vm->_object->_objects[action->_a47._objIndex]._viewx = action->_a47._viewx; _vm->_object->_objects[action->_a47._objIndex]._viewy = action->_a47._viewy; _vm->_object->_objects[action->_a47._objIndex]._direction = action->_a47._direction; break; - case INIT_OBJ_FRAME: // act48: Set seq,frame number to use + case INIT_OBJ_FRAME: // act48: Set seq,frame number to use // Note: Don't set a sequence at time 0 of a new screen, it causes // problems clearing the boundary bits of the object! t>0 is safe _vm->_object->_objects[action->_a48._objIndex]._currImagePtr = _vm->_object->_objects[action->_a48._objIndex]._seqList[action->_a48._seqIndex]._seqPtr; @@ -1424,11 +1424,11 @@ Event *Scheduler::doAction(Event *curEvent) { } if (action->_a0._actType == NEW_SCREEN) { // New_screen() deletes entire list - return 0; // next_p = 0 since list now empty + return 0; // nextEvent = 0 since list now empty } else { wrkEvent = curEvent->_nextEvent; - delQueue(curEvent); // Return event to free list - return wrkEvent; // Return next event ptr + delQueue(curEvent); // Return event to free list + return wrkEvent; // Return next event ptr } } @@ -1444,9 +1444,9 @@ Event *Scheduler::doAction(Event *curEvent) { void Scheduler::delQueue(Event *curEvent) { debugC(4, kDebugSchedule, "delQueue()"); - if (curEvent == _headEvent) { // If p was the head ptr - _headEvent = curEvent->_nextEvent; // then make new head_p - } else { // Unlink p + if (curEvent == _headEvent) { // If p was the head ptr + _headEvent = curEvent->_nextEvent; // then make new head_p + } else { // Unlink p curEvent->_prevEvent->_nextEvent = curEvent->_nextEvent; if (curEvent->_nextEvent) curEvent->_nextEvent->_prevEvent = curEvent->_prevEvent; @@ -1455,12 +1455,12 @@ void Scheduler::delQueue(Event *curEvent) { } if (_headEvent) - _headEvent->_prevEvent = 0; // Mark end of list + _headEvent->_prevEvent = 0; // Mark end of list else - _tailEvent = 0; // Empty queue + _tailEvent = 0; // Empty queue - curEvent->_nextEvent = _freeEvent; // Return p to free list - if (_freeEvent) // Special case, if free list was empty + curEvent->_nextEvent = _freeEvent; // Return p to free list + if (_freeEvent) // Special case, if free list was empty _freeEvent->_prevEvent = curEvent; _freeEvent = curEvent; } @@ -1470,10 +1470,10 @@ void Scheduler::delQueue(Event *curEvent) { */ void Scheduler::delEventType(const Action _actTypeDel) { // Note: actions are not deleted here, simply turned into NOPs! - Event *wrkEvent = _headEvent; // The earliest event + Event *wrkEvent = _headEvent; // The earliest event Event *saveEvent; - while (wrkEvent) { // While events found in list + while (wrkEvent) { // While events found in list saveEvent = wrkEvent->_nextEvent; if (wrkEvent->_action->_a20._actType == _actTypeDel) delQueue(wrkEvent); @@ -1524,11 +1524,11 @@ uint32 Scheduler_v1d::getTicks() { void Scheduler_v1d::runScheduler() { debugC(6, kDebugSchedule, "runScheduler"); - uint32 ticker = getTicks(); // The time now, in ticks - Event *curEvent = _headEvent; // The earliest event + uint32 ticker = getTicks(); // The time now, in ticks + Event *curEvent = _headEvent; // The earliest event - while (curEvent && (curEvent->_time <= ticker)) // While mature events found - curEvent = doAction(curEvent); // Perform the action (returns next_p) + while (curEvent && (curEvent->_time <= ticker)) // While mature events found + curEvent = doAction(curEvent); // Perform the action (returns nextEvent) } void Scheduler_v1d::promptAction(Act *action) { @@ -1583,7 +1583,7 @@ void Scheduler_v2d::promptAction(Act *action) { debug(1, "doAction(act3), expecting answer %s", _vm->_file->fetchString(action->_a3._responsePtr[0])); bool found = false; - const char *tmpStr; // General purpose string ptr + const char *tmpStr; // General purpose string ptr for (int dx = 0; !found && (action->_a3._responsePtr[dx] != -1); dx++) { tmpStr = _vm->_file->fetchString(action->_a3._responsePtr[dx]); @@ -1638,12 +1638,12 @@ uint32 Scheduler_v1w::getTicks() { void Scheduler_v1w::runScheduler() { debugC(6, kDebugSchedule, "runScheduler"); - uint32 ticker = getTicks(); // The time now, in ticks - Event *curEvent = _headEvent; // The earliest event + uint32 ticker = getTicks(); // The time now, in ticks + Event *curEvent = _headEvent; // The earliest event - while (curEvent && (curEvent->_time <= ticker)) // While mature events found - curEvent = doAction(curEvent); // Perform the action (returns next_p) + while (curEvent && (curEvent->_time <= ticker)) // While mature events found + curEvent = doAction(curEvent); // Perform the action (returns nextEvent) - _vm->getGameStatus()._tick++; // Accessed elsewhere via getTicks() + _vm->getGameStatus()._tick++; // Accessed elsewhere via getTicks() } } // End of namespace Hugo diff --git a/engines/hugo/sound.cpp b/engines/hugo/sound.cpp index a8b4759d9b..aefa03cd5e 100644 --- a/engines/hugo/sound.cpp +++ b/engines/hugo/sound.cpp @@ -174,7 +174,7 @@ void SoundHandler::toggleSound() { _vm->_config._soundFl = !_vm->_config._soundFl; } -void SoundHandler::playMIDI(sound_pt seqPtr, uint16 size) { +void SoundHandler::playMIDI(SoundPtr seqPtr, uint16 size) { _midiPlayer->play(seqPtr, size); } @@ -182,7 +182,7 @@ void SoundHandler::playMIDI(sound_pt seqPtr, uint16 size) { * Read a tune sequence from the sound database and start playing it */ void SoundHandler::playMusic(int16 tune) { - sound_pt seqPtr; // Sequence data from file + SoundPtr seqPtr; // Sequence data from file uint16 size; // Size of sequence data if (_vm->_config._musicFl) { @@ -198,9 +198,9 @@ void SoundHandler::playMusic(int16 tune) { * Override currently playing sound only if lower or same 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 + // uint32 dwVolume; // Left, right volume of sound + SoundPtr soundPtr; // Sound data + uint16 size; // Size of data // Sound disabled if (!_vm->_config._soundFl || !_vm->_mixer->isReady()) @@ -210,10 +210,10 @@ void SoundHandler::playSound(int16 sound, const byte priority) { _curPriority = priority; // Get sound data - if ((sound_p = _vm->_file->getSound(sound, &size)) == 0) + if ((soundPtr = _vm->_file->getSound(sound, &size)) == 0) return; - Audio::AudioStream *stream = Audio::makeRawStream(sound_p, size, 11025, Audio::FLAG_UNSIGNED); + Audio::AudioStream *stream = Audio::makeRawStream(soundPtr, size, 11025, Audio::FLAG_UNSIGNED); _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, stream); } diff --git a/engines/hugo/sound.h b/engines/hugo/sound.h index cb6d4e3168..b00d93eeb1 100644 --- a/engines/hugo/sound.h +++ b/engines/hugo/sound.h @@ -97,7 +97,7 @@ private: void stopSound(); void stopMusic(); - void playMIDI(sound_pt seq_p, uint16 size); + void playMIDI(SoundPtr seqPtr, uint16 size); }; } // End of namespace Hugo -- cgit v1.2.3 From 53ee7f52a9e39e90313ada5613dd89d4fdbe3943 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 18 Jun 2012 21:23:39 +0200 Subject: HUGO: Remove dead code --- engines/hugo/file.h | 3 --- engines/hugo/hugo.cpp | 15 +-------------- 2 files changed, 1 insertion(+), 17 deletions(-) (limited to 'engines/hugo') diff --git a/engines/hugo/file.h b/engines/hugo/file.h index e4aa7f7fec..1438bd2054 100644 --- a/engines/hugo/file.h +++ b/engines/hugo/file.h @@ -123,9 +123,6 @@ protected: private: byte *convertPCC(byte *p, const uint16 y, const uint16 bpl, ImagePtr dataPtr) const; UifHdr *getUIFHeader(const Uif id); - -//Strangerke : Not used? - void printBootText(); }; class FileManager_v1d : public FileManager { diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp index f2db630198..9d28e0ac69 100644 --- a/engines/hugo/hugo.cpp +++ b/engines/hugo/hugo.cpp @@ -541,19 +541,6 @@ void HugoEngine::initStatus() { // Initialize every start of new game _status._tick = 0; // Tick count _status._viewState = kViewIdle; // View state - -// Strangerke - Suppress as related to playback -// _status._recordFl = false; // Not record mode -// _status._playbackFl = false; // Not playback mode -// Strangerke - Not used ? -// _status._mmtime = false; // Multimedia timer support -// _status._helpFl = false; // Not calling WinHelp() -// _status._demoFl = false; // Not demo mode -// _status._path[0] = 0; // Path to write files -// _status._screenWidth = 0; // Desktop screen width -// _status._saveTick = 0; // Time of last save -// _status._saveSlot = 0; // Slot to save/restore game -// _status._textBoxFl = false; // Not processing a text box } /** @@ -566,7 +553,7 @@ void HugoEngine::initConfig() { _config._soundFl = true; // Sound state initially on _config._turboFl = false; // Turbo state initially off initPlaylist(_config._playlist); // Initialize default tune playlist - _file->readBootFile(); // Read startup structure + _file->readBootFile(); // Read startup structure } /** -- cgit v1.2.3 From 6e11720e298805904181656b282b217cacc3675a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 18 Jun 2012 21:27:58 +0200 Subject: HUGO: Missing file in previous commit --- engines/hugo/file.cpp | 43 ------------------------------------------- 1 file changed, 43 deletions(-) (limited to 'engines/hugo') diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp index 5556f5abc0..15ee06c82a 100644 --- a/engines/hugo/file.cpp +++ b/engines/hugo/file.cpp @@ -522,49 +522,6 @@ bool FileManager::restoreGame(const int16 slot) { return true; } -/** - * Read the encrypted text from the boot file and print it - */ -void FileManager::printBootText() { - debugC(1, kDebugFile, "printBootText()"); - - Common::File ofp; - if (!ofp.open(getBootFilename())) { - if (_vm->getPlatform() == Common::kPlatformPC) { - //TODO initialize properly _boot structure - warning("printBootText - Skipping as Dos versions may be a freeware or shareware"); - return; - } else { - Utils::notifyBox(Common::String::format("Missing startup file '%s'", getBootFilename())); - _vm->getGameStatus()._doQuitFl = true; - return; - } - } - - // Allocate space for the text and print it - char *buf = (char *)malloc(_vm->_boot._exitLen + 1); - if (buf) { - // Skip over the boot structure (already read) and read exit text - ofp.seek((long)sizeof(_vm->_boot), SEEK_SET); - if (ofp.read(buf, _vm->_boot._exitLen) != (size_t)_vm->_boot._exitLen) { - Utils::notifyBox(Common::String::format("Error while reading startup file '%s'", getBootFilename())); - _vm->getGameStatus()._doQuitFl = true; - return; - } - - // Decrypt the exit text, using CRYPT substring - int i; - for (i = 0; i < _vm->_boot._exitLen; i++) - buf[i] ^= s_bootCypher[i % s_bootCypherLen]; - - buf[i] = '\0'; - Utils::notifyBox(buf); - } - - free(buf); - ofp.close(); -} - /** * Reads boot file for program environment. Fatal error if not there or * file checksum is bad. De-crypts structure while checking checksum -- cgit v1.2.3 From e8546a46a01ee74f7d9833196246b27fbc5bc473 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 18 Jun 2012 21:30:51 +0200 Subject: HUGO: Remove F9 key handling --- engines/hugo/display.cpp | 2 +- engines/hugo/parser.cpp | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'engines/hugo') diff --git a/engines/hugo/display.cpp b/engines/hugo/display.cpp index b86b1f0366..fbe39b3a0c 100644 --- a/engines/hugo/display.cpp +++ b/engines/hugo/display.cpp @@ -488,7 +488,7 @@ void Screen::userHelp() const { "F5 - Restore game\n" "F6 - Inventory\n" "F8 - Turbo button\n" - "F9 - Boss button\n\n" + "\n" "ESC - Return to game"); } diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp index d18cc2181c..5fdb2026a7 100644 --- a/engines/hugo/parser.cpp +++ b/engines/hugo/parser.cpp @@ -362,9 +362,6 @@ void Parser::keyHandler(Common::Event event) { case Common::KEYCODE_F8: // Turbo mode switchTurbo(); break; - case Common::KEYCODE_F9: // Boss button - warning("STUB: F9 (DOS) - BossKey"); - break; default: // Any other key if (!gameStatus._storyModeFl) { // Keyboard disabled // Add printable keys to ring buffer -- cgit v1.2.3 From 3b14ff33caeff827c2a4e82dc61c6a61d83c8d94 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 3 Jul 2012 18:34:58 +0200 Subject: HUGO: Slight cleanup in querySaveMetaInfos. --- engines/hugo/detection.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'engines/hugo') diff --git a/engines/hugo/detection.cpp b/engines/hugo/detection.cpp index 90708163f5..bb5944acc8 100644 --- a/engines/hugo/detection.cpp +++ b/engines/hugo/detection.cpp @@ -244,9 +244,6 @@ SaveStateDescriptor HugoMetaEngine::querySaveMetaInfos(const char *target, int s Graphics::Surface *const thumbnail = Graphics::loadThumbnail(*file); desc.setThumbnail(thumbnail); - desc.setDeletableFlag(true); - desc.setWriteProtectedFlag(false); - uint32 saveDate = file->readUint32BE(); uint16 saveTime = file->readUint16BE(); -- cgit v1.2.3 From fb6a5a140d507b1160f5553fb45ca5e56a2bbe02 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 13 Sep 2012 01:51:21 +0300 Subject: HUGO: Switch to the common PCX decoder --- engines/hugo/file.cpp | 82 +++++++++++---------------------------------------- engines/hugo/file.h | 5 +--- 2 files changed, 19 insertions(+), 68 deletions(-) (limited to 'engines/hugo') diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp index 15ee06c82a..5945579ffb 100644 --- a/engines/hugo/file.cpp +++ b/engines/hugo/file.cpp @@ -32,7 +32,11 @@ #include "common/savefile.h" #include "common/textconsole.h" #include "common/config-manager.h" + +#include "graphics/surface.h" +#include "graphics/decoders/pcx.h" #include "graphics/thumbnail.h" + #include "gui/saveload.h" #include "hugo/hugo.h" @@ -87,67 +91,34 @@ const char *FileManager::getUifFilename() const { return "uif.dat"; } -/** - * Convert 4 planes (RGBI) data to 8-bit DIB format - * Return original plane data ptr - */ -byte *FileManager::convertPCC(byte *p, const uint16 y, const uint16 bpl, ImagePtr dataPtr) const { - debugC(2, kDebugFile, "convertPCC(byte *p, %d, %d, ImagePtr dataPtr)", y, bpl); - - dataPtr += y * bpl * 8; // Point to correct DIB line - for (int16 r = 0, g = bpl, b = g + bpl, i = b + bpl; r < bpl; r++, g++, b++, i++) { // Each byte in all planes - for (int8 bit = 7; bit >= 0; bit--) { // Each bit in byte - *dataPtr++ = (((p[r] >> bit & 1) << 0) | - ((p[g] >> bit & 1) << 1) | - ((p[b] >> bit & 1) << 2) | - ((p[i] >> bit & 1) << 3)); - } - } - return p; -} - /** * Read a pcx file of length len. Use supplied seqPtr and image_p or * allocate space if NULL. Name used for errors. Returns address of seqPtr * Set first TRUE to initialize b_index (i.e. not reading a sequential image in file). */ -Seq *FileManager::readPCX(Common::ReadStream &f, Seq *seqPtr, byte *imagePtr, const bool firstFl, const char *name) { +Seq *FileManager::readPCX(Common::SeekableReadStream &f, Seq *seqPtr, byte *imagePtr, const bool firstFl, const char *name) { debugC(1, kDebugFile, "readPCX(..., %s)", name); - // Read in the PCC header and check consistency - _PCCHeader._mfctr = f.readByte(); - _PCCHeader._vers = f.readByte(); - _PCCHeader._enc = f.readByte(); - _PCCHeader._bpx = f.readByte(); - _PCCHeader._x1 = f.readUint16LE(); - _PCCHeader._y1 = f.readUint16LE(); - _PCCHeader._x2 = f.readUint16LE(); - _PCCHeader._y2 = f.readUint16LE(); - _PCCHeader._xres = f.readUint16LE(); - _PCCHeader._yres = f.readUint16LE(); - f.read(_PCCHeader._palette, sizeof(_PCCHeader._palette)); - _PCCHeader._vmode = f.readByte(); - _PCCHeader._planes = f.readByte(); - _PCCHeader._bytesPerLine = f.readUint16LE(); - f.read(_PCCHeader._fill2, sizeof(_PCCHeader._fill2)); - - if (_PCCHeader._mfctr != 10) - error("Bad data file format: %s", name); - // Allocate memory for Seq if 0 if (seqPtr == 0) { if ((seqPtr = (Seq *)malloc(sizeof(Seq))) == 0) error("Insufficient memory to run game."); } + Graphics::PCXDecoder pcx; + if (!pcx.loadStream(f)) + error("Error while reading PCX image"); + + const Graphics::Surface *pcxSurface = pcx.getSurface(); + if (pcxSurface->format.bytesPerPixel != 1) + error("Invalid bytes per pixel in PCX surface (%d)", pcxSurface->format.bytesPerPixel); + // Find size of image data in 8-bit DIB format // Note save of x2 - marks end of valid data before garbage - uint16 bytesPerLine4 = _PCCHeader._bytesPerLine * 4; // 4-bit bpl - seqPtr->_bytesPerLine8 = bytesPerLine4 * 2; // 8-bit bpl - seqPtr->_lines = _PCCHeader._y2 - _PCCHeader._y1 + 1; - seqPtr->_x2 = _PCCHeader._x2 - _PCCHeader._x1 + 1; + seqPtr->_lines = pcxSurface->h; + seqPtr->_x2 = seqPtr->_bytesPerLine8 = pcxSurface->w; // Size of the image - uint16 size = seqPtr->_lines * seqPtr->_bytesPerLine8; + uint16 size = pcxSurface->w * pcxSurface->h; // Allocate memory for image data if NULL if (imagePtr == 0) @@ -156,26 +127,9 @@ Seq *FileManager::readPCX(Common::ReadStream &f, Seq *seqPtr, byte *imagePtr, co assert(imagePtr); seqPtr->_imagePtr = imagePtr; + for (uint16 y = 0; y < pcxSurface->h; y++) + memcpy(imagePtr + y * pcxSurface->pitch, pcxSurface->getBasePtr(0, y), pcxSurface->w); - // Process the image data, converting to 8-bit DIB format - uint16 y = 0; // Current line index - byte pline[kXPix]; // Hold 4 planes of data - byte *p = pline; // Ptr to above - while (y < seqPtr->_lines) { - byte c = f.readByte(); - if ((c & kRepeatMask) == kRepeatMask) { - byte d = f.readByte(); // Read data byte - for (int i = 0; i < (c & kLengthMask); i++) { - *p++ = d; - if ((uint16)(p - pline) == bytesPerLine4) - p = convertPCC(pline, y++, _PCCHeader._bytesPerLine, imagePtr); - } - } else { - *p++ = c; - if ((uint16)(p - pline) == bytesPerLine4) - p = convertPCC(pline, y++, _PCCHeader._bytesPerLine, imagePtr); - } - } return seqPtr; } diff --git a/engines/hugo/file.h b/engines/hugo/file.h index 1438bd2054..44f257a2af 100644 --- a/engines/hugo/file.h +++ b/engines/hugo/file.h @@ -112,16 +112,13 @@ protected: Common::File _sceneryArchive1; // Handle for scenery file Common::File _objectsArchive; // Handle for objects file - PCCHeader _PCCHeader; - - Seq *readPCX(Common::ReadStream &f, Seq *seqPtr, byte *imagePtr, const bool firstFl, const char *name); + Seq *readPCX(Common::SeekableReadStream &f, Seq *seqPtr, byte *imagePtr, const bool firstFl, const char *name); // If this is the first call, read the lookup table bool _hasReadHeader; SoundHdr _soundHdr[kMaxSounds]; // Sound lookup table private: - byte *convertPCC(byte *p, const uint16 y, const uint16 bpl, ImagePtr dataPtr) const; UifHdr *getUIFHeader(const Uif id); }; -- cgit v1.2.3 From ef671f20b108de79c006cdc95fc6ee613e46ab98 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 14 Sep 2012 03:35:18 +0300 Subject: HUGO: Use surface width instead of its pitch when copying to raw memory blobs This is according to wjp's suggestion - the pitch didn't make sense there --- engines/hugo/file.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/hugo') diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp index 5945579ffb..1758f3f6a5 100644 --- a/engines/hugo/file.cpp +++ b/engines/hugo/file.cpp @@ -128,7 +128,7 @@ Seq *FileManager::readPCX(Common::SeekableReadStream &f, Seq *seqPtr, byte *imag seqPtr->_imagePtr = imagePtr; for (uint16 y = 0; y < pcxSurface->h; y++) - memcpy(imagePtr + y * pcxSurface->pitch, pcxSurface->getBasePtr(0, y), pcxSurface->w); + memcpy(imagePtr + y * pcxSurface->w, pcxSurface->getBasePtr(0, y), pcxSurface->w); return seqPtr; } -- cgit v1.2.3